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

[core] remove namespace v6, keep v5. Remove build of compatibility ta… #1957

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
23 changes: 13 additions & 10 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -736,20 +736,23 @@ endmacro()
# We now create two libraries
# One of them is a compatibility version that should facilitate easier migration.
# ecal_core, ecal_core_v5.
# We removed again the compatibility libraries.
# We might reintroduce it, but then for *ALL* functionality.
#######################################

add_ecal_core_library(${PROJECT_NAME})
target_compile_definitions(${PROJECT_NAME}
PUBLIC
ECAL_CORE_V5_FUNCTIONALTIY=1
)

add_ecal_core_library(core_v5)
target_compile_definitions(core_v5
PUBLIC
ECAL_CORE_NAMESPACE_V5_INLINE=1
ECAL_CORE_V5_FUNCTIONALTIY=1
)
#target_compile_definitions(${PROJECT_NAME}
# PUBLIC
# ECAL_CORE_V5_FUNCTIONALTIY=1
#)

#add_ecal_core_library(core_v5)
#target_compile_definitions(core_v5
# PUBLIC
# ECAL_CORE_NAMESPACE_V5_INLINE=1
# ECAL_CORE_V5_FUNCTIONALTIY=1
#)

###
## Iinstall header files only once...
Expand Down
4 changes: 1 addition & 3 deletions ecal/core/include/ecal/pubsub/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ namespace eCAL
{
class CPublisherImpl;

ECAL_CORE_NAMESPACE_V6
{
/**
* @brief eCAL publisher class.
**/
Expand Down Expand Up @@ -169,5 +167,5 @@ namespace eCAL
private:
std::shared_ptr<CPublisherImpl> m_publisher_impl;
};
}

}
3 changes: 0 additions & 3 deletions ecal/core/include/ecal/pubsub/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ namespace eCAL
{
class CSubscriberImpl;

ECAL_CORE_NAMESPACE_V6
{
/**
* @brief eCAL subscriber class.
**/
Expand Down Expand Up @@ -148,5 +146,4 @@ namespace eCAL
private:
std::shared_ptr<CSubscriberImpl> m_subscriber_impl;
};
}
}
3 changes: 0 additions & 3 deletions ecal/core/include/ecal/pubsub/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ namespace eCAL
}
}

ECAL_CORE_NAMESPACE_V6
{
/**
* @brief Receive callback function type with topic id and data struct. The topic id contains the topic name, the process
* name, the host name and a uniques topic identifier.
Expand Down Expand Up @@ -157,6 +155,5 @@ namespace eCAL
* @param data_ Event callback data structure with the event specific information.
**/
using SubEventCallbackT = std::function<void(const STopicId& topic_id_, const SSubEventCallbackData& data_)>;
}
}

5 changes: 1 addition & 4 deletions ecal/core/include/ecal/service/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ namespace eCAL
{
class CServiceClientImpl;

ECAL_CORE_NAMESPACE_V6
{
/**
* @brief Service client wrapper class.
**/
Expand Down Expand Up @@ -156,7 +154,6 @@ namespace eCAL
bool IsConnected() const;

private:
std::shared_ptr<eCAL::v6::CServiceClientImpl> m_service_client_impl;
std::shared_ptr<eCAL::CServiceClientImpl> m_service_client_impl;
};
}
}
9 changes: 3 additions & 6 deletions ecal/core/include/ecal/service/client_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@

namespace eCAL
{
ECAL_CORE_NAMESPACE_V6
{
class CServiceClientImpl;
}
class CServiceClientImpl;

class ECAL_API_CLASS CClientInstance final
{
public:
// Constructor
ECAL_API_EXPORTED_MEMBER
CClientInstance(const SEntityId& entity_id_, const std::shared_ptr<v6::CServiceClientImpl>& service_client_id_impl_);
CClientInstance(const SEntityId& entity_id_, const std::shared_ptr<CServiceClientImpl>& service_client_id_impl_);

// Defaulted destructor
~CClientInstance() = default;
Expand Down Expand Up @@ -113,6 +110,6 @@ namespace eCAL

private:
SEntityId m_entity_id;
const std::shared_ptr<eCAL::v6::CServiceClientImpl> m_service_client_impl;
const std::shared_ptr<eCAL::CServiceClientImpl> m_service_client_impl;
};
}
3 changes: 0 additions & 3 deletions ecal/core/include/ecal/service/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

