Skip to content

Commit

Permalink
Reworked ecal core API for version 6 release. Several public API func…
Browse files Browse the repository at this point in the history
…tions has been removed or modified.
  • Loading branch information
hannemn committed Dec 5, 2024
1 parent b6b66b2 commit 9e0909c
Show file tree
Hide file tree
Showing 136 changed files with 319 additions and 519 deletions.
2 changes: 1 addition & 1 deletion app/mon/mon_cli/src/ecal_mon_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ int main(int argc, char** argv)
}

// initialize eCAL API
eCAL::Initialize(0, nullptr, "eCALMon CLI", eCAL::Init::All);
eCAL::Initialize("eCALMon CLI", eCAL::Init::All);

// set process state
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
Expand Down
2 changes: 1 addition & 1 deletion app/mon/mon_gui/src/ecalmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Ecalmon::Ecalmon(QWidget *parent)
, monitor_error_counter_(0)
{
// Just make sure that eCAL is initialized
eCAL::Initialize(0, nullptr, "eCALMon", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Initialize("eCALMon", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Monitoring::SetFilterState(false);
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");

Expand Down
2 changes: 1 addition & 1 deletion app/mon/mon_gui/src/widgets/about_dialog/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget *parent)
ui_.version_label->setText("Version: " + QString(EcalmonGlobals::VERSION_STRING));
ui_.ecalversion_label->setText("eCAL " + QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");

ui_.ecal_runtime_version_string_label->setText(QString(eCAL::GetVersionString()) + " (" + QString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_runtime_version_string_label->setText(QString::fromStdString(eCAL::GetVersionString()) + " (" + QString::fromStdString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_compiletime_versin_string_label->setText(QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");
ui_.qt_runtime_version_string_label->setText(QString(qVersion()));
ui_.qt_compiletime_version_string_label->setText(QString(QT_VERSION_STR));
Expand Down
2 changes: 1 addition & 1 deletion app/mon/mon_tui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(int argc, char** argv)
{
auto args = ParseArgs(argc, argv);

auto status = eCAL::Initialize(0, nullptr, "eCALMon TUI", eCAL::Init::Default | eCAL::Init::Monitoring);
auto status = eCAL::Initialize("eCALMon TUI", eCAL::Init::Default | eCAL::Init::Monitoring);
if (status == -1) std::cerr << "Failed to init" << std::endl;
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
eCAL::Monitoring::SetFilterState(false);
Expand Down
2 changes: 1 addition & 1 deletion app/play/play_core/src/ecal_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ EcalPlay::EcalPlay()
{
LogAppNameVersion();

eCAL::Initialize(0, nullptr, "eCALPlay");
eCAL::Initialize("eCALPlay");

play_thread_ = std::make_unique<PlayThread>();
play_thread_->Start();
Expand Down
2 changes: 1 addition & 1 deletion app/play/play_gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int main(int argc, char *argv[])
//////////////////////////////////////////////////////////////////////////////

// Just make sure that eCAL is initialized
eCAL::Initialize(0, nullptr, "eCALPlayGUI", eCAL::Init::Default | eCAL::Init::Publisher | eCAL::Init::Service | eCAL::Init::Monitoring);
eCAL::Initialize("eCALPlayGUI", eCAL::Init::Default | eCAL::Init::Publisher | eCAL::Init::Service | eCAL::Init::Monitoring);

// For linux big measurements require more file descriptors than the default value
#ifdef ECAL_OS_LINUX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget *parent)
ui_.version_label->setText("Version: " + QString(EcalPlayGlobals::VERSION_STRING));
ui_.ecalversion_label->setText("eCAL " + QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");

ui_.ecal_runtime_version_string_label->setText(QString(eCAL::GetVersionString()) + " (" + QString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_runtime_version_string_label->setText(QString::fromStdString(eCAL::GetVersionString()) + " (" + QString::fromStdString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_compiletime_versin_string_label->setText(QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");
ui_.qt_runtime_version_string_label->setText(QString(qVersion()));
ui_.qt_compiletime_version_string_label->setText(QString(QT_VERSION_STR));
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_client_core/src/ecal_rec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace eCAL

EcalRec::EcalRec()
{
eCAL::Initialize(0, nullptr, "eCALRecClient", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Initialize("eCALRecClient", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Monitoring::SetFilterState(false);

recorder_ = std::make_unique<EcalRecImpl>();
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int main(int argc, char *argv[])
}

// Just make sure that eCAL is initialized
eCAL::Initialize(0, nullptr, "eCALRecGUI", eCAL::Init::Default | eCAL::Init::Service | eCAL::Init::Monitoring);
eCAL::Initialize("eCALRecGUI", eCAL::Init::Default | eCAL::Init::Service | eCAL::Init::Monitoring);
eCAL::Monitoring::SetFilterState(false);

EcalRecGui* w = new EcalRecGui();
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_gui/src/widgets/about_dialog/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget *parent)
ui_.version_label->setText("Version: " + QString(ECAL_REC_VERSION_STRING));
ui_.ecalversion_label->setText("eCAL " + QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");

ui_.ecal_runtime_version_string_label->setText(QString(eCAL::GetVersionString()) + " (" + QString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_runtime_version_string_label->setText(QString::fromStdString(eCAL::GetVersionString()) + " (" + QString::fromStdString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_compiletime_versin_string_label->setText(QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");
ui_.qt_runtime_version_string_label->setText(QString(qVersion()));
ui_.qt_compiletime_version_string_label->setText(QString(QT_VERSION_STR));
Expand Down
4 changes: 2 additions & 2 deletions app/rec/rec_server_cli/src/ecal_rec_server_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ int main(int argc, char** argv)
/************************************************************************/
if (remote_control_arg.isSet()) // Remote-control-mode
{
eCAL::Initialize(argc, argv, "eCALRec-Remote", eCAL::Init::All);
eCAL::Initialize("eCALRec-Remote", eCAL::Init::All);
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");

remote_rec_server_service = std::make_shared<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>();
}
else // Non-remote control mode
{
eCAL::Initialize(argc, argv, "eCALRec", eCAL::Init::All);
eCAL::Initialize("eCALRec", eCAL::Init::All);

rec_server_instance = std::make_shared<eCAL::rec_server::RecServer>();

Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_core/src/rec_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace eCAL
settings_.ClearHostFilter(); // There is no global host filter

// Initialize eCAL
eCAL::Initialize(0, nullptr, "", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Initialize("", eCAL::Init::Default | eCAL::Init::Monitoring);

// Start FTP Server
ftp_server_->start(5);
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_tests/rec_rpc_tests/src/external_ecal_rec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ExternalEcalRecInstance::ExternalEcalRecInstance(bool gui)
{
ecal_rec_cli_instance_lock.lock();

eCAL::Initialize({}, "Ecal Rec Tester");
eCAL::Initialize("Ecal Rec Tester");

remote_rec_server_service = std::make_shared<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>();
remote_rec_server_service->SetHostName(eCAL::Process::GetHostName());
Expand Down
4 changes: 2 additions & 2 deletions app/sys/sys_cli/src/ecalsys_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ int main(int argc, char** argv)
/************************************************************************/
if (remote_control_arg.isSet()) // Remote-control-mode
{
eCAL::Initialize(0, nullptr, "eCALSys-Remote", eCAL::Init::All);
eCAL::Initialize("eCALSys-Remote", eCAL::Init::All);
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");

remote_ecalsys_service = std::make_shared<eCAL::protobuf::CServiceClient<eCAL::pb::sys::Service>>();
}
else // Non-remote control mode
{
eCAL::Initialize(0, nullptr, "eCALSys", eCAL::Init::All);
eCAL::Initialize("eCALSys", eCAL::Init::All);
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");

ecalsys_instance = std::make_shared<EcalSys>();
Expand Down
2 changes: 1 addition & 1 deletion app/sys/sys_client_cli/src/ecal_sys_client_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int main(int argc, char** argv)
logger->info("eCAL Sys Client was started with " + accept_security_risk_arg.longID() + ". Not displaying security warning.");
}

eCAL::Initialize(argc, argv, "eCALSysClient", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Initialize("eCALSysClient", eCAL::Init::Default | eCAL::Init::Monitoring);

// Print System information
std::string config_string;
Expand Down
2 changes: 1 addition & 1 deletion app/sys/sys_gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int main(int argc, char *argv[])
//////////////////////////////////////////////////////////////////////////////

// Just make sure that eCAL is initialized
eCAL::Initialize(argc, argv, "eCALSysGUI", eCAL::Init::All);
eCAL::Initialize("eCALSysGUI", eCAL::Init::All);

//////////////////////////////////////
// --config
Expand Down
2 changes: 1 addition & 1 deletion app/sys/sys_gui/src/widgets/about_dialog/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget *parent)
ui_.version_label->setText("Version: " + QString(ECAL_SYS_VERSION_STRING));
ui_.ecalversion_label->setText("eCAL " + QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");

ui_.ecal_runtime_version_string_label->setText(QString(eCAL::GetVersionString()) + " (" + QString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_runtime_version_string_label->setText(QString::fromStdString(eCAL::GetVersionString()) + " (" + QString::fromStdString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_compiletime_versin_string_label->setText(QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");
ui_.qt_runtime_version_string_label->setText(QString(qVersion()));
ui_.qt_compiletime_version_string_label->setText(QString(QT_VERSION_STR));
Expand Down
4 changes: 2 additions & 2 deletions app/util/config/src/ecal_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

#include <ecal/ecal.h>

int main(int argc, char** argv)
int main()
{
// initialize eCAL API
eCAL::Initialize(argc, argv, "eCALConfig");
eCAL::Initialize("eCALConfig");

// print config
eCAL::Process::DumpConfig();
Expand Down
2 changes: 1 addition & 1 deletion app/util/launcher/src/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent)
ui_.version_label->setText("Version: " + QString("2.3.0"));
ui_.ecalversion_label->setText("eCAL " + QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");

ui_.ecal_runtime_version_string_label->setText(QString(eCAL::GetVersionString()) + " (" + QString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_runtime_version_string_label->setText(QString::fromStdString(eCAL::GetVersionString()) + " (" + QString::fromStdString(eCAL::GetVersionDateString()) + ")");
ui_.ecal_compiletime_versin_string_label->setText(QString(ECAL_VERSION) + " (" + QString(ECAL_DATE) + ")");
ui_.qt_runtime_version_string_label->setText(QString(qVersion()));
ui_.qt_compiletime_version_string_label->setText(QString(QT_VERSION_STR));
Expand Down
4 changes: 2 additions & 2 deletions app/util/stop/src/ecal_stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

#include <ecal/ecal.h>

int main(int argc, char** argv)
int main()
{
// initialize eCAL API
eCAL::Initialize(argc, argv, "eCALStop", eCAL::Init::All);
eCAL::Initialize("eCALStop", eCAL::Init::All);

// set process state
eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running");
Expand Down
2 changes: 1 addition & 1 deletion contrib/ecaltime/simtime/src/ecal_time_simtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool eCAL::CSimTime::initialize()
{
std::unique_lock<std::mutex> lk(initialize_mutex);
if (!is_initialized) {
//eCAL::Initialize(0, NULL, "ecal_sim_time_listener", eCAL::Init::Subscriber);
//eCAL::Initialize("ecal_sim_time_listener", eCAL::Init::Subscriber);
// this has to be done by the parent process
// needs to be fixed with an improved reference counting
// in eCAL::Initialize ..
Expand Down
2 changes: 1 addition & 1 deletion contrib/mma/src/mma_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int main(int argc, char** argv)
std::cout << app_version_header << std::endl << ecal_version_header << std::endl << std::endl;

// initialize eCAL API
if (eCAL::Initialize(0, nullptr, MMA_APPLICATION_NAME, eCAL::Init::Publisher) < 0)
if (eCAL::Initialize(MMA_APPLICATION_NAME, eCAL::Init::Publisher) < 0)
{
std::cout << "eCAL initialization failed !";
return 1;
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/configuration/src/publisher_config/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
int main(int argc, char** argv)
{
// initialize eCAL API
eCAL::Initialize(0, nullptr, "PublisherConfig", eCAL::Init::All);
eCAL::Initialize("PublisherConfig", eCAL::Init::All);

// create publisher config
eCAL::Publisher::Configuration pub_config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void HelloWorldCallback(const std::string& message)
int main(int argc, char** argv)
{
// Initialize eCAL
eCAL::Initialize(argc, argv, "Hello World Subscriber");
eCAL::Initialize("Hello World Subscriber");

// Create a subscriber that listenes on the "hello_world_topic"
eCAL::string::CSubscriber<std::string> subscriber("hello_world_topic");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
int main(int argc, char** argv)
{
// Initialize eCAL. The name of our Process will be "Hello World Publisher"
eCAL::Initialize(argc, argv, "Hello World Publisher");
eCAL::Initialize("Hello World Publisher");

// Create a String Publisher that publishes on the topic "hello_world_topic"
eCAL::string::CPublisher<std::string> publisher("hello_world_topic");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void HelloWorldCallback(const proto_messages::HelloWorld& hello_world_msg)
int main(int argc, char** argv)
{
// Initialize eCAL and create a protobuf subscriber
eCAL::Initialize(argc, argv, "Hello World Protobuf Subscriber");
eCAL::Initialize("Hello World Protobuf Subscriber");
eCAL::protobuf::CSubscriber<proto_messages::HelloWorld> subscriber("hello_world_protobuf");

// Set the Callback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
int main(int argc, char** argv)
{
// Initialize eCAL and create a protobuf publisher
eCAL::Initialize(argc, argv, "Hello World Protobuf Publisher");
eCAL::Initialize("Hello World Protobuf Publisher");
eCAL::protobuf::CPublisher<proto_messages::HelloWorld> publisher("hello_world_protobuf");

// Ask the user to input his name
Expand Down
1 change: 0 additions & 1 deletion ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ endif()
######################################
set(ecal_config_src
src/config/default_configuration.cpp
src/config/ecal_cmd_parser.cpp
src/config/ecal_config.cpp
src/config/ecal_config_initializer.cpp
src/config/transport_layer.cpp
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/cimpl/ecal_core_cimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C"
*
* @return Zero if succeeded.
**/
ECALC_API int eCAL_GetVersion(int* major_, int* minor_, int* patch_);
ECALC_API eCAL_SVersion eCAL_GetVersion();

/**
* @brief Initialize eCAL API.
Expand All @@ -69,7 +69,7 @@ extern "C"
*
* @return Zero if succeeded, 1 if already initialized, -1 if failed.
**/
ECALC_API int eCAL_Initialize(int argc_, char **argv_, const char *unit_name_, unsigned int components_);
ECALC_API int eCAL_Initialize(const char *unit_name_, unsigned int components_);

/**
* @brief Set/change the unit name of current module.
Expand Down
2 changes: 0 additions & 2 deletions ecal/core/include/ecal/config/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ namespace eCAL
Cli::Configuration command_line_arguments;

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

ECAL_API void InitFromConfig();
ECAL_API void InitFromFile(const std::string& yaml_path_);
Expand Down
47 changes: 19 additions & 28 deletions ecal/core/include/ecal/ecal_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,48 +40,31 @@ namespace eCAL
*
* @return Full eCAL version string.
**/
ECAL_API const char* GetVersionString();
ECAL_API std::string GetVersionString();

/**
* @brief Get eCAL version date.
*
* @return Full eCAL version date string.
**/
ECAL_API const char* GetVersionDateString();
ECAL_API std::string GetVersionDateString();

/**
* @brief Get eCAL version as separated integer values.
* @brief Get eCAL version as separated integer values.
*
* @param [out] major_ The eCAL major version number.
* @param [out] minor_ The eCAL minor version number.
* @param [out] patch_ The eCAL patch version number.
*
* @return Zero if succeeded.
* @return struct SVersion that contains major, minor and patch value.
**/
ECAL_API int GetVersion(int* major_, int* minor_, int* patch_);
ECAL_API SVersion GetVersion();

/**
* @brief Initialize eCAL API.
*
* @param argc_ Number of command line arguments.
* @param argv_ Array of command line arguments.
* @param unit_name_ Defines the name of the eCAL unit.
* @param components_ Defines which component to initialize.
*
* @return Zero if succeeded, 1 if already initialized, -1 if failed.
**/
ECAL_API int Initialize(int argc_ = 0, char **argv_ = nullptr, const char *unit_name_ = nullptr, unsigned int components_ = Init::Default);

/**
* @brief Initialize eCAL API.
*
* @param args_ Vector of config arguments to overwrite (["arg1", "value1", "arg2", "arg3", "value3" ..]).
* @param unit_name_ Defines the name of the eCAL unit.
* @param components_ Defines which component to initialize.
*
* @return Zero if succeeded, 1 if already initialized, -1 if failed.
**/
ECAL_API int Initialize(std::vector<std::string> args_, const char *unit_name_ = nullptr, unsigned int components_ = Init::Default);
ECAL_API int Initialize(const std::string& unit_name_ = "", unsigned int components_ = Init::Default);

/**
* @brief Initialize eCAL API.
Expand All @@ -92,7 +75,7 @@ namespace eCAL
*
* @return Zero if succeeded, 1 if already initialized, -1 if failed.
**/
ECAL_API int Initialize(eCAL::Configuration& config_, const char *unit_name_ = nullptr, unsigned int components_ = Init::Default);
ECAL_API int Initialize(eCAL::Configuration& config_, const std::string& unit_name_ = "", unsigned int components_ = Init::Default);

/**
* @brief Finalize eCAL API.
Expand All @@ -104,11 +87,19 @@ namespace eCAL
/**
* @brief Check eCAL initialize state.
*
* @param component_ Check specific component or 0 for general state of eCAL core.
*
* @return 1 if eCAL is initialized.
**/
ECAL_API int IsInitialized(unsigned int component_ = 0);
ECAL_API int IsInitialized();

/**
* @brief Check initialization state for a specific component.
*
* @param component_ Specific component to check
*
* @return 1 if eCAL component is initialized.
**/
ECAL_API int IsInitialized(unsigned int component_);


/**
* @brief Set/change the unit name of current module.
Expand All @@ -117,7 +108,7 @@ namespace eCAL
*
* @return Zero if succeeded.
**/
ECAL_API int SetUnitName(const char *unit_name_);
ECAL_API int SetUnitName(const std::string& unit_name_);

/**
* @brief Return the eCAL process state.
Expand Down
Loading

0 comments on commit 9e0909c

Please sign in to comment.