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

cleanup/warnings-and-readme #1248

Merged
merged 5 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
[![License](https://img.shields.io/github/license/continental/ecal.svg?style=flat)](LICENSE.txt)

The **e**nhanced **C**ommunication **A**bstraction **L**ayer (eCAL) is a middleware that enables scalable, high performance interprocess communication on a single computer node or between different nodes in a computer network.
eCAL uses a **publish - subscribe** pattern to automatically connect different nodes in the network.
eCAL provides **publish - subscribe** and **server - client** pattern to connect different nodes in the network with almost no configuration required.

eCAL automatically chooses the best available data transport mechanism for each link:
eCAL automatically chooses the best available data transport mechanism for each link, it supports:
- **Shared memory** for local communication _(incredibly fast!)_
- **UDP** for network communication
- **UDP** and **TCP** for network communication

Visit the eCAL Documentation at 🌐 http://ecal.io for more information.
Visit the eCAL Documentation at 🌐 https://ecal.io for more information.

## Architecture

Expand Down Expand Up @@ -63,7 +63,7 @@ sudo apt-get install ecal
```
This PPA will always upgrade you to the latest eCAL Release (-> Rolling Release PPA). If you intend to stay on an specific release, check out other PPAs [here](https://eclipse-ecal.github.io/ecal/getting_started/setup.html#fa-ubuntu-automatically-install-ecal-from-a-ppa).

*Ubuntu 16.04, 18.04, 20.04, 20.10, 21.04 for CPU architectures i386, x64, armhf, arm64 are supported at the time of writing.*
*Ubuntu 18.04, 20.04, 22.04, 23.04, 23.10 for CPU architectures (i386), x64, armhf, arm64 are supported at the time of writing.*

## Example

Expand Down Expand Up @@ -125,8 +125,6 @@ eCAL comes with a set of read-to-use tools that will help you with developing, t
## eCAL & ROS
* [rmw_ecal](https://github.com/eclipse-ecal/rmw_ecal) - eCAL / ROS2 middleware layer
* [rosidl_typesupport_protobuf](https://github.com/eclipse-ecal/rosidl_typesupport_protobuf) - Protobuf based rosidl typesupport
* [ecal-ros2-publisher](https://github.com/ecal-io/ecal-ros2-publisher) - Publishing eCAL topics to ROS2
* [ecal-ros2-subscriber](https://github.com/ecal-io/ecal-ros2-subscriber) - Subscribing ROS2 topics in eCAL

## Other projects related to eCAL
* [fineftp-server](https://github.com/eclipse-ecal/fineftp-server) - FTP functionality to collect distributed measurement artifacts over network
Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/custom_tclap/advanced_tclap_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ namespace CustomTclap
*/
AdvancedTclapOutput(std::ostream* output_stream, int max_width);

virtual void version(TCLAP::CmdLineInterface &cmd) override;
virtual void usage(TCLAP::CmdLineInterface &cmd) override;
virtual void failure(TCLAP::CmdLineInterface &cmd, TCLAP::ArgException &e) override;
void version(TCLAP::CmdLineInterface &cmd) override;
void usage(TCLAP::CmdLineInterface &cmd) override;
void failure(TCLAP::CmdLineInterface &cmd, TCLAP::ArgException &e) override;

/**
* @brief Hides / un-hides an argument
Expand Down
82 changes: 41 additions & 41 deletions ecal/core/src/ecal_clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ ECAL_API bool ecal_get_type_name(const char* topic_name_, const char** topic_typ
char* cbuf = str_malloc(topic_type_s);
if(cbuf == nullptr) return(false);

if (topic_type_) {
if (topic_type_ != nullptr) {
*topic_type_ = cbuf;
if(topic_type_len_) *topic_type_len_ = static_cast<int>(topic_type_s.size());
if(topic_type_len_ != nullptr) *topic_type_len_ = static_cast<int>(topic_type_s.size());
}
else {
// free allocated memory:
ecal_free_mem(cbuf);
if (topic_type_len_) *topic_type_len_ = 0;
if (topic_type_len_ != nullptr) *topic_type_len_ = 0;
ret = false;
}
}
Expand All @@ -186,14 +186,14 @@ ECAL_API bool ecal_get_description(const char* topic_name_, const char** topic_d
char* cbuf = str_malloc(topic_desc_s);
if(cbuf == nullptr) return(false);

if (topic_desc_) {
if (topic_desc_ != nullptr) {
*topic_desc_ = cbuf;
if (topic_desc_len_) *topic_desc_len_ = static_cast<int>(topic_desc_s.size());
if (topic_desc_len_ != nullptr) *topic_desc_len_ = static_cast<int>(topic_desc_s.size());
}
else {
// free allocated memory:
ecal_free_mem(cbuf);
if (topic_desc_len_) *topic_desc_len_ = 0;
if (topic_desc_len_ != nullptr) *topic_desc_len_ = 0;
ret = false;
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ ECAL_API ECAL_HANDLE pub_create(const char* topic_name_, const char* topic_type_
ECAL_API bool pub_destroy(ECAL_HANDLE handle_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if(pub)
if(pub != nullptr)
{
delete pub;
pub = nullptr;
Expand All @@ -263,7 +263,7 @@ ECAL_API bool pub_destroy(ECAL_HANDLE handle_)
ECAL_API bool pub_set_type_name(ECAL_HANDLE handle_, const char* topic_type_name_, const int topic_type_name_length_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if (pub)
if (pub != nullptr)
{
return(pub->SetTypeName(std::string(topic_type_name_, static_cast<size_t>(topic_type_name_length_))));
}
Expand All @@ -276,7 +276,7 @@ ECAL_API bool pub_set_type_name(ECAL_HANDLE handle_, const char* topic_type_name
ECAL_API bool pub_set_description(ECAL_HANDLE handle_, const char* topic_desc_, const int topic_desc_length_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if(pub)
if(pub != nullptr)
{
return(pub->SetDescription(std::string(topic_desc_, static_cast<size_t>(topic_desc_length_))));
}
Expand All @@ -288,7 +288,7 @@ ECAL_API bool pub_set_description(ECAL_HANDLE handle_, const char* topic_desc_,
/****************************************/
ECAL_API bool pub_set_qos(ECAL_HANDLE handle_, struct SWriterQOSC qos_) //-V813
{
int ret = eCAL_Pub_SetQOS(handle_, qos_);
const int ret = eCAL_Pub_SetQOS(handle_, qos_);
return(ret == 0);
}

Expand All @@ -297,7 +297,7 @@ ECAL_API bool pub_set_qos(ECAL_HANDLE handle_, struct SWriterQOSC qos_) //-V813
/****************************************/
ECAL_API bool pub_get_qos(ECAL_HANDLE handle_, struct SWriterQOSC* qos_)
{
int ret = eCAL_Pub_GetQOS(handle_, qos_);
const int ret = eCAL_Pub_GetQOS(handle_, qos_);
return(ret == 0);
}

Expand All @@ -307,7 +307,7 @@ ECAL_API bool pub_get_qos(ECAL_HANDLE handle_, struct SWriterQOSC* qos_)
ECAL_API bool pub_set_layer_mode(ECAL_HANDLE handle_, const int layer_, const int mode_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if(pub)
if(pub != nullptr)
{
return(pub->SetLayerMode(eCAL::TLayer::eTransportLayer(layer_), eCAL::TLayer::eSendMode(mode_)));
}
Expand All @@ -320,7 +320,7 @@ ECAL_API bool pub_set_layer_mode(ECAL_HANDLE handle_, const int layer_, const in
ECAL_API bool pub_set_max_bandwidth_udp(ECAL_HANDLE handle_, long bandwidth_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if (pub)
if (pub != nullptr)
{
return(pub->SetMaxBandwidthUDP(bandwidth_));
}
Expand All @@ -333,7 +333,7 @@ ECAL_API bool pub_set_max_bandwidth_udp(ECAL_HANDLE handle_, long bandwidth_)
ECAL_API int pub_send(ECAL_HANDLE handle_, const char* payload_, const int length_, const long long time_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if(pub)
if(pub != nullptr)
{
const size_t ret = pub->Send(payload_, static_cast<size_t>(length_), time_);
if(static_cast<int>(ret) == length_)
Expand All @@ -350,7 +350,7 @@ ECAL_API int pub_send(ECAL_HANDLE handle_, const char* payload_, const int lengt
ECAL_API int pub_send_sync(ECAL_HANDLE handle_, const char* payload_, const int length_, const long long time_, const long long acknowledge_timeout_ms_)
{
eCAL::CPublisher* pub = static_cast<eCAL::CPublisher*>(handle_);
if (pub)
if (pub != nullptr)
{
const size_t ret = pub->Send(payload_, static_cast<size_t>(length_), time_, acknowledge_timeout_ms_);
if (static_cast<int>(ret) == length_)
Expand Down Expand Up @@ -417,7 +417,7 @@ ECAL_API ECAL_HANDLE sub_create(const char* topic_name_, const char* topic_type_
ECAL_API bool sub_destroy(ECAL_HANDLE handle_)
{
eCAL::CSubscriber* sub = static_cast<eCAL::CSubscriber*>(handle_);
if(sub)
if(sub != nullptr)
{
delete sub;
sub = nullptr;
Expand Down Expand Up @@ -450,7 +450,7 @@ ECAL_API bool sub_get_qos(ECAL_HANDLE handle_, struct SReaderQOSC* qos_)
ECAL_API int sub_receive(ECAL_HANDLE handle_, const char** rcv_buf_, int* rcv_buf_len_, long long* rcv_time_, const int timeout_)
{
eCAL::CSubscriber* sub = static_cast<eCAL::CSubscriber*>(handle_);
if(sub)
if(sub != nullptr)
{
std::string rcv_buf;
long long rcv_time = 0;
Expand All @@ -462,19 +462,19 @@ ECAL_API int sub_receive(ECAL_HANDLE handle_, const char** rcv_buf_, int* rcv_bu
char* cbuf = str_malloc(rcv_buf);
if(cbuf == nullptr) return(0);

if (rcv_buf_) {
if (rcv_buf_ != nullptr) {
*rcv_buf_ = cbuf;
if (rcv_buf_len_) *rcv_buf_len_ = static_cast<int>(rcv_buf.size());
if (rcv_buf_len_ != nullptr) *rcv_buf_len_ = static_cast<int>(rcv_buf.size());
}
else {
// free allocated memory:
ecal_free_mem(cbuf);
if (rcv_buf_len_) *rcv_buf_len_ = 0;
if (rcv_buf_len_ != nullptr) *rcv_buf_len_ = 0;
// operation could't be completed successfully
return(0);
}

if(rcv_time_) *rcv_time_ = rcv_time;
if(rcv_time_ != nullptr) *rcv_time_ = rcv_time;

return(static_cast<int>(rcv_buf.size()));
}
Expand All @@ -488,7 +488,7 @@ ECAL_API int sub_receive(ECAL_HANDLE handle_, const char** rcv_buf_, int* rcv_bu
ECAL_API bool sub_receive_buffer(ECAL_HANDLE handle_, const char** rcv_buf_, int* rcv_buf_len_, long long* rcv_time_, const int timeout_)
{
eCAL::CSubscriber* sub = static_cast<eCAL::CSubscriber*>(handle_);
if (sub)
if (sub != nullptr)
{
std::string rcv_buf;
long long rcv_time = 0;
Expand All @@ -497,20 +497,20 @@ ECAL_API bool sub_receive_buffer(ECAL_HANDLE handle_, const char** rcv_buf_, int
{
// this has to be freed by caller (ecal_free_mem)
char* cbuf = str_malloc(rcv_buf);
if (cbuf == nullptr) return(0);
if (cbuf == nullptr) return(false);

if (rcv_buf_) {
if (rcv_buf_ != nullptr) {
*rcv_buf_ = cbuf;
if (rcv_buf_len_) *rcv_buf_len_ = static_cast<int>(rcv_buf.size());
if (rcv_buf_len_ != nullptr) *rcv_buf_len_ = static_cast<int>(rcv_buf.size());
}
else {
// free allocated memory:
ecal_free_mem(cbuf);
if (rcv_buf_len_) *rcv_buf_len_ = 0;
if (rcv_buf_len_ != nullptr) *rcv_buf_len_ = 0;
// operation couldn't be completed successfullly.
return(false);
}
if (rcv_time_) *rcv_time_ = rcv_time;
if (rcv_time_ != nullptr) *rcv_time_ = rcv_time;

return(true);
}
Expand Down Expand Up @@ -617,7 +617,7 @@ ECAL_API ECAL_HANDLE dyn_json_sub_create(const char* topic_name_)
ECAL_API bool dyn_json_sub_destroy(ECAL_HANDLE handle_)
{
eCAL::protobuf::CDynamicJSONSubscriber* sub = static_cast<eCAL::protobuf::CDynamicJSONSubscriber*>(handle_);
if (sub)
if (sub != nullptr)
{
delete sub;
sub = nullptr;
Expand Down Expand Up @@ -681,7 +681,7 @@ ECAL_API ECAL_HANDLE server_create(const char* service_name_)
ECAL_API bool server_destroy(ECAL_HANDLE handle_)
{
eCAL::CServiceServer* server = static_cast<eCAL::CServiceServer*>(handle_);
if (server)
if (server != nullptr)
{
delete server;
server = nullptr;
Expand Down Expand Up @@ -710,7 +710,7 @@ static int g_server_method_callback(const std::string& method_, const std::strin
ECAL_API bool server_add_method_callback(ECAL_HANDLE handle_, const char* method_name_, const char* req_type_, const char* resp_type_, const MethodCallbackCT callback_, void* par_)
{
eCAL::CServiceServer* server = static_cast<eCAL::CServiceServer*>(handle_);
if (server)
if (server != nullptr)
{
auto callback = std::bind(g_server_method_callback, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, callback_, par_);
return(server->AddMethodCallback(method_name_, req_type_, resp_type_, callback));
Expand All @@ -727,7 +727,7 @@ ECAL_API bool server_add_method_callback(ECAL_HANDLE handle_, const char* metho
ECAL_API bool server_rem_method_callback(ECAL_HANDLE handle_, const char* method_name_)
{
eCAL::CServiceServer* server = static_cast<eCAL::CServiceServer*>(handle_);
if (server)
if (server != nullptr)
{
return(server->RemMethodCallback(method_name_));
}
Expand Down Expand Up @@ -758,7 +758,7 @@ ECAL_API ECAL_HANDLE client_create(const char* service_name_)
ECAL_API bool client_destroy(ECAL_HANDLE handle_)
{
eCAL::CServiceClient* client = static_cast<eCAL::CServiceClient*>(handle_);
if (client)
if (client != nullptr)
{
delete client;
client = nullptr;
Expand All @@ -776,7 +776,7 @@ ECAL_API bool client_destroy(ECAL_HANDLE handle_)
ECAL_API bool client_set_hostname(ECAL_HANDLE handle_, const char* host_name_)
{
eCAL::CServiceClient* client = static_cast<eCAL::CServiceClient*>(handle_);
if (client)
if (client != nullptr)
{
return(client->SetHostName(host_name_));
}
Expand All @@ -792,7 +792,7 @@ ECAL_API bool client_set_hostname(ECAL_HANDLE handle_, const char* host_name_)
ECAL_API bool client_call_method(ECAL_HANDLE handle_, const char* method_name_, const char* request_, const int request_len_, const int timeout_)
{
eCAL::CServiceClient* client = static_cast<eCAL::CServiceClient*>(handle_);
if (client)
if (client != nullptr)
{
std::string request(request_, request_len_);
return(client->Call(method_name_, request, timeout_));
Expand All @@ -809,7 +809,7 @@ ECAL_API bool client_call_method(ECAL_HANDLE handle_, const char* method_name_,
ECAL_API bool client_call_method_async(ECAL_HANDLE handle_, const char* method_name_, const char* request_, const int request_len_, const int timeout_)
{
eCAL::CServiceClient* client = static_cast<eCAL::CServiceClient*>(handle_);
if (client)
if (client != nullptr)
{
std::string request(request_, request_len_);
return(client->CallAsync(method_name_, request, timeout_));
Expand Down Expand Up @@ -882,15 +882,15 @@ ECAL_API int mon_get_monitoring(const char** mon_buf_, int* mon_buf_len_)
char* cbuf = str_malloc(mon_s);
if(cbuf == nullptr) return(0);

if (mon_buf_) {
if (mon_buf_ != nullptr) {
*mon_buf_ = cbuf;
if (mon_buf_len_) *mon_buf_len_ = static_cast<int>(mon_s.size());
if (mon_buf_len_ != nullptr) *mon_buf_len_ = static_cast<int>(mon_s.size());
}
else
{
// free allocated memory:
ecal_free_mem(cbuf);
if (mon_buf_len_) *mon_buf_len_ = 0;
if (mon_buf_len_ != nullptr) *mon_buf_len_ = 0;
// operation could't be completed successfully
return(0);
}
Expand All @@ -915,14 +915,14 @@ ECAL_API int mon_get_logging(const char** log_buf_, int* log_buf_len_)
char* cbuf = str_malloc(log_s);
if(cbuf == nullptr) return(0);

if (log_buf_) {
if (log_buf_ != nullptr) {
*log_buf_ = cbuf;
if (log_buf_len_) *log_buf_len_ = static_cast<int>(log_s.size());
if (log_buf_len_ != nullptr) *log_buf_len_ = static_cast<int>(log_s.size());
}
else {
// free allocated memory:
ecal_free_mem(cbuf);
if (log_buf_len_) *log_buf_len_ = 0;
if (log_buf_len_ != nullptr) *log_buf_len_ = 0;
// operation couldn't be completed successfullly.
return(0);
}
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/ecal_descgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <ecal/ecal_config.h>

#include "ecal_descgate.h"
#include <assert.h>
#include <cassert>
#include <algorithm>
#include <mutex>

Expand Down
6 changes: 3 additions & 3 deletions ecal/core/src/ecal_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ namespace eCAL

bool gCloseEvent(const EventHandleT& event_)
{
if(!event_.handle) return(false);
if(event_.handle == nullptr) return(false);
return(::CloseHandle(event_.handle) != 0);
}

bool gSetEvent(const EventHandleT& event_)
{
if(!event_.handle) return(false);
if(event_.handle == nullptr) return(false);
return(::SetEvent(event_.handle) != 0);
}

bool gWaitForEvent(const EventHandleT& event_, const long timeout_)
{
if(!event_.handle) return(false);
if(event_.handle == nullptr) return(false);
if(timeout_ < 0)
{
return(::WaitForSingleObject(event_.handle, INFINITE) == WAIT_OBJECT_0);
Expand Down
Loading
Loading