Skip to content

Commit

Permalink
Merge branch 'ign-transport10' into jrivero/fix_post_4_3_1_check
Browse files Browse the repository at this point in the history
  • Loading branch information
chapulina authored May 5, 2021
2 parents e993d68 + 699e712 commit bcf8485
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
5 changes: 5 additions & 0 deletions include/ignition/transport/Publisher.hh
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ namespace ignition
/// \return True if this object does not match the provided object.
public: bool operator!=(const ServicePublisher &_srv) const;

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

#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::string
Expand Down
40 changes: 9 additions & 31 deletions src/Publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ Publisher::Publisher(const std::string &_topic, const std::string &_addr,
}

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

//////////////////////////////////////////////////
std::string Publisher::Topic() const
Expand Down Expand Up @@ -170,15 +166,7 @@ bool Publisher::operator!=(const Publisher &_pub) const
}

//////////////////////////////////////////////////
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;
}
Publisher &Publisher::operator=(const Publisher &_other) = default;

//////////////////////////////////////////////////
MessagePublisher::MessagePublisher(const std::string &_topic,
Expand All @@ -193,11 +181,7 @@ MessagePublisher::MessagePublisher(const std::string &_topic,
}

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

//////////////////////////////////////////////////
std::string MessagePublisher::Ctrl() const
Expand Down Expand Up @@ -277,13 +261,7 @@ bool MessagePublisher::operator!=(const MessagePublisher &_pub) const

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

//////////////////////////////////////////////////
ServicePublisher::ServicePublisher(const std::string &_topic,
Expand All @@ -300,11 +278,7 @@ ServicePublisher::ServicePublisher(const std::string &_topic,
}

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

//////////////////////////////////////////////////
std::string ServicePublisher::SocketId() const
Expand Down Expand Up @@ -390,3 +364,7 @@ bool ServicePublisher::operator!=(const ServicePublisher &_srv) const
{
return !(*this == _srv);
}

//////////////////////////////////////////////////
ServicePublisher &ServicePublisher::operator=(const ServicePublisher &_other)
= default;

0 comments on commit bcf8485

Please sign in to comment.