namespace eCAL
{
ECAL_CORE_NAMESPACE_V6
{
class CServiceServerImpl;

/**
Expand Down Expand Up @@ -130,5 +128,4 @@ namespace eCAL
private:
std::shared_ptr<CServiceServerImpl> m_service_server_impl;
};
}
}
69 changes: 33 additions & 36 deletions ecal/core/include/ecal/service/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,41 +168,38 @@ namespace eCAL
**/
using ServiceMethodCallbackT = std::function<int(const SServiceMethodInformation& method_info_, const std::string& request_, std::string& response_)>;

ECAL_CORE_NAMESPACE_V6
/**
* @brief eCAL client event callback struct.
**/
struct SClientEventCallbackData
{
/**
* @brief eCAL client event callback struct.
**/
struct SClientEventCallbackData
{
eClientEvent type{ eClientEvent::none }; //!< event type
long long time = 0; //!< event time in µs
};

/**
* @brief Client event callback function type.
*
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ClientEventCallbackT = std::function<void(const SServiceId& service_id_, const SClientEventCallbackData& data_)>;

/**
* @brief eCAL server event callback struct.
**/
struct SServerEventCallbackData
{
eServerEvent type{ eServerEvent::none }; //!< event type
long long time = 0; //!< event time in µs
};

/**
* @brief Server event callback function type.
*
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ServerEventCallbackT = std::function<void(const SServiceId& service_id_, const struct SServerEventCallbackData& data_)>;
}

eClientEvent type{ eClientEvent::none }; //!< event type
long long time = 0; //!< event time in µs
};

/**
* @brief Client event callback function type.
*
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ClientEventCallbackT = std::function<void(const SServiceId& service_id_, const SClientEventCallbackData& data_)>;

/**
* @brief eCAL server event callback struct.
**/
struct SServerEventCallbackData
{
eServerEvent type{ eServerEvent::none }; //!< event type
long long time = 0; //!< event time in µs
};

/**
* @brief Server event callback function type.
*
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ServerEventCallbackT = std::function<void(const SServiceId& service_id_, const struct SServerEventCallbackData& data_)>;

}
2 changes: 1 addition & 1 deletion ecal/core/include/ecal/v5/ecal_subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace eCAL
* @return True if succeeded, false if not.
**/
ECAL_API_EXPORTED_MEMBER
bool AddReceiveCallback(v6::ReceiveCallbackT callback_);
bool AddReceiveCallback(eCAL::ReceiveCallbackT callback_);

/**
* @brief Remove callback function for incoming receives.
Expand Down
3 changes: 0 additions & 3 deletions ecal/core/src/pubsub/ecal_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

namespace eCAL
{
ECAL_CORE_NAMESPACE_V6
{
CPublisher::CPublisher(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const Publisher::Configuration& config_)
{
// create publisher implementation
Expand Down Expand Up @@ -134,5 +132,4 @@ namespace eCAL
if (m_publisher_impl == nullptr) return SDataTypeInformation();
return(m_publisher_impl->GetDataTypeInformation());
}
}
}
4 changes: 2 additions & 2 deletions ecal/core/src/pubsub/ecal_publisher_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ namespace eCAL
return(true);
}

bool CPublisherImpl::SetEventCallback(const v6::PubEventCallbackT callback_)
bool CPublisherImpl::SetEventCallback(const PubEventCallbackT callback_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'callback_' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

ecal/core/src/pubsub/ecal_publisher_impl.h:88:

-     bool SetEventCallback(const PubEventCallbackT callback_);
+     bool SetEventCallback(const PubEventCallbackT& callback_);
Suggested change
bool CPublisherImpl::SetEventCallback(const PubEventCallbackT callback_)
bool CPublisherImpl::SetEventCallback(const PubEventCallbackT& callback_)

{
if (!m_created) return false;

Expand Down Expand Up @@ -728,7 +728,7 @@ namespace eCAL
// new event handling with topic id
if(m_event_id_callback)
{
v6::SPubEventCallbackData data;
SPubEventCallbackData data;
data.event_type = type_;
data.event_time = eCAL::Time::GetMicroSeconds();
data.subscriber_datatype = data_type_info_;
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 @@ -86,7 +86,7 @@ namespace eCAL
bool RemoveEventCallback(ePublisherEvent type_);

// future event callback interface
bool SetEventCallback(const v6::PubEventCallbackT callback_);
bool SetEventCallback(const PubEventCallbackT callback_);
bool RemoveEventCallback();

bool SetAttribute(const std::string& attr_name_, const std::string& attr_value_);
Expand Down Expand Up @@ -166,7 +166,7 @@ namespace eCAL
EventCallbackMapT m_event_callback_map;

std::mutex m_event_id_callback_mutex;
v6::PubEventCallbackT m_event_id_callback;
PubEventCallbackT m_event_id_callback;

long long m_id = 0;
long long m_clock = 0;
Expand Down
3 changes: 0 additions & 3 deletions ecal/core/src/pubsub/ecal_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

namespace eCAL
{
ECAL_CORE_NAMESPACE_V6
{
CSubscriber::CSubscriber(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const Subscriber::Configuration& config_)
{
// create subscriber implementation
Expand Down Expand Up @@ -107,5 +105,4 @@ namespace eCAL
if (m_subscriber_impl == nullptr) return SDataTypeInformation{};
return m_subscriber_impl->GetDataTypeInformation();
}
}
}
6 changes: 3 additions & 3 deletions ecal/core/src/pubsub/ecal_subscriber_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace eCAL
return(false);
}

bool CSubscriberImpl::SetReceiveCallback(v6::ReceiveCallbackT callback_)
bool CSubscriberImpl::SetReceiveCallback(ReceiveCallbackT callback_)
{
if (!m_created) return(false);

Expand Down Expand Up @@ -233,7 +233,7 @@ namespace eCAL
return(true);
}

bool CSubscriberImpl::SetEventIDCallback(const v6::SubEventCallbackT callback_)
bool CSubscriberImpl::SetEventIDCallback(const SubEventCallbackT callback_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the const qualified parameter 'callback_' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]

Suggested change
bool CSubscriberImpl::SetEventIDCallback(const SubEventCallbackT callback_)
bool CSubscriberImpl::SetEventIDCallback(const SubEventCallbackT& callback_)

ecal/core/src/pubsub/ecal_subscriber_impl.h:79:

-     bool SetEventIDCallback(const SubEventCallbackT callback_);
+     bool SetEventIDCallback(const SubEventCallbackT& callback_);

{
if (!m_created) return false;

Expand Down Expand Up @@ -782,7 +782,7 @@ namespace eCAL
// new event handling with topic id
if (m_event_id_callback)
{
v6::SSubEventCallbackData data;
SSubEventCallbackData data;
data.event_type = type_;
data.event_time = eCAL::Time::GetMicroSeconds();
data.publisher_datatype = data_type_info_;
Expand Down
8 changes: 4 additions & 4 deletions ecal/core/src/pubsub/ecal_subscriber_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ namespace eCAL

bool Read(std::string& buf_, long long* time_ = nullptr, int rcv_timeout_ms_ = 0);

bool SetReceiveCallback(v6::ReceiveCallbackT callback_);
bool SetReceiveCallback(ReceiveCallbackT callback_);
bool RemoveReceiveCallback();

// deprecated event callback interface
bool SetEventCallback(eSubscriberEvent type_, v5::SubEventCallbackT callback_);
bool RemoveEventCallback(eSubscriberEvent type_);

// future event callback interface
bool SetEventIDCallback(const v6::SubEventCallbackT callback_);
bool SetEventIDCallback(const SubEventCallbackT callback_);
bool RemoveEventCallback();

bool SetAttribute(const std::string& attr_name_, const std::string& attr_value_);
Expand Down Expand Up @@ -157,7 +157,7 @@ namespace eCAL
long long m_read_time = 0;

std::mutex m_receive_callback_mutex;
v6::ReceiveCallbackT m_receive_callback;
ReceiveCallbackT m_receive_callback;
std::atomic<int> m_receive_time;

std::deque<size_t> m_sample_hash_queue;
Expand All @@ -167,7 +167,7 @@ namespace eCAL
EventCallbackMapT m_event_callback_map;

std::mutex m_event_id_callback_mutex;
v6::SubEventCallbackT m_event_id_callback;
SubEventCallbackT m_event_id_callback;

std::atomic<long long> m_clock;

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/service/ecal_clientgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ namespace eCAL
m_created = false;
}

bool CClientGate::Register(const std::string& service_name_, const std::shared_ptr<v6::CServiceClientImpl>& client_)
bool CClientGate::Register(const std::string& service_name_, const std::shared_ptr<CServiceClientImpl>& client_)
{
if (!m_created) return(false);

// register internal client
const std::unique_lock<std::shared_timed_mutex> lock(m_service_client_map_mutex);
m_service_client_map.emplace(std::pair<std::string, std::shared_ptr<v6::CServiceClientImpl>>(service_name_, client_));
m_service_client_map.emplace(std::pair<std::string, std::shared_ptr<CServiceClientImpl>>(service_name_, client_));

return(true);
}

bool CClientGate::Unregister(const std::string& service_name_, const std::shared_ptr<v6::CServiceClientImpl>& client_)
bool CClientGate::Unregister(const std::string& service_name_, const std::shared_ptr<CServiceClientImpl>& client_)
{
if (!m_created) return(false);
bool ret_state = false;
Expand Down
Loading
Loading