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] prepare api for ecal6 #1399

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Conversation

rex-schilasky
Copy link
Contributor

@rex-schilasky rex-schilasky commented Feb 26, 2024

Description

All API functions (C & C++) deprecated that are no longer part of the future eCAL6 API.

deprecated header files:

  • include/ecal/cimpl/ecal_event_cimpl.h
  • include/ecal/cimpl/ecal_proto_dyn_json_subscriber_cimpl.h
  • include/ecal/cimpl/ecal_qos_cimpl.h
  • include/ecal/ecal_clang.h
  • include/ecal/ecal_event.h
  • include/ecal/ecal_eventhandle.h
  • include/ecal/ecal_qos.h
  • include/ecal/ecal_timed_cb.h

deprecated API:

ecal_callback_cimpl.h:

enum eCAL_Subscriber_Event
{
  sub_event_none              = 0,
  sub_event_connected         = 1,
  sub_event_disconnected      = 2,
  sub_event_dropped           = 3,
  sub_event_timeout           = 4,  //!< deprecated, will be removed in future eCAL versions
  sub_event_corrupted         = 5,
  sub_event_update_connection = 6,
};

struct SPubEventCallbackDataC
{
  enum eCAL_Publisher_Event  type;         //!< event type
  long long                  time;         //!< event time stamp
  long long                  clock;        //!< event clock
  const char*                tid;          //!< topic id of the connected subscriber                          (for pub_event_update_connection only)
  const char*                tname;        //!< topic type encoding of the connected subscriber               (for pub_event_update_connection only)
  const char*                tencoding;    //!< topic type name of the connected subscriber                   (for pub_event_update_connection only)
  const char*                tdesc;        //!< topic type descriptor information of the connected subscriber (for pub_event_update_connection only)

  const char*                ttype;        //!< deprecated, please use new tname + tencoding fields
};

struct SSubEventCallbackDataC
{
  enum eCAL_Subscriber_Event type;         //!< event type
  long long                  time;         //!< event time stamp
  long long                  clock;        //!< event clock
  const char*                tid;          //!< topic id of the connected publisher                          (for sub_event_update_connection only)
  const char*                tname;        //!< topic type encoding of the connected publisher               (for sub_event_update_connection only)
  const char*                tencoding;    //!< topic type name of the connected publisher                   (for sub_event_update_connection only)
  const char*                tdesc;        //!< topic type descriptor information of the connected publisher (for sub_event_update_connection only)

  const char*                ttype;        //!< deprecated, please use new tname + tencoding fields
};

ecal_client_cimpl.h:

  • int eCAL_Client_AddResponseCallbackC(ECAL_HANDLE handle_, ResponseCallbackCT callback_, void* par_);

ecal_init_cimpl.h:

#define eCAL_Init_Publisher   0x01                          /*!< Initialize Publisher API            */
#define eCAL_Init_Subscriber  0x02                          /*!< Initialize Subscriber API           */
#define eCAL_Init_Service     0x04                          /*!< Initialize Service API              */
#define eCAL_Init_Monitoring  0x08                          /*!< Initialize Monitoring API           */
#define eCAL_Init_Logging     0x10                          /*!< Initialize Logging API              */
#define eCAL_Init_TimeSync    0x20                          /*!< Initialize Time API                 */
#define eCAL_Init_RPC         0x40                          /*!< deprecated, will be removed in future eCAL versions */
#define eCAL_Init_ProcessReg  0x80                          /*!< Initialize Process Registration API */

ecal_log_cimpl.h:

  • void eCAL_Logging_StartCoreTimer();
  • void eCAL_Logging_StopCoreTimer();
  • void eCAL_Logging_SetCoreTime(double time_);
  • double eCAL_Logging_GetCoreTime();

ecal_process_cimpl.h:

  • int eCAL_Process_GetHostID();
  • float eCAL_Process_GetProcessCpuUsage();
  • unsigned long eCAL_Process_GetProcessMemory();
  • long long eCAL_Process_GetSClock();
  • long long eCAL_Process_GetSBytes();
  • long long eCAL_Process_GetWClock();
  • long long eCAL_Process_GetWBytes();
  • long long eCAL_Process_GetRClock();
  • long long eCAL_Process_GetRBytes();

ecal_publisher_cimpl.h:

  • int eCAL_Pub_SetQOS(ECAL_HANDLE handle_, struct SWriterQOSC qos_);
  • int eCAL_Pub_GetQOS(ECAL_HANDLE handle_, struct SWriterQOSC* qos_);
  • int eCAL_Pub_SetMaxBandwidthUDP(ECAL_HANDLE handle_, long bandwidth_);

ecal_server_cimpl.h:

  • int eCAL_Server_AddMethodCallbackC(ECAL_HANDLE handle_, const char* method_, const char* req_type_, const char* resp_type_, MethodCallbackCT callback_, void* par_);
  • int eCAL_Server_RemMethodCallbackC(ECAL_HANDLE handle_, const char* method_);

