Skip to content

Commit

Permalink
Restructered config file structure, config namespaces and and file na…
Browse files Browse the repository at this point in the history
…mes.
  • Loading branch information
Peguen committed May 22, 2024
1 parent cafb419 commit 25116ea
Show file tree
Hide file tree
Showing 25 changed files with 174 additions and 204 deletions.
2 changes: 1 addition & 1 deletion doc/rst/configuration/runtime_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The size object can be used like a normal integer.
eCAL::Config::ConstrainedInteger<1024, 512, 8192> size_4mb = 1024 + 6 * 512;
std::cout << size_4mb << "\n";

For specifying sizes in the ecal configuration object, refer to the .ini file or "ecal/types/ecal_config_types.h" for the limitations.
For specifying sizes in the ecal configuration object, refer to the .ini file or "ecal/config/ecal_configuration.h" for the limitations.

Initialization of the configuration
===================================
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ set(ecal_header_cmn
include/ecal/ecal_tlayer.h
include/ecal/ecal_types.h
include/ecal/ecal_util.h
include/ecal/types/ecal_config_types.h
include/ecal/config/ecal_configuration.h
)

set(ecal_header_cimpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

/**
* @file ecal_application_options.h
* @brief eCAL options for configuration of applications
* @file ecal_application_config.h
* @brief eCAL configuration for applications
**/

#pragma once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@
*/

/**
* @file ecal_config_types.h
* @brief eCAL config interface using structs
* @file ecal_configuration.h
* @brief eCAL configuration interface
**/

#pragma once

#include "ecal_application_options.h"
#include "ecal_custom_data_types.h"
#include "ecal_monitoring_options.h"
#include "ecal_publisher_options.h"
#include "ecal_registration_options.h"
#include "ecal_service_options.h"
#include "ecal_logging_options.h"
#include "ecal_transport_layer_options.h"
#include "user_arg_options.h"
#include "ecal/config/ecal_publisher_config.h"
#include "ecal/config/ecal_subscriber_config.h"
#include <ecal/config/ecal_application_config.h>
#include <ecal/config/ecal_monitoring_config.h>
#include <ecal/config/ecal_registration_config.h>
#include <ecal/config/ecal_service_config.h>
#include <ecal/config/ecal_logging_config.h>
#include <ecal/config/ecal_transport_layer_config.h>
#include <ecal/config/user_arguments.h>
#include <ecal/config/ecal_publisher_config.h>
#include <ecal/config/ecal_subscriber_config.h>
#include <ecal/types/ecal_custom_data_types.h>


#include "ecal/ecal_os.h"
#include "ecal/ecal_log_level.h"
Expand All @@ -49,14 +49,14 @@ namespace eCAL
struct Configuration
{
TransportLayer::Configuration transport_layer{};
Config::RegistrationOptions registration{};
Config::MonitoringOptions monitoring{};
Registration::Configuration registration{};
Monitoring::Configuration monitoring{};
Subscriber::Configuration subscriber{};
Publisher::Configuration publisher{};
Config::TimesyncOptions timesync{};
Config::ServiceOptions service{};
Service::TimesyncOptions timesync{};
Service::Configuration service{};
Application::Configuration application{};
Config::LoggingOptions logging{};
Logging::Configuration logging{};
Cli::Configuration command_line_arguments{};

ECAL_API Configuration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

/**
* @file ecal_logging_options.h
* @brief eCAL options for logging configuration
* @file ecal_logging_config.h
* @brief eCAL configuration for logging
**/

#pragma once
Expand All @@ -28,9 +28,9 @@

namespace eCAL
{
namespace Config
namespace Logging
{
struct LoggingOptions
struct Configuration
{
eCAL_Logging_Filter filter_log_con{};
eCAL_Logging_Filter filter_log_file{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,53 @@
*/

/**
* @file ecal_monitoring_options.h
* @brief eCAL options for monitoring configuration
* @file ecal_monitoring_config.h
* @brief eCAL configuration for monitoring
**/

#pragma once

#include "ecal_custom_data_types.h"
#include <ecal/types/ecal_custom_data_types.h>

namespace eCAL
{
namespace Config
namespace Monitoring
{
enum MonitoringMode
namespace Types
{
none = 0,
udp_monitoring = 1 << 0,
shm_monitoring = 1 << 1
};
enum Mode
{
none = 0,
udp_monitoring = 1 << 0,
shm_monitoring = 1 << 1
};

using eCAL_MonitoringMode_Filter = char;
using Mode_Filter = char;
}

struct UDPMonitoringOptions
namespace UDP
{
// Here?
};
struct Configuration
{
};
}

struct SHMMonitoringOptions
namespace SHM
{
std::string shm_monitoring_domain{};
size_t shm_monitoring_queue_size{};
};
struct Configuration
{
std::string shm_monitoring_domain{};
size_t shm_monitoring_queue_size{};
};
}

struct MonitoringOptions
struct Configuration
{
eCAL_MonitoringMode_Filter monitoring_mode{};
ConstrainedInteger<1000, 1000> monitoring_timeout{};
bool network_monitoring{};
UDPMonitoringOptions udp_options{};
SHMMonitoringOptions shm_options{};
Types::Mode_Filter monitoring_mode{};
eCAL::Types::ConstrainedInteger<1000, 1000> monitoring_timeout{};
bool network_monitoring{};
UDP::Configuration udp_options{};
SHM::Configuration shm_options{};

std::string filter_excl{};
std::string filter_incl{};
Expand Down
8 changes: 4 additions & 4 deletions ecal/core/include/ecal/config/ecal_publisher_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ namespace eCAL
bool zero_copy_mode; //!< enable zero copy shared memory transport mode
unsigned int acknowledge_timeout_ms; /*!< force connected subscribers to send acknowledge event after processing the message
the publisher send call is blocked on this event with this timeout (0 == no handshake) */
Config::ConstrainedInteger<4096, 4096> memfile_min_size_bytes; //!< default memory file size for new publisher
Config::ConstrainedInteger<50, 1, 100> memfile_reserve_percent; //!< dynamic file size reserve before recreating memory file if topic size changes
Config::ConstrainedInteger<1, 1> memfile_buffer_count; //!< maximum number of used buffers (needs to be greater than 1, default = 1)
Types::ConstrainedInteger<4096, 4096> memfile_min_size_bytes; //!< default memory file size for new publisher
Types::ConstrainedInteger<50, 1, 100> memfile_reserve_percent; //!< dynamic file size reserve before recreating memory file if topic size changes
Types::ConstrainedInteger<1, 1> memfile_buffer_count; //!< maximum number of used buffers (needs to be greater than 1, default = 1)
};
}

Expand All @@ -117,7 +117,7 @@ namespace eCAL
{
bool enable; //!< enable layer
bool loopback; //!< enable to receive udp messages on the same local machine
Config::ConstrainedInteger<5242880, 1024> sndbuf_size_bytes; //!< udp send buffer size in bytes (default 5MB)
Types::ConstrainedInteger<5242880, 1024> sndbuf_size_bytes; //!< udp send buffer size in bytes (default 5MB)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

/**
* @file ecal_registration_options.h
* @brief eCAL options for configuration of the registration layer
* @file ecal_registration_config.h
* @brief eCAL configuration for the registration layer
**/

#pragma once
Expand All @@ -31,7 +31,7 @@

namespace eCAL
{
namespace Config
namespace Registration
{
/**
* @brief Struct for storing RegistrationOptions.
Expand All @@ -44,11 +44,11 @@ namespace eCAL
*
* @throws std::invalid_argument exception.
**/
struct RegistrationOptions
struct Configuration
{
public:
ECAL_API RegistrationOptions();
ECAL_API RegistrationOptions(unsigned int reg_timeout_, unsigned int reg_refresh_);
ECAL_API Configuration();
ECAL_API Configuration(unsigned int reg_timeout_, unsigned int reg_refresh_);

ECAL_API unsigned int getTimeoutMS() const;
ECAL_API unsigned int getRefreshMS() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

/**
* @file ecal_service_options.h
* @brief eCAL options for configuration of services
* @file ecal_service_config.h
* @brief eCAL configuration for services
**/

#pragma once
Expand All @@ -28,9 +28,9 @@

namespace eCAL
{
namespace Config
namespace Service
{
struct ServiceOptions
struct Configuration
{
bool protocol_v0{};
bool protocol_v1{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
*/

/**
* @file ecal_transport_layer_options.h
* @brief eCAL options for configuration of the transport layer
* @file ecal_transport_layer_config.h
* @brief eCAL configuration for the transport layer
**/

// TODO PG: Deprecated?
#pragma once

#include "ecal_custom_data_types.h"
#include <ecal/types/ecal_custom_data_types.h>

namespace eCAL
{
Expand All @@ -40,25 +41,25 @@ namespace eCAL
struct SHMOptions
{
std::string host_group_name{};
Config::ConstrainedInteger<4096, 4096> memfile_minsize{};
Config::ConstrainedInteger<50, 1, 100> memfile_reserve{};
Types::ConstrainedInteger<4096, 4096> memfile_minsize{};
Types::ConstrainedInteger<50, 1, 100> memfile_reserve{};
int memfile_ack_timeout{};
Config::ConstrainedInteger<0, 1> memfile_buffer_count{};
Types::ConstrainedInteger<0, 1> memfile_buffer_count{};
bool drop_out_of_order_messages{};
bool memfile_zero_copy{};
};

struct UdpMulticastOptions
{
Config::UdpConfigVersion config_version{};
Config::IpAddressV4 group{};
Config::IpAddressV4 mask{};
Config::ConstrainedInteger<14000, 10> port{};
unsigned int ttl{};
Types::UdpConfigVersion config_version{};
Types::IpAddressV4 group{};
Types::IpAddressV4 mask{};
Types::ConstrainedInteger<14000, 10> port{};
unsigned int ttl{};
// TODO PG: are these minimum limits correct?
Config::ConstrainedInteger<5242880, 1024> sndbuf{};
Config::ConstrainedInteger<5242880, 1024> recbuf{};
bool join_all_interfaces{};
Types::ConstrainedInteger<5242880, 1024> sndbuf{};
Types::ConstrainedInteger<5242880, 1024> recbuf{};
bool join_all_interfaces{};

int bandwidth_max_udp{};
bool npcap_enabled{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

/**
* @file user_arg_options.h
* @brief Options specified by the user via command line
* @file user_arguments.h
* @brief Arguments given by the user via command line
**/

#pragma once
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/ecal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,4 +42,4 @@
#include <ecal/ecal_timer.h>
#include <ecal/ecal_tlayer.h>
#include <ecal/ecal_util.h>
#include <ecal/types/ecal_config_types.h>
#include <ecal/config/ecal_configuration.h>
Loading

0 comments on commit 25116ea

Please sign in to comment.