diff --git a/src/core/src/config/ecal_config.cpp b/src/core/src/config/ecal_config.cpp index a9343bc..ffb4543 100644 --- a/src/core/src/config/ecal_config.cpp +++ b/src/core/src/config/ecal_config.cpp @@ -17,13 +17,10 @@ * ========================= eCAL LICENSE ================================= */ -#include #include -#include #include #include -#include "ecal_config_reader.h" #include "ecal_config_reader_hlp.h" #include "ecal_def.h" diff --git a/src/core/src/config/ecal_config_reader.cpp b/src/core/src/config/ecal_config_reader.cpp index e599098..0ce43c6 100644 --- a/src/core/src/config/ecal_config_reader.cpp +++ b/src/core/src/config/ecal_config_reader.cpp @@ -22,7 +22,6 @@ **/ #include -#include #include #include "ecal_def.h" diff --git a/src/core/src/ecal.cpp b/src/core/src/ecal.cpp index 5309654..8c12caf 100644 --- a/src/core/src/ecal.cpp +++ b/src/core/src/ecal.cpp @@ -24,7 +24,6 @@ #include "ecal_def.h" #include "ecal_event.h" #include "ecal_globals.h" -#include #include #include diff --git a/src/core/src/ecal_descgate.cpp b/src/core/src/ecal_descgate.cpp index 7059444..8e26fec 100644 --- a/src/core/src/ecal_descgate.cpp +++ b/src/core/src/ecal_descgate.cpp @@ -26,7 +26,6 @@ #include "ecal_descgate.h" #include -#include #include #include #include diff --git a/src/core/src/ecal_descgate.h b/src/core/src/ecal_descgate.h index 59c0530..28cd615 100644 --- a/src/core/src/ecal_descgate.h +++ b/src/core/src/ecal_descgate.h @@ -68,7 +68,7 @@ namespace eCAL bool ApplyTopicDescription(const std::string& topic_name_, const SDataTypeInformation& topic_info_, - const QualityFlags description_quality_); + QualityFlags description_quality_); void GetTopics(std::unordered_map& topic_info_map_); void GetTopicNames(std::vector& topic_names_); @@ -78,7 +78,7 @@ namespace eCAL const std::string& method_name_, const SDataTypeInformation& request_type_information_, const SDataTypeInformation& response_type_information_, - const QualityFlags description_quality_); + QualityFlags description_quality_); void GetServices(std::map, SServiceMethodInformation>& service_info_map_); void GetServiceNames(std::vector>& service_method_names_); diff --git a/src/core/src/ecalc.cpp b/src/core/src/ecalc.cpp index ec3080a..f7edce1 100644 --- a/src/core/src/ecalc.cpp +++ b/src/core/src/ecalc.cpp @@ -21,7 +21,6 @@ * @brief Implementation of the eCAL dll interface **/ -#include #include #include #include @@ -344,7 +343,7 @@ static std::recursive_mutex g_pub_callback_mtx; static void g_pub_event_callback(const char* topic_name_, const struct eCAL::SPubEventCallbackData* data_, const PubEventCallbackCT callback_, void* par_) { const std::lock_guard lock(g_pub_callback_mtx); - SPubEventCallbackDataC data; + SPubEventCallbackDataC data{}; data.type = data_->type; data.time = data_->time; data.clock = data_->clock; @@ -442,8 +441,8 @@ extern "C" ECALC_API int eCAL_Pub_AddEventCallback(ECAL_HANDLE handle_, eCAL_Publisher_Event type_, PubEventCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CPublisher* pub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* pub = static_cast(handle_); auto callback = std::bind(g_pub_event_callback, std::placeholders::_1, std::placeholders::_2, callback_, par_); if (pub->AddEventCallback(type_, callback)) return(1); return(0); @@ -451,8 +450,8 @@ extern "C" ECALC_API int eCAL_Pub_RemEventCallback(ECAL_HANDLE handle_, eCAL_Publisher_Event type_) { - if (handle_ == NULL) return(0); - eCAL::CPublisher* pub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* pub = static_cast(handle_); if (pub->RemEventCallback(type_)) return(1); return(0); } @@ -491,7 +490,7 @@ static void g_sub_receive_callback(const char* topic_name_, const struct eCAL::S static void g_sub_event_callback(const char* topic_name_, const struct eCAL::SSubEventCallbackData* data_, const SubEventCallbackCT callback_, void* par_) { const std::lock_guard lock(g_sub_callback_mtx); - SSubEventCallbackDataC data; + SSubEventCallbackDataC data{}; data.type = data_->type; data.time = data_->time; data.clock = data_->clock; @@ -631,8 +630,8 @@ extern "C" ECALC_API int eCAL_Sub_AddEventCallback(ECAL_HANDLE handle_, eCAL_Subscriber_Event type_, SubEventCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CSubscriber* sub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* sub = static_cast(handle_); auto callback = std::bind(g_sub_event_callback, std::placeholders::_1, std::placeholders::_2, callback_, par_); if (sub->AddEventCallback(type_, callback)) return(1); return(0); @@ -640,16 +639,16 @@ extern "C" ECALC_API int eCAL_Sub_RemEventCallback(ECAL_HANDLE handle_, eCAL_Subscriber_Event type_) { - if (handle_ == NULL) return(0); - eCAL::CSubscriber* sub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* sub = static_cast(handle_); if (sub->RemEventCallback(type_)) return(1); return(0); } ECALC_API int eCAL_Sub_GetTypeName(ECAL_HANDLE handle_, void* buf_, int buf_len_) { - if (handle_ == NULL) return(0); - eCAL::CSubscriber* sub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* sub = static_cast(handle_); const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name); if (buffer_len != static_cast(datatype_info.name.size())) @@ -664,8 +663,8 @@ extern "C" ECALC_API int eCAL_Sub_GetEncoding(ECAL_HANDLE handle_, void* buf_, int buf_len_) { - if (handle_ == NULL) return(0); - eCAL::CSubscriber* sub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* sub = static_cast(handle_); const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding); if (buffer_len != static_cast(datatype_info.encoding.size())) @@ -680,8 +679,8 @@ extern "C" ECALC_API int eCAL_Sub_GetDescription(ECAL_HANDLE handle_, void* buf_, int buf_len_) { - if (handle_ == NULL) return(0); - eCAL::CSubscriber* sub = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* sub = static_cast(handle_); const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation(); int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor); if (buffer_len != static_cast(datatype_info.descriptor.size())) @@ -785,23 +784,22 @@ extern "C" { ECALC_API ECAL_HANDLE eCAL_Timer_Create() { - eCAL::CTimer* timer = new eCAL::CTimer; + auto* timer = new eCAL::CTimer; return(timer); } ECALC_API int eCAL_Timer_Destroy(ECAL_HANDLE handle_) { - if (handle_ == NULL) return(0); - eCAL::CTimer* timer = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* timer = static_cast(handle_); delete timer; - timer = NULL; return(1); } ECALC_API int eCAL_Timer_Start(ECAL_HANDLE handle_, int timeout_, TimerCallbackCT callback_, int delay_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CTimer* timer = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* timer = static_cast(handle_); auto callback = std::bind(g_timer_callback, callback_, par_); if (timer->Start(timeout_, callback, delay_)) return(1); else return(0); @@ -809,8 +807,8 @@ extern "C" ECALC_API int eCAL_Timer_Stop(ECAL_HANDLE handle_) { - if (handle_ == NULL) return(0); - eCAL::CTimer* timer = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* timer = static_cast(handle_); if (timer->Stop()) return(1); else return(0); } @@ -840,7 +838,7 @@ extern "C" static void g_server_event_callback(const char* name_, const struct eCAL::SServerEventCallbackData* data_, const ServerEventCallbackCT callback_, void* par_) { const std::lock_guard lock(g_server_event_callback_mtx); - SServerEventCallbackDataC data; + SServerEventCallbackDataC data{}; data.time = data_->time; data.type = data_->type; callback_(name_, &data, par_); @@ -848,24 +846,23 @@ extern "C" ECALC_API ECAL_HANDLE eCAL_Server_Create(const char* service_name_) { - if (service_name_ == NULL) return(NULL); - eCAL::CServiceServer* server = new eCAL::CServiceServer(service_name_); + if (service_name_ == nullptr) return(nullptr); + auto* server = new eCAL::CServiceServer(service_name_); return(server); } ECALC_API int eCAL_Server_Destroy(ECAL_HANDLE handle_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); delete server; - server = NULL; return(1); } ECALC_API int eCAL_Server_AddMethodCallback(ECAL_HANDLE handle_, const char* method_, const char* req_type_, const char* resp_type_, MethodCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); auto callback = std::bind(g_method_callback, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, callback_, par_); return server->AddMethodCallback(method_, req_type_, resp_type_, callback); } @@ -877,8 +874,8 @@ extern "C" ECALC_API int eCAL_Server_RemMethodCallback(ECAL_HANDLE handle_, const char* method_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); return server->RemMethodCallback(method_); } @@ -889,8 +886,8 @@ extern "C" ECALC_API int eCAL_Server_AddEventCallback(ECAL_HANDLE handle_, eCAL_Server_Event type_, ServerEventCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); auto callback = std::bind(g_server_event_callback, std::placeholders::_1, std::placeholders::_2, callback_, par_); if (server->AddEventCallback(type_, callback)) return(1); return(0); @@ -898,16 +895,16 @@ extern "C" ECALC_API int eCAL_Server_RemEventCallback(ECAL_HANDLE handle_, eCAL_Server_Event type_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); if (server->RemEventCallback(type_)) return(1); return(0); } ECALC_API int eCAL_Server_GetServiceName(ECAL_HANDLE handle_, void* buf_, int buf_len_) { - if (handle_ == NULL) return(0); - eCAL::CServiceServer* server = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* server = static_cast(handle_); const std::string service_name = server->GetServiceName(); int buffer_len = CopyBuffer(buf_, buf_len_, service_name); if (buffer_len != static_cast(service_name.size())) @@ -930,7 +927,7 @@ extern "C" static void g_response_callback(const struct eCAL::SServiceResponse& service_response_, const ResponseCallbackCT callback_, void* par_) { const std::lock_guard lock(g_response_callback_mtx); - struct SServiceResponseC service_response; + struct SServiceResponseC service_response{}; service_response.host_name = service_response_.host_name.c_str(); service_response.service_name = service_response_.service_name.c_str(); service_response.service_id = service_response_.service_id.c_str(); @@ -947,7 +944,7 @@ extern "C" static void g_client_event_callback(const char* name_, const struct eCAL::SClientEventCallbackData* data_, const ClientEventCallbackCT callback_, void* par_) { const std::lock_guard lock(g_client_event_callback_mtx); - SClientEventCallbackDataC data; + SClientEventCallbackDataC data{}; data.time = data_->time; data.type = data_->type; callback_(name_, &data, par_); @@ -955,32 +952,31 @@ extern "C" ECALC_API ECAL_HANDLE eCAL_Client_Create(const char* service_name_) { - if (service_name_ == NULL) return(NULL); - eCAL::CServiceClient* client = new eCAL::CServiceClient(service_name_); + if (service_name_ == nullptr) return(nullptr); + auto* client = new eCAL::CServiceClient(service_name_); return(client); } ECALC_API int eCAL_Client_Destroy(ECAL_HANDLE handle_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); delete client; - client = NULL; return(1); } ECALC_API int eCAL_Client_SetHostName(ECAL_HANDLE handle_, const char* host_name_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); if (client->SetHostName(host_name_)) return(1); return(0); } ECALC_API int eCAL_Client_Call(ECAL_HANDLE handle_, const char* method_name_, const char* request_, int request_len_, int timeout_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); if (client->Call(method_name_, std::string(request_, static_cast(request_len_)), timeout_)) return(1); return(0); } @@ -988,21 +984,21 @@ extern "C" // The C API variant is not able to return all service repsonses but only the first one ! ECALC_API int eCAL_Client_Call_Wait(ECAL_HANDLE handle_, const char* method_name_, const char* request_, int request_len_, int timeout_, struct SServiceResponseC* service_response_, void* response_, int response_len_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); eCAL::ServiceResponseVecT service_response_vec; if (client->Call(method_name_, std::string(request_, static_cast(request_len_)), timeout_, &service_response_vec)) { - if (service_response_vec.size() > 0) + if (!service_response_vec.empty()) { - service_response_->host_name = NULL; - service_response_->service_name = NULL; - service_response_->service_id = NULL; - service_response_->method_name = NULL; - service_response_->error_msg = NULL; + service_response_->host_name = nullptr; + service_response_->service_name = nullptr; + service_response_->service_id = nullptr; + service_response_->method_name = nullptr; + service_response_->error_msg = nullptr; service_response_->ret_state = service_response_vec[0].ret_state; service_response_->call_state = service_response_vec[0].call_state; - service_response_->response = NULL; + service_response_->response = nullptr; service_response_->response_len = 0; return(CopyBuffer(response_, response_len_, service_response_vec[0].response)); } @@ -1013,16 +1009,16 @@ extern "C" ECALC_API int eCAL_Client_Call_Async(ECAL_HANDLE handle_, const char* method_name_, const char* request_, int request_len_, int timeout_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); if (client->CallAsync(method_name_, std::string(request_, static_cast(request_len_)), timeout_)) return(1); return(0); } int eCAL_Client_AddResponseCallback(ECAL_HANDLE handle_, ResponseCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); auto callback = std::bind(g_response_callback, std::placeholders::_1, callback_, par_); return client->AddResponseCallback(callback); } @@ -1035,15 +1031,15 @@ int eCAL_Client_AddResponseCallbackC(ECAL_HANDLE handle_, ResponseCallbackCT cal int eCAL_Client_RemResponseCallback(ECAL_HANDLE handle_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); return client->RemResponseCallback(); } ECALC_API int eCAL_Client_AddEventCallback(ECAL_HANDLE handle_, eCAL_Client_Event type_, ClientEventCallbackCT callback_, void* par_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); auto callback = std::bind(g_client_event_callback, std::placeholders::_1, std::placeholders::_2, callback_, par_); if (client->AddEventCallback(type_, callback)) return(1); return(0); @@ -1051,16 +1047,16 @@ ECALC_API int eCAL_Client_AddEventCallback(ECAL_HANDLE handle_, eCAL_Client_Even ECALC_API int eCAL_Client_RemEventCallback(ECAL_HANDLE handle_, eCAL_Client_Event type_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); if (client->RemEventCallback(type_)) return(1); return(0); } ECALC_API int eCAL_Client_GetServiceName(ECAL_HANDLE handle_, void* buf_, int buf_len_) { - if (handle_ == NULL) return(0); - eCAL::CServiceClient* client = static_cast(handle_); + if (handle_ == nullptr) return(0); + auto* client = static_cast(handle_); const std::string service_name = client->GetServiceName(); const int buffer_len = CopyBuffer(buf_, buf_len_, service_name); if (buffer_len != static_cast(service_name.size())) diff --git a/src/core/src/io/mtx/ecal_named_mutex.cpp b/src/core/src/io/mtx/ecal_named_mutex.cpp index 2a93e01..a7ed361 100644 --- a/src/core/src/io/mtx/ecal_named_mutex.cpp +++ b/src/core/src/io/mtx/ecal_named_mutex.cpp @@ -57,12 +57,12 @@ namespace eCAL { } - CNamedMutex::CNamedMutex(CNamedMutex&& named_mutex) + CNamedMutex::CNamedMutex(CNamedMutex&& named_mutex) noexcept { m_impl.swap(named_mutex.m_impl); } - CNamedMutex& CNamedMutex::operator=(CNamedMutex&& named_mutex) + CNamedMutex& CNamedMutex::operator=(CNamedMutex&& named_mutex) noexcept { m_impl.swap(named_mutex.m_impl); named_mutex.m_impl.reset(); diff --git a/src/core/src/io/mtx/ecal_named_mutex.h b/src/core/src/io/mtx/ecal_named_mutex.h index 717d7b1..626c9f0 100644 --- a/src/core/src/io/mtx/ecal_named_mutex.h +++ b/src/core/src/io/mtx/ecal_named_mutex.h @@ -34,14 +34,14 @@ namespace eCAL class CNamedMutex { public: - CNamedMutex(const std::string& name_, bool recoverable_ = false); + explicit CNamedMutex(const std::string& name_, bool recoverable_ = false); CNamedMutex(); ~CNamedMutex(); CNamedMutex(const CNamedMutex&) = delete; CNamedMutex& operator=(const CNamedMutex&) = delete; - CNamedMutex(CNamedMutex&& named_mutex); - CNamedMutex& operator=(CNamedMutex&& named_mutex) ; + CNamedMutex(CNamedMutex&& named_mutex) noexcept; + CNamedMutex& operator=(CNamedMutex&& named_mutex) noexcept; bool Create(const std::string& name_, bool recoverable_ = false); void Destroy(); diff --git a/src/core/src/io/mtx/ecal_named_mutex_base.h b/src/core/src/io/mtx/ecal_named_mutex_base.h index dfd186f..e1cf642 100644 --- a/src/core/src/io/mtx/ecal_named_mutex_base.h +++ b/src/core/src/io/mtx/ecal_named_mutex_base.h @@ -47,9 +47,7 @@ namespace eCAL class CNamedMutexStubImpl : public CNamedMutexImplBase { public: - ~CNamedMutexStubImpl() - { - } + ~CNamedMutexStubImpl() override = default; bool IsCreated() const final { diff --git a/src/core/src/io/shm/ecal_memfile.cpp b/src/core/src/io/shm/ecal_memfile.cpp index 8b4d944..94f5365 100644 --- a/src/core/src/io/shm/ecal_memfile.cpp +++ b/src/core/src/io/shm/ecal_memfile.cpp @@ -115,7 +115,7 @@ namespace eCAL { if (m_memfile_info.mem_address != nullptr) { - SInternalHeader* header = reinterpret_cast(m_memfile_info.mem_address); + auto* header = reinterpret_cast(m_memfile_info.mem_address); // reset header if memfile does not exist or rather is not initialized as well as if lock state is inconsistent if (!m_memfile_info.exists || header->int_hdr_size == 0 || (m_auto_sanitizing && m_memfile_mutex.WasRecovered())) @@ -286,7 +286,7 @@ namespace eCAL // update m_header and write into memory file header m_header.cur_data_size = (unsigned long)(len_); - SInternalHeader* pHeader = static_cast(m_memfile_info.mem_address); + auto* pHeader = static_cast(m_memfile_info.mem_address); pHeader->cur_data_size = m_header.cur_data_size; // return write address diff --git a/src/core/src/io/shm/ecal_memfile.h b/src/core/src/io/shm/ecal_memfile.h index 88523d1..e569102 100644 --- a/src/core/src/io/shm/ecal_memfile.h +++ b/src/core/src/io/shm/ecal_memfile.h @@ -60,7 +60,7 @@ namespace eCAL * * @return true if it succeeds, false if it fails. **/ - bool Create(const char* name_, const bool create_, const size_t len_ = 0, const bool auto_sanitizing_ = false); + bool Create(const char* name_, bool create_, size_t len_ = 0, bool auto_sanitizing_ = false); /** * @brief Delete the associated memory file from system. @@ -69,7 +69,7 @@ namespace eCAL * * @return true if it succeeds, false if it fails. **/ - bool Destroy(const bool remove_); + bool Destroy(bool remove_); /** * @brief Get memory file read access. @@ -78,7 +78,7 @@ namespace eCAL * * @return true if file exists and could be opened with read access. **/ - bool GetReadAccess(const int timeout_); + bool GetReadAccess(int timeout_); /** * @brief Release the read access. @@ -95,7 +95,7 @@ namespace eCAL * * @return Number of available bytes (or zero if it fails). **/ - size_t GetReadAddress(const void*& buf_, const size_t len_); + size_t GetReadAddress(const void*& buf_, size_t len_); /** * @brief Read bytes from an opened memory file. @@ -106,7 +106,7 @@ namespace eCAL * * @return Number of copied bytes (or zero if it fails). **/ - size_t Read(void* buf_, const size_t len_, const size_t offset_); + size_t Read(void* buf_, size_t len_, size_t offset_); /** * @brief Get memory file write access. @@ -115,7 +115,7 @@ namespace eCAL * * @return true if file exists and could be opened with read/write access. **/ - bool GetWriteAccess(const int timeout_); + bool GetWriteAccess(int timeout_); /** * @brief Release the write access. @@ -132,7 +132,7 @@ namespace eCAL * * @return Number of available bytes (or zero if it fails). **/ - size_t GetWriteAddress(void*& buf_, const size_t len_); + size_t GetWriteAddress(void*& buf_, size_t len_); /** * @brief Write bytes to the memory file. diff --git a/src/core/src/io/shm/ecal_memfile_db.cpp b/src/core/src/io/shm/ecal_memfile_db.cpp index 9fadbff..2533539 100644 --- a/src/core/src/io/shm/ecal_memfile_db.cpp +++ b/src/core/src/io/shm/ecal_memfile_db.cpp @@ -26,7 +26,6 @@ #include "ecal_memfile_db.h" #include -#include #include #include @@ -43,7 +42,7 @@ namespace eCAL const std::lock_guard lock(m_memfile_map_mtx); // erase memory files from memory map - for (MemFileMapT::iterator iter = m_memfile_map.begin(); iter != m_memfile_map.end(); ++iter) + for (auto iter = m_memfile_map.begin(); iter != m_memfile_map.end(); ++iter) { auto& memfile_info = iter->second; diff --git a/src/core/src/io/shm/ecal_memfile_db.h b/src/core/src/io/shm/ecal_memfile_db.h index e547724..98f92aa 100644 --- a/src/core/src/io/shm/ecal_memfile_db.h +++ b/src/core/src/io/shm/ecal_memfile_db.h @@ -40,9 +40,9 @@ namespace eCAL void Destroy(); - bool AddFile(const std::string& name_, const bool create_, const size_t len_, SMemFileInfo& mem_file_info_); - bool RemoveFile(const std::string& name_, const bool remove_); - bool CheckFileSize(const std::string& name_, const size_t len_, SMemFileInfo& mem_file_info_); + bool AddFile(const std::string& name_, bool create_, size_t len_, SMemFileInfo& mem_file_info_); + bool RemoveFile(const std::string& name_, bool remove_); + bool CheckFileSize(const std::string& name_, size_t len_, SMemFileInfo& mem_file_info_); protected: using MemFileMapT = std::unordered_map; @@ -54,10 +54,10 @@ namespace eCAL { namespace db { - bool AddFile(const std::string& name_, const bool create_, const size_t len_, SMemFileInfo& mem_file_info_); - bool RemoveFile(const std::string& name_, const bool remove_); + bool AddFile(const std::string& name_, bool create_, size_t len_, SMemFileInfo& mem_file_info_); + bool RemoveFile(const std::string& name_, bool remove_); - bool CheckFileSize(const std::string& name_, const size_t len_, SMemFileInfo& mem_file_info_); + bool CheckFileSize(const std::string& name_, size_t len_, SMemFileInfo& mem_file_info_); } } } diff --git a/src/core/src/io/shm/ecal_memfile_naming.cpp b/src/core/src/io/shm/ecal_memfile_naming.cpp index b736e6d..06ca63d 100644 --- a/src/core/src/io/shm/ecal_memfile_naming.cpp +++ b/src/core/src/io/shm/ecal_memfile_naming.cpp @@ -19,7 +19,6 @@ #include "io/shm/ecal_memfile_naming.h" -#include #include #include #include diff --git a/src/core/src/io/shm/ecal_memfile_pool.cpp b/src/core/src/io/shm/ecal_memfile_pool.cpp index b087c3f..48e902d 100644 --- a/src/core/src/io/shm/ecal_memfile_pool.cpp +++ b/src/core/src/io/shm/ecal_memfile_pool.cpp @@ -22,14 +22,10 @@ * @brief memory file pool handler **/ -#include "ecal_def.h" #include "ecal_event.h" #include "ecal_memfile_pool.h" -#include #include -#include -#include #include #include #include @@ -106,7 +102,7 @@ namespace eCAL if (m_is_observing) return false; // assign callback - m_data_callback = std::move(callback_); + m_data_callback = callback_; // mark as running m_is_observing = true; diff --git a/src/core/src/io/shm/ecal_memfile_pool.h b/src/core/src/io/shm/ecal_memfile_pool.h index dd173e7..3a4785c 100644 --- a/src/core/src/io/shm/ecal_memfile_pool.h +++ b/src/core/src/io/shm/ecal_memfile_pool.h @@ -61,14 +61,14 @@ namespace eCAL bool Create(const std::string& memfile_name_, const std::string& memfile_event_); bool Destroy(); - bool Start(const std::string& topic_name_, const std::string& topic_id_, const int timeout_, const MemFileDataCallbackT& callback_); + bool Start(const std::string& topic_name_, const std::string& topic_id_, int timeout_, const MemFileDataCallbackT& callback_); bool Stop(); bool IsObserving() {return(m_is_observing);}; bool ResetTimeout(); protected: - void Observe(const std::string& topic_name_, const std::string& topic_id_, const int timeout_); + void Observe(const std::string& topic_name_, const std::string& topic_id_, int timeout_); bool ReadFileHeader(SMemFileHeader& memfile_hdr); std::atomic m_created; diff --git a/src/core/src/io/shm/ecal_memfile_sync.cpp b/src/core/src/io/shm/ecal_memfile_sync.cpp index 5c01a17..187faa5 100644 --- a/src/core/src/io/shm/ecal_memfile_sync.cpp +++ b/src/core/src/io/shm/ecal_memfile_sync.cpp @@ -21,8 +21,6 @@ * @brief synchronized memory file interface **/ -#include -#include #include #include "ecal_event.h" diff --git a/src/core/src/io/shm/win32/ecal_memfile_os.cpp b/src/core/src/io/shm/win32/ecal_memfile_os.cpp index 58c3b90..670709b 100644 --- a/src/core/src/io/shm/win32/ecal_memfile_os.cpp +++ b/src/core/src/io/shm/win32/ecal_memfile_os.cpp @@ -62,7 +62,7 @@ namespace eCAL flProtect = PAGE_READONLY; } mem_file_info_.map_region = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, flProtect, 0, (DWORD)mem_file_info_.size, mem_file_info_.name.c_str()); - if (mem_file_info_.map_region == NULL) return(false); + if (mem_file_info_.map_region == nullptr) return(false); if (GetLastError() == ERROR_ALREADY_EXISTS) mem_file_info_.exists = true; } diff --git a/src/core/src/io/udp/ecal_udp_sample_sender.cpp b/src/core/src/io/udp/ecal_udp_sample_sender.cpp index 6242a27..048106f 100644 --- a/src/core/src/io/udp/ecal_udp_sample_sender.cpp +++ b/src/core/src/io/udp/ecal_udp_sample_sender.cpp @@ -24,9 +24,7 @@ #include "ecal_udp_sample_sender.h" #include "io/udp/fragmentation/snd_fragments.h" -#include #include -#include #include #include #include diff --git a/src/core/src/io/udp/ecal_udp_sample_sender.h b/src/core/src/io/udp/ecal_udp_sample_sender.h index 2dcfcab..0c0dfae 100644 --- a/src/core/src/io/udp/ecal_udp_sample_sender.h +++ b/src/core/src/io/udp/ecal_udp_sample_sender.h @@ -38,7 +38,7 @@ namespace eCAL class CSampleSender { public: - CSampleSender(const IO::UDP::SSenderAttr& attr_); + explicit CSampleSender(const IO::UDP::SSenderAttr& attr_); size_t Send(const std::string& sample_name_, const std::vector& serialized_sample_); private: diff --git a/src/core/src/pubsub/ecal_pubgate.cpp b/src/core/src/pubsub/ecal_pubgate.cpp index 24e61a7..a5f682c 100644 --- a/src/core/src/pubsub/ecal_pubgate.cpp +++ b/src/core/src/pubsub/ecal_pubgate.cpp @@ -26,7 +26,6 @@ #include "ecal_globals.h" #include -#include #include #include #include diff --git a/src/core/src/pubsub/ecal_publisher.cpp b/src/core/src/pubsub/ecal_publisher.cpp index 256a580..7f325b4 100644 --- a/src/core/src/pubsub/ecal_publisher.cpp +++ b/src/core/src/pubsub/ecal_publisher.cpp @@ -21,7 +21,6 @@ * @brief common data publisher based on eCAL **/ -#include #include #include "ecal_globals.h" @@ -70,7 +69,7 @@ namespace eCAL CPublisher::CPublisher(const std::string& topic_name_, const SDataTypeInformation& data_type_info_) : CPublisher() { - Create(topic_name_, data_type_info_); + CPublisher::Create(topic_name_, data_type_info_); } CPublisher::CPublisher(const std::string& topic_name_) @@ -79,7 +78,7 @@ namespace eCAL CPublisher::~CPublisher() { - Destroy(); + CPublisher::Destroy(); } /** diff --git a/src/core/src/pubsub/ecal_subscriber.cpp b/src/core/src/pubsub/ecal_subscriber.cpp index b5bef7f..4460f41 100644 --- a/src/core/src/pubsub/ecal_subscriber.cpp +++ b/src/core/src/pubsub/ecal_subscriber.cpp @@ -21,7 +21,6 @@ * @brief common data subscriber for eCAL **/ -#include #include #include "ecal_globals.h" @@ -67,7 +66,7 @@ namespace eCAL CSubscriber::CSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) : CSubscriber() { - Create(topic_name_, topic_info_); + CSubscriber::Create(topic_name_, topic_info_); } CSubscriber::CSubscriber(const std::string& topic_name_) @@ -76,7 +75,7 @@ namespace eCAL CSubscriber::~CSubscriber() { - Destroy(); + CSubscriber::Destroy(); } CSubscriber::CSubscriber(CSubscriber&& rhs) noexcept : diff --git a/src/core/src/readwrite/ecal_reader.cpp b/src/core/src/readwrite/ecal_reader.cpp index bac9bb1..83cac3c 100644 --- a/src/core/src/readwrite/ecal_reader.cpp +++ b/src/core/src/readwrite/ecal_reader.cpp @@ -48,7 +48,6 @@ #include "tcp/ecal_reader_tcp.h" #endif -#include #include #include #include diff --git a/src/core/src/readwrite/ecal_writer.cpp b/src/core/src/readwrite/ecal_writer.cpp index a073147..9dc1bea 100644 --- a/src/core/src/readwrite/ecal_writer.cpp +++ b/src/core/src/readwrite/ecal_writer.cpp @@ -21,8 +21,6 @@ * @brief common eCAL data writer **/ -#include -#include #include #include #include diff --git a/src/core/src/readwrite/shm/ecal_reader_shm.cpp b/src/core/src/readwrite/shm/ecal_reader_shm.cpp index c2f4b2f..244460f 100644 --- a/src/core/src/readwrite/shm/ecal_reader_shm.cpp +++ b/src/core/src/readwrite/shm/ecal_reader_shm.cpp @@ -21,7 +21,6 @@ * @brief shared memory layer **/ -#include #include #include #include diff --git a/src/core/src/readwrite/shm/ecal_writer_shm.cpp b/src/core/src/readwrite/shm/ecal_writer_shm.cpp index 0a07907..9ee4cd4 100644 --- a/src/core/src/readwrite/shm/ecal_writer_shm.cpp +++ b/src/core/src/readwrite/shm/ecal_writer_shm.cpp @@ -21,7 +21,6 @@ * @brief memory file data writer **/ -#include #include #include #include diff --git a/src/core/src/readwrite/tcp/ecal_reader_tcp.cpp b/src/core/src/readwrite/tcp/ecal_reader_tcp.cpp index 34a1577..ffbfbae 100644 --- a/src/core/src/readwrite/tcp/ecal_reader_tcp.cpp +++ b/src/core/src/readwrite/tcp/ecal_reader_tcp.cpp @@ -27,7 +27,6 @@ #include "pubsub/ecal_subgate.h" -#include "readwrite/ecal_writer_base.h" #include "ecal_reader_tcp.h" #include "ecal_tcp_pubsub_logger.h" diff --git a/src/core/src/readwrite/tcp/ecal_writer_tcp.cpp b/src/core/src/readwrite/tcp/ecal_writer_tcp.cpp index 9fda547..6663aa4 100644 --- a/src/core/src/readwrite/tcp/ecal_writer_tcp.cpp +++ b/src/core/src/readwrite/tcp/ecal_writer_tcp.cpp @@ -110,7 +110,7 @@ namespace eCAL proto_header_content.id = attr_.id; proto_header_content.clock = attr_.clock; proto_header_content.time = attr_.time; - proto_header_content.hash = attr_.hash; + proto_header_content.hash = static_cast(attr_.hash); proto_header_content.size = static_cast(attr_.len); // we use this size attribute for "header only" // Compute size of "ECAL" pre-header @@ -121,7 +121,7 @@ namespace eCAL SerializeToBuffer(proto_header, serialized_proto_header); // Get size of ecal payload sample - uint16_t proto_header_size = static_cast(serialized_proto_header.size()); + auto proto_header_size = static_cast(serialized_proto_header.size()); // Compute needed padding for aligning the payload //const size_t minimal_header_size = ecal_magic_size + sizeof(uint16_t) + ecal_sample_size; diff --git a/src/core/src/readwrite/udp/ecal_reader_udp_mc.cpp b/src/core/src/readwrite/udp/ecal_reader_udp_mc.cpp index 39ade80..9a200b4 100644 --- a/src/core/src/readwrite/udp/ecal_reader_udp_mc.cpp +++ b/src/core/src/readwrite/udp/ecal_reader_udp_mc.cpp @@ -27,7 +27,6 @@ #include "pubsub/ecal_subgate.h" #include "io/udp/ecal_udp_configurations.h" -#include #include #include #include diff --git a/src/core/src/registration/ecal_registration_provider.cpp b/src/core/src/registration/ecal_registration_provider.cpp index a6b735d..831127d 100644 --- a/src/core/src/registration/ecal_registration_provider.cpp +++ b/src/core/src/registration/ecal_registration_provider.cpp @@ -356,7 +356,7 @@ namespace eCAL // eCAL initialization state const unsigned int comp_state(g_globals()->GetComponents()); - process_sample_process.component_init_state = comp_state; + process_sample_process.component_init_state = static_cast(comp_state); std::string component_info; if ((comp_state & Init::Publisher) != 0u) component_info += "|pub"; if ((comp_state & Init::Subscriber) != 0u) component_info += "|sub"; diff --git a/src/core/src/registration/shm/ecal_memfile_broadcast.cpp b/src/core/src/registration/shm/ecal_memfile_broadcast.cpp index a978278..18c2983 100644 --- a/src/core/src/registration/shm/ecal_memfile_broadcast.cpp +++ b/src/core/src/registration/shm/ecal_memfile_broadcast.cpp @@ -28,8 +28,6 @@ #include "ecal_global_accessors.h" #include -#include -#include #include #include #include diff --git a/src/core/src/registration/shm/ecal_memfile_broadcast.h b/src/core/src/registration/shm/ecal_memfile_broadcast.h index 261cfdb..64456b3 100644 --- a/src/core/src/registration/shm/ecal_memfile_broadcast.h +++ b/src/core/src/registration/shm/ecal_memfile_broadcast.h @@ -40,7 +40,7 @@ namespace eCAL static inline std::int64_t CreateTimestamp() { const auto time_point = std::chrono::steady_clock::now(); - return static_cast(std::chrono::duration_cast(time_point.time_since_epoch()).count()); + return static_cast(std::chrono::duration_cast(time_point.time_since_epoch()).count()); } static inline std::uint64_t CreateEventId() diff --git a/src/core/src/registration/shm/ecal_memfile_broadcast_reader.cpp b/src/core/src/registration/shm/ecal_memfile_broadcast_reader.cpp index 15bee6b..9fd96cd 100644 --- a/src/core/src/registration/shm/ecal_memfile_broadcast_reader.cpp +++ b/src/core/src/registration/shm/ecal_memfile_broadcast_reader.cpp @@ -24,7 +24,6 @@ #include "ecal_memfile_broadcast_reader.h" #include "ecal_def.h" #include "io/shm/ecal_memfile.h" -#include #include #include #include diff --git a/src/core/src/registration/shm/ecal_memfile_broadcast_reader.h b/src/core/src/registration/shm/ecal_memfile_broadcast_reader.h index d02a04d..5d2bf3d 100644 --- a/src/core/src/registration/shm/ecal_memfile_broadcast_reader.h +++ b/src/core/src/registration/shm/ecal_memfile_broadcast_reader.h @@ -35,7 +35,7 @@ namespace eCAL { struct SMemfileBroadcastMessage { - const void *data; + const void *data = nullptr; std::size_t size = 0; std::int64_t timestamp = 0; }; diff --git a/src/core/src/service/ecal_service_server_impl.cpp b/src/core/src/service/ecal_service_server_impl.cpp index f63dce8..d91e54b 100644 --- a/src/core/src/service/ecal_service_server_impl.cpp +++ b/src/core/src/service/ecal_service_server_impl.cpp @@ -24,7 +24,6 @@ #include #include "registration/ecal_registration_provider.h" -#include "ecal_servicegate.h" #include "ecal_descgate.h" #include "ecal_global_accessors.h" #include "ecal_service_server_impl.h" @@ -32,7 +31,6 @@ #include "serialization/ecal_serialize_service.h" #include -#include #include #include #include diff --git a/src/core/src/time/ecal_time.cpp b/src/core/src/time/ecal_time.cpp index c8aa271..e66b7d0 100644 --- a/src/core/src/time/ecal_time.cpp +++ b/src/core/src/time/ecal_time.cpp @@ -25,7 +25,6 @@ #include #include -#include #if ECAL_CORE_TIMEGATE #include "ecal_timegate.h" diff --git a/src/core/src/util/advanced_tclap_output.cpp b/src/core/src/util/advanced_tclap_output.cpp index e936c40..a3c954c 100644 --- a/src/core/src/util/advanced_tclap_output.cpp +++ b/src/core/src/util/advanced_tclap_output.cpp @@ -19,7 +19,6 @@ #include "advanced_tclap_output.h" -#include #include #include #include