Skip to content

Commit

Permalink
eCAL::CPublisher namespace added
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Apr 23, 2024
1 parent 91b91f4 commit 1a3466a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/msg/flatbuffers/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace eCAL
* @param topic_name_ Unique topic name.
* @param config_ Optional configuration parameters.
**/
CPublisher(const std::string& topic_name_, const Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
CPublisher(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
{
}

Expand Down Expand Up @@ -85,7 +85,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const Config& config_ = {})
bool Create(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {})
{
return(CMsgPublisher<T>::Create(topic_name_, GetDataTypeInformation(), config_));
}
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/msg/messagepack/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace eCAL
* @param topic_name_ Unique topic name.
* @param config_ Optional configuration parameters.
**/
CPublisher(const std::string& topic_name_, const Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
CPublisher(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
{
}

Expand Down Expand Up @@ -88,7 +88,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const Config& config_ = {})
bool Create(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {})
{
return(CMsgPublisher<T>::Create(topic_name_, GetDataTypeInformation(), config_));
}
Expand Down
5 changes: 3 additions & 2 deletions ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ namespace eCAL
*
* @param topic_name_ Unique topic name.
* @param msg_ Protobuf message object.
* @param config_ Optional configuration parameters.
**/
CDynamicPublisher(const std::string& topic_name_, const std::shared_ptr<google::protobuf::Message>& msg_)
: CMsgPublisher<google::protobuf::Message>(topic_name_, GetTopicInformationFromMessage(msg_.get()))
CDynamicPublisher(const std::string& topic_name_, const std::shared_ptr<google::protobuf::Message>& msg_, const eCAL::CPublisher::Config& config_ = {})
: CMsgPublisher<google::protobuf::Message>(topic_name_, GetTopicInformationFromMessage(msg_.get()), config_)
, m_msg{ msg_ } {}

/**
Expand Down
5 changes: 3 additions & 2 deletions ecal/core/include/ecal/msg/protobuf/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ namespace eCAL
* @brief Constructor.
*
* @param topic_name_ Unique topic name.
* @param config_ Optional configuration parameters.
**/

// call the function via its class because it's a virtual function that is called in constructor/destructor,-
// where the vtable is not created yet, or it's destructed.
// Probably we can handle the Message publishers differently. One message publisher class and then one class for payloads and getting type
// descriptor information.
explicit CPublisher(const std::string& topic_name_, const Config& config_ = {}) : eCAL::CPublisher(topic_name_, CPublisher::GetDataTypeInformation(), config_)
explicit CPublisher(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {}) : eCAL::CPublisher(topic_name_, CPublisher::GetDataTypeInformation(), config_)
{
}

Expand Down Expand Up @@ -143,7 +144,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const Config& config_ = {})
bool Create(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {})
{
return(eCAL::CPublisher::Create(topic_name_, GetDataTypeInformation(), config_));
}
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/include/ecal/msg/string/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace eCAL

// call the function via its class because it's a virtual function that is called in constructor/destructor,-
// where the vtable is not created yet, or it's destructed.
explicit CPublisher(const std::string& topic_name_, const Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
explicit CPublisher(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {}) : CMsgPublisher<T>(topic_name_, GetDataTypeInformation(), config_)
{
}

Expand Down Expand Up @@ -92,7 +92,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const Config& config_ = {})
bool Create(const std::string& topic_name_, const eCAL::CPublisher::Config& config_ = {})
{
return(CMsgPublisher<T>::Create(topic_name_, GetDataTypeInformation(), config_));
}
Expand Down
12 changes: 2 additions & 10 deletions ecal/core/src/readwrite/ecal_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,14 @@ namespace eCAL
m_writer.tcp.Destroy();
#endif

// reset defaults
m_id = 0;
m_clock = 0;
m_connected = false;

// reset configuration
Configure({});

// reset subscriber maps
// clear subscriber maps
{
const std::lock_guard<std::mutex> lock(m_sub_map_sync);
m_loc_sub_map.clear();
m_ext_sub_map.clear();
}

// reset event callback map
// clear event callback map
{
const std::lock_guard<std::mutex> lock(m_event_callback_map_sync);
m_event_callback_map.clear();
Expand Down

0 comments on commit 1a3466a

Please sign in to comment.