Skip to content

Commit

Permalink
ecal pub/sub clang-tidy changed (virtual functions) partly reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Feb 9, 2024
1 parent 6cf09d8 commit 24731f4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 35 deletions.
8 changes: 4 additions & 4 deletions src/core/include/ecal/ecal_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
ECAL_API virtual bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_);
ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_);

/**
* @brief Creates this object.
Expand All @@ -134,14 +134,14 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
ECAL_API virtual bool Create(const std::string& topic_name_);
ECAL_API bool Create(const std::string& topic_name_);

/**
* @brief Destroys this object.
*
* @return True if it succeeds, false if it fails.
**/
ECAL_API virtual bool Destroy();
ECAL_API bool Destroy();

/**
* @brief Setup topic information.
Expand Down Expand Up @@ -282,7 +282,7 @@ namespace eCAL
*
* @return The topic information.
**/
ECAL_API virtual SDataTypeInformation GetDataTypeInformation() const;
ECAL_API SDataTypeInformation GetDataTypeInformation() const;

/**
* @brief Dump the whole class state into a string.
Expand Down
10 changes: 5 additions & 5 deletions src/core/include/ecal/ecal_subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
ECAL_API virtual bool Create(const std::string& topic_name_);
ECAL_API bool Create(const std::string& topic_name_);

/**
* @brief Creates this object.
Expand All @@ -146,14 +146,14 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
ECAL_API virtual bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_);
ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_);

/**
* @brief Destroys this object.
*
* @return true if it succeeds, false if it fails.
**/
ECAL_API virtual bool Destroy();
ECAL_API bool Destroy();

/**
* @brief Set a set of id's to prefiltering topics (see CPublisher::SetID).
Expand Down Expand Up @@ -209,7 +209,7 @@ namespace eCAL
*
* @return True if succeeded, false if not.
**/
ECAL_API virtual bool RemReceiveCallback();
ECAL_API bool RemReceiveCallback();

/**
* @brief Add callback function for subscriber events.
Expand Down Expand Up @@ -256,7 +256,7 @@ namespace eCAL
*
* @return The topic information.
**/
ECAL_API virtual SDataTypeInformation GetDataTypeInformation() const;
ECAL_API SDataTypeInformation GetDataTypeInformation() const;

/**
* @brief Dump the whole class state into a string.
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/ecal/msg/dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace eCAL
class DynamicReflectionException : public std::exception
{
public:
explicit DynamicReflectionException(const std::string& message) : message_(message) {}
const char* what() const noexcept override { return message_.c_str(); }
DynamicReflectionException(const std::string& message) : message_(message) {}
virtual const char* what() const throw() { return message_.c_str(); }
private:
std::string message_;
};
Expand Down
18 changes: 9 additions & 9 deletions src/core/include/ecal/msg/protobuf/ecal_proto_dyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace eCAL
*
* @return true if succeeded otherwise false (details see error_s_)
**/
static bool GetFileDescriptorFromString(const std::string& proto_string_, google::protobuf::FileDescriptorProto* file_desc_proto_, std::string& error_s_);
bool GetFileDescriptorFromString(const std::string& proto_string_, google::protobuf::FileDescriptorProto* file_desc_proto_, std::string& error_s_);

protected:
google::protobuf::DescriptorPool m_descriptor_pool;
Expand All @@ -180,23 +180,23 @@ namespace eCAL
class ParserErrorCollector : public google::protobuf::io::ErrorCollector
{
public:
ParserErrorCollector() = default;
~ParserErrorCollector() override = default;
ParserErrorCollector() {}
~ParserErrorCollector() {}

std::string Get() { return (m_ss.str()); }

// Indicates that there was an error in the input at the given line and
// column numbers. The numbers are zero-based, so you may want to add
// 1 to each before printing them.
void AddError(int line_, int column_, const std::string& msg_) override
void AddError(int line_, int column_, const std::string& msg_)
{
Add(line_, column_, "ERROR: " + msg_);
}

// Indicates that there was a warning in the input at the given line and
// column numbers. The numbers are zero-based, so you may want to add
// 1 to each before printing them.
void AddWarning(int line_, int column_, const std::string& msg_) override
void AddWarning(int line_, int column_, const std::string& msg_)
{
Add(line_, column_, "WARNING: " + msg_);
}
Expand All @@ -213,8 +213,8 @@ namespace eCAL
class DescriptorErrorCollector : public google::protobuf::DescriptorPool::ErrorCollector
{
public:
DescriptorErrorCollector() = default;
~DescriptorErrorCollector() override = default;
DescriptorErrorCollector() {}
~DescriptorErrorCollector() {}

std::string Get() { return (m_ss.str()); }

Expand All @@ -224,7 +224,7 @@ namespace eCAL
const google::protobuf::Message* descriptor, // Descriptor of the erroneous element.
ErrorLocation location, // One of the location constants, above.
const std::string& message // Human-readable error message.
) override
)
{
Add(filename, element_name, descriptor, location, "ERROR: " + message);
}
Expand All @@ -235,7 +235,7 @@ namespace eCAL
const google::protobuf::Message* descriptor, // Descriptor of the erroneous element.
ErrorLocation location, // One of the location constants, above.
const std::string& message // Human-readable error message.
) override
)
{
Add(filename, element_name, descriptor, location, "WARNING: " + message);
}
Expand Down
7 changes: 4 additions & 3 deletions src/core/include/ecal/msg/protobuf/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ namespace eCAL
}