ecal_subscriber_cimpl.h:

  • int eCAL_Sub_SetQOS(ECAL_HANDLE handle_, struct SReaderQOSC qos_);
  • int eCAL_Sub_GetQOS(ECAL_HANDLE handle_, struct SReaderQOSC* qos_);
  • int eCAL_Sub_SetTimeout(ECAL_HANDLE handle_, int timeout_);

ecal_tlayer_cimpl.h:

enum eTransportLayerC
{
  tlayer_none       = 0,
  tlayer_udp_mc     = 1,
  tlayer_shm        = 4,
  tlayer_tcp        = 5,
  tlayer_inproc     = 42,  /*!< deprecated, whole layer will be removed in future eCAL versions */
  tlayer_all        = 255
};

ecal_log.h:

  • void StartCoreTimer();
  • void StopCoreTimer();
  • void SetCoreTime(double time_);
  • double GetCoreTime();

ecal_monitoring.h:

  • int GetMonitoring(std::string& mon_);

ecal_process.h:

  • int GetHostID();
  • float GetProcessCpuUsage();
  • unsigned long GetProcessMemory();
  • long long GetWClock();
  • long long GetWBytes();
  • long long GetRClock();
  • long long GetRBytes();

ecal_publisher.h:

  • bool SetQOS(const QOS::SWriterQOS& qos_);
  • QOS::SWriterQOS GetQOS();
  • bool SetMaxBandwidthUDP(long bandwidth_);

ecal_subscriber.h:

  • bool SetQOS(const QOS::SReaderQOS& qos_);
  • QOS::SReaderQOS GetQOS();
  • bool SetTimeout(int timeout_);

ecal_tlayer.h:

enum eTransportLayer
{
  tlayer_none       = 0,
  tlayer_udp_mc     = 1,
  tlayer_shm        = 4,
  tlayer_tcp        = 5,
  tlayer_inproc     = 42,  //!< deprecated, whole layer will be removed in future eCAL versions
  tlayer_all        = 255
};

struct ECAL_API STLayer
{
  STLayer()
  {
    sm_udp_mc  = smode_none;
    sm_shm     = smode_none;
    sm_inproc  = smode_none;
    sm_tcp     = smode_none;
  }
  eSendMode sm_udp_mc;  //!< udp multicast
  eSendMode sm_shm;     //!< shared memory
  eSendMode sm_inproc;  //!< deprecated, whole layer will be removed in future eCAL versions */
  eSendMode sm_tcp;     //!< tcp
};

added API:

ecal_subscriber_cimpl.h:

  • ECALC_API int eCAL_Sub_GetTypeName(ECAL_HANDLE handle_, void* buf_, int buf_len_);
  • ECALC_API int eCAL_Sub_GetEncoding(ECAL_HANDLE handle_, void* buf_, int buf_len_);

ecal_util_cimpl.h:

  • ECALC_API int eCAL_Util_GetTopicEncoding(const char* topic_name_, void* topic_encoding_, int topic_encoding_len_);
  • ECALC_API int eCAL_Util_GetTopicDescription(const char* topic_name_, void* topic_desc_, int topic_desc_len_);

C API subscriber functions eCAL_Sub_GetTypeName and eCAL_Sub_GetEncoding added
C publisher/subscriber callback structures SPubEventCallbackDataC and SSubEventCallbackDataC completed with tname, tencoding and tdesc
ecal_event samples removed (we should not demonstrate deprecated api)
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -27,6 +27,8 @@
#include <ecal/ecal_os.h>
#include <ecal/ecal_deprecate.h>
#include <ecal/types/monitoring.h>
#include <ecal/ecal_deprecate.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: duplicate include [readability-duplicate-include]

ecal/core/include/ecal/ecal_monitoring.h:28:

- #include <ecal/types/monitoring.h>
- #include <ecal/ecal_deprecate.h>
+ #include <ecal/types/monitoring.h>

if (handle_ == nullptr) return(0);
auto* sub = static_cast<eCAL::CSubscriber*>(handle_);
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation();
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name);
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.name);

if (handle_ == nullptr) return(0);
auto* sub = static_cast<eCAL::CSubscriber*>(handle_);
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation();
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding);
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.encoding);

if (handle_ == nullptr) return(0);
auto* sub = static_cast<eCAL::CSubscriber*>(handle_);
const eCAL::SDataTypeInformation datatype_info = sub->GetDataTypeInformation();
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'buffer_len' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor);
int const buffer_len = CopyBuffer(buf_, buf_len_, datatype_info.descriptor);

@rex-schilasky rex-schilasky marked this pull request as ready for review February 27, 2024 07:38
@rex-schilasky rex-schilasky changed the title [core} prepare api for ecal6 [core] prepare api for ecal6 Feb 27, 2024
@FlorianReimold FlorianReimold added this to the eCAL 5.13 milestone Feb 27, 2024
Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

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

👍

@rex-schilasky rex-schilasky merged commit 5397da4 into support/v5.13 Feb 27, 2024
9 checks passed
@rex-schilasky rex-schilasky deleted the api/deprecate-ecal-5-13 branch February 27, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants