Skip to content

Commit

Permalink
[eclipse-iceoryx#264] Add full C++ Config interface
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Sep 9, 2024
1 parent 97b1b27 commit 28fdcc5
Showing 1 changed file with 114 additions and 1 deletion.
115 changes: 114 additions & 1 deletion iceoryx2-ffi/cxx/include/iox2/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,141 @@
#ifndef IOX2_CONFIG_HPP
#define IOX2_CONFIG_HPP

#include "iox/expected.hpp"
#include "iox/duration.hpp"
#include "iox/file_name.hpp"
#include "iox/path.hpp"
#include "iox2/internal/iceoryx2.hpp"
#include "iox2/unable_to_deliver_strategy.hpp"

namespace iox2 {
class Config;

namespace config {
class Global;

class Node {
public:
auto directory() && -> const char*;
auto set_directory(const iox::Path& value) &&;
auto monitor_suffix() && -> const char*;
auto set_monitor_suffix(const iox::FileName& value) &&;
auto static_config_suffix() && -> const char*;
auto set_static_config_suffix(const iox::FileName& value) &&;
auto service_tag_suffix() && -> const char*;
auto set_service_tag_suffix(const iox::FileName& value) &&;
auto cleanup_dead_nodes_on_creation() && -> bool;
auto set_cleanup_dead_nodes_on_creation(bool value) &&;
auto cleanup_dead_nodes_on_destruction() && -> bool;
auto set_cleanup_dead_nodes_on_destruction(bool value) &&;

private:
friend class Global;
explicit Node(Config* config);

Config* m_config;
};

class Service {
public:
auto directory() && -> const char*;
auto set_directory(const iox::Path& value) &&;
auto publisher_data_segment_suffix() && -> const char*;
auto set_publisher_data_segment_suffix(const iox::FileName& value) &&;
auto static_config_storage_suffix() && -> const char*;
auto set_static_config_storage_suffix(const iox::FileName& value) &&;
auto dynamic_config_storage_suffix() && -> const char*;
auto set_dynamic_config_storage_suffix(const iox::FileName& value) &&;
auto creation_timeout() && -> iox::units::Duration;
auto set_creation_timeout(const iox::units::Duration& value) &&;
auto connection_suffix() && -> const char*;
auto set_connection_suffix(const iox::FileName& value) &&;
auto event_connection_suffix() && -> const char*;
auto set_event_connection_suffix(const iox::FileName& value) &&;

private:
friend class Global;
explicit Service(Config* config);

Config* m_config;
};

class Global {
public:
auto prefix() && -> const char*;
void set_prefix(const iox::FileName& value) &&;
auto root_path() && -> const char*;
void set_root_path(const iox::Path& value) &&;

auto service() -> Service;
auto node() -> Node;

private:
friend class ::iox2::Config;
explicit Global(Config* config);

Config* m_config;
};

class PublishSubscribe {
public:
auto max_subscribers() -> size_t;
void set_max_subscribers(size_t value);
auto max_publishers() -> size_t;
void set_max_publishers(size_t value);
auto max_nodes() -> size_t;
void set_max_nodes(size_t value);
auto subscriber_max_buffer_size() -> size_t;
void set_subscriber_max_buffer_size(size_t value);
auto subscriber_max_borrowed_samples() -> size_t;
void set_subscriber_max_borrowed_samples(size_t value);
auto publisher_max_loaned_samples() -> size_t;
void set_publisher_max_loaned_samples(size_t value);
auto publisher_history_size() -> size_t;
void set_history_sizeed_samples(size_t value);
auto enable_safe_overflow() -> bool;
void set_enable_safe_overflow(bool value);
auto unable_to_deliver_strategy() -> UnableToDeliverStrategy;
void set_unable_to_deliver_strategy(UnableToDeliverStrategy value);
auto subscriber_expired_connection_buffer() -> size_t;
void set_subscriber_expired_connection_buffer(size_t value);

private:
friend class Defaults;
explicit PublishSubscribe(Config* config);

Config* m_config;
};

class Event {
public:
auto max_listeners() -> size_t;
void set_max_listeners(size_t value);
auto max_notifiers() -> size_t;
void set_max_notifiers(size_t value);
auto max_nodes() -> size_t;
void set_max_nodes(size_t value);
auto event_id_max_value() -> size_t;
void set_event_id_max_value(size_t value);

private:
friend class Defaults;
explicit Event(Config* config);

Config* m_config;
};

class Defaults {
public:
auto publish_subscribe() -> PublishSubscribe;
auto event() -> Event;

private:
friend class ::iox2::Config;
explicit Defaults(Config* config);

Config* m_config;
};

} // namespace config

/// Non-owning view of a [`Config`].
Expand Down

0 comments on commit 28fdcc5

Please sign in to comment.