Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] Implementation of new configuration management #1505

Merged
merged 120 commits into from
Jun 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
382d9ef
First working implementation for config management.
Peguen Feb 20, 2024
0e9c039
Merge branch 'master' into feature/user_config_implementation
Peguen Feb 20, 2024
49e8ade
Resolved some merging problems.
Peguen Feb 21, 2024
70366d5
Fixed copy paste issue values for receivingOptions in ecal_config_ini…
Peguen Feb 21, 2024
00b2ec1
Config Adaptions: Set LimitSize default paramaeter to template MIN va…
Peguen Feb 21, 2024
eb31c72
Refactored options and config access.
Peguen Mar 27, 2024
548037f
Changed defines to constexpr in ecal_dev_ini.h
Peguen Mar 27, 2024
5b07971
Removed doubled constexpr.
Peguen Mar 27, 2024
9cd3594
Removed former ecal_config cpp and h from core/CMakesLists
Peguen Mar 28, 2024
9e1be9a
Removed ms_t from registration_options and handling in using functions.
Peguen Mar 28, 2024
c5ab1dc
Fixed ecal_registration cpp time config import.
Peguen Mar 28, 2024
05ec616
Refactored config options in application.
Peguen Mar 28, 2024
a861b01
Added process_options.terminal_emulator to config.
Peguen Mar 28, 2024
e35df5a
Refactored sys- and processoptions as sub to application options.
Peguen Mar 28, 2024
4a0ce13
Refactored default config to use ecal_def.h defines.
Peguen Mar 28, 2024
153ee9e
Refactored ini config to use ecal_def.h
Peguen Mar 28, 2024
94f91ae
Moved IpAddressV4 definitions to private space.
Peguen Mar 28, 2024
b196ab4
Removed unused fields.
Peguen Mar 28, 2024
afe2332
Fixed some GH actions compiling issues.
Peguen Mar 28, 2024
4887b02
Removed unnecessary comments in header files.
Peguen Mar 28, 2024
c768ba9
Changed #include <limits> to correct header.
Peguen Apr 2, 2024
6306d99
Merge branch 'master' into feature/user_config_implementation
Peguen Apr 2, 2024
b4690a0
Some updates regarding new configuration management to ecal_core.
Peguen Apr 2, 2024
4694927
Updated submodules
Peguen Apr 3, 2024
388f5bc
Checked out versions of thirdparty modules equal to master branch.
Peguen Apr 3, 2024
9303795
Implemented termination, when wrong values are assigned to custom dat…
Peguen Apr 3, 2024
848c572
Changed g_ecal_config() return value (PathWarning)
Peguen Apr 3, 2024
2370814
Added basic configuration tests.
Peguen Apr 3, 2024
e20d510
Added ECAL_API macro for config calls.
Peguen Apr 3, 2024
7cafa3e
Added operator overloading of == for LimitSize(LS), LS == int, LS == …
Peguen Apr 4, 2024
a6936d1
Fixed warnings because of implicit types conversions by implementing …
Peguen Apr 4, 2024
ca428d1
Created deathtests and more type tests for configuration tests.
Peguen Apr 4, 2024
5a5fe2c
Merge branch 'master' into feature/user_config_implementation
Peguen Apr 4, 2024
0370d47
Removed GetDefaultConfig().
Peguen Apr 4, 2024
ae7e608
Setting new_initialization to true in ecal_globals when ecal_config g…
Peguen Apr 5, 2024
6530bec
Removed const from custom_data_types as recommended.
Peguen Apr 5, 2024
3f95473
Review 1: Moved GetCurrentConfig to config.h.
Peguen Apr 8, 2024
a435621
Changed defines to constexpr in ecal_dev_ini.h
Peguen Mar 27, 2024
832c811
Changed defines to constexpr in ecal_def, ecal_def_ini + added uint a…
Peguen Apr 8, 2024
673a4b0
Merge remote-tracking branch 'origin/master' into feature/defines_to_…
Peguen Apr 8, 2024
ca14568
Merge branch 'feature/defines_to_constexpr' into feature/user_config_…
Peguen Apr 8, 2024
e05f398
Removed ecal_internal_options.h.
Peguen Apr 8, 2024
a8da1ce
Introduced logging options.
Peguen Apr 8, 2024
2dc3cbc
Renamed ProcessOptions to StartupOptions.
Peguen Apr 8, 2024
b2af134
Renamed ProcessOptions to StartupOptions in application_options.h.
Peguen Apr 9, 2024
71cc7e5
Adapted IpAddressV4 to exclude some addresses. Added test cases.
Peguen Apr 9, 2024
3c7b05d
Reverted changes to ecal.cpp and ecal_globals.cpp.
Peguen Apr 9, 2024
3db1f9d
ecal_config as reference, not pointer.
Peguen Apr 9, 2024
f3bbc96
Review 1: Config not as ptr. Optimized handling. Clangtidy happiness.
Peguen Apr 10, 2024
c19c4ff
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen Apr 11, 2024
e0a1656
Changed constexpr in ecal_config_initializer.cpp
Peguen Apr 11, 2024
063b484
Added some clang tidy improvements (e.g. usage of const)
Peguen Apr 11, 2024
ceb4419
Added operator int() to LimitSize.
Peguen Apr 11, 2024
3a811a4
Added operator std::string() to IpV4Address.
Peguen Apr 11, 2024
4893564
Added default constructors to custom types classes.
Peguen Apr 11, 2024
32dfc18
... also for Limitsize.
Peguen Apr 11, 2024
9395da5
Added config example.
Peguen Apr 11, 2024
482ae05
CGlobals initializing in global space.
Peguen Apr 11, 2024
284f873
Adapted config sample.
Peguen Apr 11, 2024
a18e9de
config_test.cpp const happiness for clangtidy.
Peguen Apr 11, 2024
8da505e
Added timesync_module_replay to config and removed eCALPar from timeg…
Peguen Apr 12, 2024
2e8b9d4
Made github-actions bot a bit happier.
Peguen Apr 12, 2024
e7a9642
IpAddressV4 operator= improvement.
Peguen Apr 15, 2024
ddbbc99
Removed some PG TODOS.
Peguen Apr 15, 2024
10a3835
Started with documentation adaptions for config.
Peguen Apr 16, 2024
d19e55e
Updated docu for config with types.
Peguen Apr 17, 2024
733d4c6
TODO comment.
Peguen Apr 17, 2024
a7072fc
Small update to config doc.
Peguen Apr 17, 2024
c946cc6
Small update to config example.
Peguen Apr 17, 2024
19512cf
Small update to config example._2
Peguen Apr 17, 2024
8df8937
Renamed LimitSize to ConstrainedInteger.
Peguen Apr 17, 2024
4e049db
Changed behaviour of custom types: throwing invalid_argument exceptio…
Peguen Apr 18, 2024
0667980
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen Apr 18, 2024
0511bed
Reverted Config Getters to previous integration.
Peguen Apr 18, 2024
da0a991
Added user_args to config file.
Peguen Apr 24, 2024
543949e
Refactored ecal Initialize with the config handling.
Peguen Apr 26, 2024
eb1a4ee
Throw exception for ecal registration options.
Peguen Apr 26, 2024
a362f26
Refactored ecal_registration_options.
Peguen Apr 26, 2024
521d70b
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen Apr 26, 2024
ba0a6c1
cmd parser: path sep renaming.
Peguen Apr 26, 2024
51308c0
Cmd parser: throw error message, when cmd line ini file was not found.
Peguen Apr 26, 2024
aca5d69
Changed ini handling for config file.
Peguen Apr 26, 2024
557637a
Updated docu for config and example.
Peguen Apr 26, 2024
d910ef2
give user the freedom to initialize with specified ini file.
Peguen Apr 26, 2024
676facf
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 13, 2024
5476f04
Some whitespaces.
Peguen May 15, 2024
1435ee8
Added RegistrationOptions test.
Peguen May 15, 2024
602212f
Changed ini file handling for cmd parser -> return complete path in e…
Peguen May 16, 2024
0dc7398
Added cmd parser ini test and death test.
Peguen May 16, 2024
e454368
Added cmd parser config key test + store config keys in map.
Peguen May 16, 2024
d72adbc
Removed generated ini file in test after usage.
Peguen May 16, 2024
82d8d11
Added config keys map to user cli arguments and provided the struct t…
Peguen May 16, 2024
b7e0bed
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 16, 2024
287c24f
Clean up code and make clangtidy happy.
Peguen May 17, 2024
e3bb375
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 17, 2024
ac9dbe9
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 17, 2024
fed863b
Refactored to current publisher options. TimeoutAcknowledge test not …
Peguen May 17, 2024
31b0c6e
Make clang tidy a bit more happy.
Peguen May 21, 2024
295f998
Enable shm for pubsub acknowledge test.
Peguen May 21, 2024
915a7f7
Included ecal_subscriber_config
Peguen May 21, 2024
a2aca3e
Renamend Configuration member.
Peguen May 21, 2024
cf2148c
Moved config to globalgalactic space. Implemented default config cons…
Peguen May 21, 2024
80ef2a0
Restructure eCAL Application Options and default init for publisher/s…
Peguen May 22, 2024
cafb419
Use custom types in publisher config.
Peguen May 22, 2024
25116ea
Restructered config file structure, config namespaces and and file na…
Peguen May 22, 2024
f7b8470
Added comments to config structs from ini file.
Peguen May 22, 2024
f6f3dd5
Some file renaming.
Peguen May 23, 2024
913fee0
Updated docu for config.
Peguen May 23, 2024
fd80bad
Changes for transportlayer config.
Peguen May 24, 2024
e126b12
Try taking .ini file in normal initializing, as it was before.
Peguen May 24, 2024
f876c26
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 24, 2024
25dd3e0
Added doc for publisher config.
Peguen May 24, 2024
7be0dd9
Defaulted publisher test again.
Peguen May 24, 2024
aa1d1ca
Removed unncessary constructor/destructor in custom config classes.
Peguen May 27, 2024
db16ff6
Some ecal_cmd_parser cleanup.
Peguen May 27, 2024
9613db0
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen May 27, 2024
11044f1
Fix ecal_cmd_parser checkForValidConfigFilePath function.
Peguen May 28, 2024
a9a4a41
Fixed ecal_cmd_parser problem with path separator attachments.
Peguen May 29, 2024
d1c606d
Merge remote-tracking branch 'origin/master' into feature/user_config…
Peguen Jun 4, 2024
23ac095
Changed handling of cli arguments to std::vector<string> by default.
Peguen Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changed handling of cli arguments to std::vector<string> by default.
Peguen committed Jun 4, 2024
commit 23ac09564c14b82ac9296be0aa663c9bc50997c1
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/config/configuration.h
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ namespace eCAL

