Skip to content

Commit

Permalink
GetId -> GetTopicId
Browse files Browse the repository at this point in the history
RemEventCallback -> RemoveEventCallback
std::move(const callback) -> = callback
check m_event_id_callback before creating callback structure
  • Loading branch information
rex-schilasky committed Dec 16, 2024
1 parent 4122a12 commit c684aa1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ecal/core/src/pubsub/ecal_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace eCAL
Registration::STopicId CPublisher::GetTopicId() const
{
if (m_publisher_impl == nullptr) return Registration::STopicId();
return(m_publisher_impl->GetId());
return(m_publisher_impl->GetTopicId());
}

SDataTypeInformation CPublisher::GetDataTypeInformation() const
Expand Down
11 changes: 5 additions & 6 deletions ecal/core/src/pubsub/ecal_publisher_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,13 @@ namespace eCAL
Logging::Log(log_level_debug2, m_attributes.topic_name + "::CDataWriter::AddEventCallback");
#endif
const std::lock_guard<std::mutex> lock(m_event_callback_map_mutex);
m_event_callback_map[type_] = std::move(callback_);
m_event_callback_map[type_] = callback_;
}

return(true);
}

bool CPublisherImpl::RemEventCallback(eCAL_Publisher_Event type_)
bool CPublisherImpl::RemoveEventCallback(eCAL_Publisher_Event type_)
{
if (!m_created) return(false);

Expand Down Expand Up @@ -751,17 +751,16 @@ namespace eCAL
data.tdatatype = tinfo_;

// new event handling with topic id
if(m_event_id_callback)
{
Registration::STopicId topic_id;
topic_id.topic_id.entity_id = subscription_info_.entity_id;
topic_id.topic_id.process_id = subscription_info_.process_id;
topic_id.topic_id.host_name = subscription_info_.host_name;
topic_id.topic_name = m_attributes.topic_name;
const std::lock_guard<std::mutex> lock(m_event_id_callback_mutex);
if (m_event_id_callback)
{
m_event_id_callback(topic_id, data);
}
// call event callback
m_event_id_callback(topic_id, data);
}

// deprecated event handling with topic name
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/src/pubsub/ecal_publisher_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace eCAL

// deprecated event callback interface
bool AddEventCallback(eCAL_Publisher_Event type_, const PubEventCallbackT callback_);
bool RemEventCallback(eCAL_Publisher_Event type_);
bool RemoveEventCallback(eCAL_Publisher_Event type_);

// future event callback interface
bool AddEventIDCallback(const PubEventIDCallbackT callback_);
Expand All @@ -103,7 +103,7 @@ namespace eCAL
bool IsSubscribed() const;
size_t GetSubscriberCount() const;

Registration::STopicId GetId() const
Registration::STopicId GetTopicId() const
{
Registration::STopicId id;
id.topic_name = m_attributes.topic_name;
Expand Down
4 changes: 2 additions & 2 deletions ecal/core/src/pubsub/ecal_publisher_v5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ namespace eCAL
bool CPublisher::RemEventCallback(eCAL_Publisher_Event type_)
{
if (m_publisher_impl == nullptr) return(false);
return(m_publisher_impl->RemEventCallback(type_));
return(m_publisher_impl->RemoveEventCallback(type_));
}

bool CPublisher::IsSubscribed() const
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace eCAL
Registration::STopicId CPublisher::GetId() const
{
if (m_publisher_impl == nullptr) return{};
return(m_publisher_impl->GetId());
return(m_publisher_impl->GetTopicId());
}

SDataTypeInformation CPublisher::GetDataTypeInformation() const
Expand Down

0 comments on commit c684aa1

Please sign in to comment.