size_t GetSize() override {
size_t size(0);
#if GOOGLE_PROTOBUF_VERSION >= 3001000
auto size = static_cast<size_t>(message.ByteSizeLong());
size = static_cast<size_t>(message.ByteSizeLong());
#else
auto size = static_cast<size_t>(message.ByteSize());
size = static_cast<size_t>(message.ByteSize());
#endif
return(size);
};
Expand Down Expand Up @@ -142,7 +143,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_) override
bool Create(const std::string& topic_name_)
{
return(eCAL::CPublisher::Create(topic_name_, GetDataTypeInformation()));
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/ecal/msg/protobuf/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace eCAL
*
* @param service_ Google protobuf service instance.
**/
explicit CServiceServer(std::shared_ptr<T> service_) : m_service(nullptr)
CServiceServer(std::shared_ptr<T> service_) : m_service(nullptr)
{
Create(service_);
}
Expand All @@ -86,7 +86,7 @@ namespace eCAL
/**
* @brief Destructor.
**/
~CServiceServer() override
~CServiceServer()
{
Destroy();
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/include/ecal/msg/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_) override
bool Create(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_)
{
return(CPublisher::Create(topic_name_, topic_info_));
}
Expand All @@ -116,7 +116,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool Destroy() override
bool Destroy()
{
return(CPublisher::Destroy());
}
Expand Down Expand Up @@ -163,7 +163,7 @@ namespace eCAL

protected:
// We cannot make it pure virtual, as it would break a bunch of implementations, who are not (yet) implementing this function
struct SDataTypeInformation GetDataTypeInformation() const override { return SDataTypeInformation{}; }
virtual struct SDataTypeInformation GetDataTypeInformation() const { return SDataTypeInformation{}; }
private:
virtual size_t GetSize(const T& msg_) const = 0;
virtual bool Serialize(const T& msg_, char* buffer_, size_t size_) const = 0;
Expand Down
14 changes: 7 additions & 7 deletions src/core/include/ecal/msg/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace eCAL
{
}

~CMsgSubscriber() override = default;
virtual ~CMsgSubscriber() = default;

/**
* @brief Copy Constructor is not available.
Expand All @@ -79,7 +79,7 @@ namespace eCAL
/**
* @brief Move Constructor
**/
CMsgSubscriber(CMsgSubscriber&& rhs) noexcept
CMsgSubscriber(CMsgSubscriber&& rhs)
: CSubscriber(std::move(rhs))
, m_cb_callback(std::move(rhs.m_cb_callback))
{
Expand All @@ -97,7 +97,7 @@ namespace eCAL
/**
* @brief Move assignment
**/
CMsgSubscriber& operator=(CMsgSubscriber&& rhs) noexcept
CMsgSubscriber& operator=(CMsgSubscriber&& rhs)
{
CSubscriber::operator=(std::move(rhs));

Expand All @@ -123,7 +123,7 @@ namespace eCAL
*
* @return true if it succeeds, false if it fails.
**/
bool Create(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_) override
bool Create(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_)
{
return(CSubscriber::Create(topic_name_, topic_info_));
}
Expand All @@ -133,7 +133,7 @@ namespace eCAL
*
* @return true if it succeeds, false if it fails.
**/
bool Destroy() override
bool Destroy()
{
RemReceiveCallback();
return(CSubscriber::Destroy());
Expand Down Expand Up @@ -193,7 +193,7 @@ namespace eCAL
*
* @return True if it succeeds, false if it fails.
**/
bool RemReceiveCallback() override
bool RemReceiveCallback()
{
bool ret = CSubscriber::RemReceiveCallback();

Expand All @@ -205,7 +205,7 @@ namespace eCAL

protected:
// We cannot make it pure virtual, as it would break a bunch of implementations, who are not (yet) implementing this function
struct SDataTypeInformation GetDataTypeInformation() const override { return SDataTypeInformation{}; }
virtual struct SDataTypeInformation GetDataTypeInformation() const { return SDataTypeInformation{}; }
virtual bool Deserialize(T& msg_, const void* buffer_, size_t size_) const = 0;

private:
Expand Down

0 comments on commit 24731f4

Please sign in to comment.