ECAL_API Configuration();
ECAL_API Configuration(int argc_ , char **argv_);
ECAL_API Configuration(std::vector<std::string> args_);
ECAL_API Configuration(std::vector<std::string>& args_);

ECAL_API void InitConfigWithDefaultIni();
ECAL_API void InitConfig(std::string ini_path_ = std::string(""));
@@ -75,6 +75,6 @@ namespace eCAL
std::string ecal_ini_file_path{};

private:
ECAL_API void Init(int argc_ , char **argv_);
ECAL_API void Init(std::vector<std::string>& args_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'eCAL::Configuration::Init' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]

          ECAL_API void Init(std::vector<std::string>& args_);
                        ^
Additional context

ecal/core/src/config/ecal_config_initializer.cpp:238: the definition seen here

    void Configuration::Init(std::vector<std::string>& arguments_)
                        ^

ecal/core/include/ecal/config/configuration.h:77: differing parameters are named here: ('args_'), in definition: ('arguments_')

          ECAL_API void Init(std::vector<std::string>& args_);
                        ^

};
}
15 changes: 6 additions & 9 deletions ecal/core/src/config/ecal_cmd_parser.cpp
Original file line number Diff line number Diff line change
@@ -193,16 +193,16 @@ namespace eCAL
: m_dump_config{false}
{}

