Skip to content

Commit

Permalink
Remove unnecessary copy and assignment operators (#240)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll authored Apr 30, 2021
1 parent 1135166 commit 753c3ac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
22 changes: 0 additions & 22 deletions include/ignition/transport/Publisher.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ namespace ignition
const std::string &_nUuid,
const AdvertiseOptions &_opts);

/// \brief Copy constructor.
/// \param[in] _other Other Publisher object.
public: Publisher(const Publisher &_other);

/// \brief Destructor.
public: virtual ~Publisher() = default;

Expand Down Expand Up @@ -137,11 +133,6 @@ namespace ignition
/// \return True if this object does not match the provided object.
public: bool operator!=(const Publisher &_pub) const;

/// \brief Assignment operator.
/// \param[in] _other The other Publisher.
/// \return A reference to this instance.
public: Publisher &operator=(const Publisher &_other);

/// \brief Stream insertion operator.
/// \param[out] _out The output stream.
/// \param[in] _msg Publisher to write to the stream.
Expand Down Expand Up @@ -208,10 +199,6 @@ namespace ignition
const std::string &_msgTypeName,
const AdvertiseMessageOptions &_opts);

/// \brief Copy constructor.
/// \param[in] _other Other MessagePublisher object.
public: MessagePublisher(const MessagePublisher &_other);

/// \brief Destructor.
public: virtual ~MessagePublisher() = default;

Expand Down Expand Up @@ -284,11 +271,6 @@ namespace ignition
/// \return True if this object does not match the provided object.
public: bool operator!=(const MessagePublisher &_pub) const;

/// \brief Assignment operator.
/// \param[in] _other The other MessagePublisher.
/// \return A reference to this instance.
public: MessagePublisher &operator=(const MessagePublisher &_other);

#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::unique_ptr
Expand Down Expand Up @@ -334,10 +316,6 @@ namespace ignition
const std::string &_repType,
const AdvertiseServiceOptions &_opts);

/// \brief Copy constructor.
/// \param[in] _other Other ServicePublisher object.
public: ServicePublisher(const ServicePublisher &_other);

/// \brief Destructor.
public: virtual ~ServicePublisher() = default;

Expand Down
41 changes: 0 additions & 41 deletions src/Publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ Publisher::Publisher(const std::string &_topic, const std::string &_addr,
{
}

//////////////////////////////////////////////////
Publisher::Publisher(const Publisher &_other)
: Publisher()
{
(*this) = _other;
}

//////////////////////////////////////////////////
std::string Publisher::Topic() const
{
Expand Down Expand Up @@ -169,17 +162,6 @@ bool Publisher::operator!=(const Publisher &_pub) const
return !(*this == _pub);
}

//////////////////////////////////////////////////
Publisher &Publisher::operator=(const Publisher &_other)
{
this->SetTopic(_other.Topic());
this->SetAddr(_other.Addr());
this->SetPUuid(_other.PUuid());
this->SetNUuid(_other.NUuid());
this->SetOptions(_other.Options());
return *this;
}

//////////////////////////////////////////////////
MessagePublisher::MessagePublisher(const std::string &_topic,
const std::string &_addr, const std::string &_ctrl, const std::string &_pUuid,
Expand All @@ -192,13 +174,6 @@ MessagePublisher::MessagePublisher(const std::string &_topic,
{
}

//////////////////////////////////////////////////
MessagePublisher::MessagePublisher(const MessagePublisher &_other)
: MessagePublisher()
{
(*this) = _other;
}

//////////////////////////////////////////////////
std::string MessagePublisher::Ctrl() const
{
Expand Down Expand Up @@ -275,16 +250,6 @@ bool MessagePublisher::operator!=(const MessagePublisher &_pub) const
return !(*this == _pub);
}

//////////////////////////////////////////////////
MessagePublisher &MessagePublisher::operator=(const MessagePublisher &_other)
{
Publisher::operator=(_other);
this->SetCtrl(_other.Ctrl());
this->SetMsgTypeName(_other.MsgTypeName());
this->SetOptions(_other.Options());
return *this;
}

//////////////////////////////////////////////////
ServicePublisher::ServicePublisher(const std::string &_topic,
const std::string &_addr, const std::string &_socketId,
Expand All @@ -299,12 +264,6 @@ ServicePublisher::ServicePublisher(const std::string &_topic,
{
}

//////////////////////////////////////////////////
ServicePublisher::ServicePublisher(const ServicePublisher &_other)
: ServicePublisher()
{
(*this) = _other;
}

//////////////////////////////////////////////////
std::string ServicePublisher::SocketId() const
Expand Down

0 comments on commit 753c3ac

Please sign in to comment.