CmdParser::CmdParser(int argc_ , char **argv_)
CmdParser::CmdParser(std::vector<std::string>& arguments_)
: CmdParser()
{
parseArguments(argc_, argv_);
parseArguments(arguments_);
}

void CmdParser::parseArguments(int argc_, char **argv_)
void CmdParser::parseArguments(std::vector<std::string>& arguments_)
{
#if ECAL_CORE_COMMAND_LINE
if ((argc_ > 0) && (argv_ != nullptr))
if (!arguments_.empty())
{
// define command line object
TCLAP::CmdLine cmd("", ' ', ECAL_VERSION);
@@ -224,7 +224,7 @@ namespace eCAL
cmd.setOutput(&advanced_tclap_output);

// parse command line
cmd.parse(argc_, argv_);
cmd.parse(arguments_);

// set globals
if (dump_config_arg.isSet())
@@ -242,10 +242,7 @@ namespace eCAL
}
}
#endif
if (argv_ != nullptr)
{
for (size_t i = 0; i < static_cast<size_t>(argc_); ++i) if (argv_[i] != nullptr) m_task_parameter.emplace_back(argv_[i]);
}
m_task_parameter = arguments_;
}

bool CmdParser::getDumpConfig() const { return m_dump_config; };
4 changes: 2 additions & 2 deletions ecal/core/src/config/ecal_cmd_parser.h
Original file line number Diff line number Diff line change
@@ -44,10 +44,10 @@ namespace eCAL
class CmdParser
{
public:
CmdParser(int argc_ , char **argv_);
CmdParser(std::vector<std::string>& arguments_);
CmdParser();

void parseArguments(int argc_, char **argv_);
void parseArguments(std::vector<std::string>& arguments_);

bool getDumpConfig() const;
std::vector<std::string>& getConfigKeys();
23 changes: 13 additions & 10 deletions ecal/core/src/config/ecal_config_initializer.cpp
Original file line number Diff line number Diff line change
@@ -221,21 +221,24 @@ namespace eCAL

Configuration::Configuration(int argc_ , char **argv_)
{
Init(argc_, argv_);
std::vector<std::string> arguments;
if (argc_ > 0 && argv_ != nullptr)
{
for (size_t i = 0; i < static_cast<size_t>(argc_); ++i)
if (argv_[i] != nullptr)
arguments.emplace_back(argv_[i]);
}
Init(arguments);
}

Configuration::Configuration(std::vector<std::string> args_)
{
args_.emplace(args_.begin(), eCAL::Process::GetProcessName());
std::vector<const char*> argv(args_.size());
std::transform(args_.begin(), args_.end(), argv.begin(), [](std::string& s) {return s.c_str();});

Init(static_cast<int>(argv.size()), const_cast<char**>(argv.data()));
Configuration::Configuration(std::vector<std::string>& args_)
{
Init(args_);
}

void Configuration::Init(int argc_ , char **argv_)
void Configuration::Init(std::vector<std::string>& arguments_)
{
Config::CmdParser parser(argc_, argv_);
Config::CmdParser parser(arguments_);

command_line_arguments.config_keys = parser.getConfigKeys();
command_line_arguments.specified_config = parser.getUserIni();
20 changes: 8 additions & 12 deletions ecal/tests/cpp/config_test/src/config_test.cpp
Original file line number Diff line number Diff line change
@@ -237,7 +237,7 @@ TEST(core_cpp_config, config_cmd_parser)

eCAL::Config::CmdParser parser;

std::vector<const char*> arguments;
std::vector<std::string> arguments;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'arguments' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::vector<std::string> arguments;
std::vector<std::string> arguments = 0;


const std::string set_config_key = "--ecal-set-config-key ";
const std::string sep_slash = "/";
@@ -257,18 +257,14 @@ TEST(core_cpp_config, config_cmd_parser)

arguments.push_back("test_config_cmd_parser");
arguments.push_back("--ecal-ini-file customIni.ini");
std::string host_group_string = set_config_key + network + sep_slash + host_group_name + sep_col + config_test_machine;
arguments.push_back(host_group_string.data());
std::string network_enabled_string = set_config_key + network + sep_slash + network_enabled + sep_col + is_network_enabled;
arguments.push_back(network_enabled_string.data());
std::string registration_to_string = set_config_key + common + sep_slash + registration_timeout + sep_col + reg_to_value;
arguments.push_back(registration_to_string.data());
std::string registration_rf_string = set_config_key + common + sep_slash + registration_refresh + sep_col + reg_rf_value;
arguments.push_back(registration_rf_string.data());
arguments.push_back(set_config_key + network + sep_slash + host_group_name + sep_col + config_test_machine);
arguments.push_back(set_config_key + network + sep_slash + network_enabled + sep_col + is_network_enabled);
arguments.push_back(set_config_key + common + sep_slash + registration_timeout + sep_col + reg_to_value);
arguments.push_back(set_config_key + common + sep_slash + registration_refresh + sep_col + reg_rf_value);

try
{
parser.parseArguments(static_cast<int>(arguments.size()), const_cast<char**>(arguments.data()));
parser.parseArguments(arguments);
}
catch(const std::runtime_error& e)
{
@@ -291,13 +287,13 @@ TEST(CmdParserDeathTest, config_cmd_parser_death_test)
{
eCAL::Config::CmdParser parser;

std::vector<const char*> arguments;
std::vector<std::string> arguments;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'arguments' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::vector<std::string> arguments;
std::vector<std::string> arguments = 0;


arguments.push_back("test_config_cmd_parser_death_test");
arguments.push_back("--ecal-ini-file someNotValidFileName.ini");

ASSERT_THROW(
parser.parseArguments(static_cast<int>(arguments.size()), const_cast<char**>(arguments.data())),
parser.parseArguments(arguments),
std::runtime_error
);
}