This class stores all the information about a publisher. It stores the topic name that publishes, addresses, UUIDs, scope, etc. More...
#include <Publisher.hh>
Public Member Functions | |
Publisher ()=default | |
Default constructor. | |
Publisher (const Publisher &_other) | |
Copy constructor. | |
Publisher (const std::string &_topic, const std::string &_addr, const std::string &_pUuid, const std::string &_nUuid, const AdvertiseOptions &_opts) | |
Constructor. | |
virtual | ~Publisher ()=default |
Destructor. | |
std::string | Addr () const |
Get the ZeroMQ address of the publisher. | |
virtual size_t | MsgLength () const |
Get the total length of the message. | |
std::string | NUuid () const |
Get the node UUID of the publisher. | |
bool | operator!= (const Publisher &_pub) const |
Inequality operator. This function checks if the given publisher does not have identical Topic, Addr, PUuid, NUuid, and Scope strings to this object. | |
Publisher & | operator= (const Publisher &_other) |
Assignment operator. | |
bool | operator== (const Publisher &_pub) const |
Equality operator. This function checks if the given publisher has identical Topic, Addr, PUuid, NUuid, and Scope strings to this object. | |
virtual const AdvertiseOptions & | Options () const |
Get the advertised options. | |
virtual size_t | Pack (char *_buffer) const |
Serialize the publisher. The caller has ownership of the buffer and is responsible for its [de]allocation. | |
std::string | PUuid () const |
Get the process UUID of the publisher. return Process UUID. | |
void | SetAddr (const std::string &_addr) |
Set ZeroMQ address of the publisher. | |
void | SetNUuid (const std::string &_nUuid) |
Set the node UUID of the publisher. | |
void | SetOptions (const AdvertiseOptions &_opts) |
Set the advertised options. | |
void | SetPUuid (const std::string &_pUuid) |
Set the process UUID of the publisher. | |
void | SetTopic (const std::string &_topic) |
Set the topic name published by this publisher. | |
std::string | Topic () const |
Get the topic published by this publisher. | |
virtual size_t | Unpack (const char *_buffer) |
Unserialize the publisher. | |
Protected Member Functions | |
size_t | MsgLengthInternal () const |
Get the total length of the message without counting the advertised options. This is useful when [un]serializing a derived publisher because we want to ignore the advertised options in the base publisher. | |
size_t | PackInternal (char *_buffer) const |
Serialize all fields except the advertise options. This is useful when we are serializing a derived class that contains its own advertise options. | |
size_t | UnpackInternal (const char *_buffer) |
Unserialize all fields except the advertise options. This is useful when we are unserializing a derived class that contains its own advertise options. | |
Protected Attributes | |
std::string | addr |
ZeroMQ address of the publisher. | |
std::string | nUuid |
Node UUID of the publisher. | |
std::string | pUuid |
Process UUID of the publisher. | |
std::string | topic |
Topic name. | |
Detailed Description
This class stores all the information about a publisher. It stores the topic name that publishes, addresses, UUIDs, scope, etc.
Constructor & Destructor Documentation
◆ Publisher() [1/3]
|
default |
Default constructor.
Referenced by Publisher(), operator!=(), operator<<, operator=(), and operator==().
◆ Publisher() [2/3]
Publisher | ( | const std::string & | _topic, |
const std::string & | _addr, | ||
const std::string & | _pUuid, | ||
const std::string & | _nUuid, | ||
const AdvertiseOptions & | _opts ) |
Constructor.
- Parameters
-
[in] _topic Topic name. [in] _addr ZeroMQ address. [in] _pUuid Process UUID. [in] _nUUID node UUID. [in] _opts The advertise options.
References ignition::transport::_topic.
◆ Publisher() [3/3]
◆ ~Publisher()
|
virtualdefault |
Destructor.
Member Function Documentation
◆ Addr()
std::string Addr | ( | ) | const |
Get the ZeroMQ address of the publisher.
- Returns
- ZeroMQ address.
- See also
- SetAddr.
Referenced by MessagePublisher::operator<<, operator<<, and ServicePublisher::operator<<.
◆ MsgLength()
|
virtual |
Get the total length of the message.
- Returns
- Return the length of the message in bytes.
Reimplemented in MessagePublisher, and ServicePublisher.
◆ MsgLengthInternal()
|
protected |
Get the total length of the message without counting the advertised options. This is useful when [un]serializing a derived publisher because we want to ignore the advertised options in the base publisher.
- Returns
- Return the length of the message in bytes.
◆ NUuid()
std::string NUuid | ( | ) | const |
Get the node UUID of the publisher.
- Returns
- Node UUID.
- See also
- SetNUuid.
Referenced by MessagePublisher::operator<<, operator<<, and ServicePublisher::operator<<.
◆ operator!=()
bool operator!= | ( | const Publisher & | _pub | ) | const |
Inequality operator. This function checks if the given publisher does not have identical Topic, Addr, PUuid, NUuid, and Scope strings to this object.
- Parameters
-
[in] _pub The publisher to compare against.
- Returns
- True if this object does not match the provided object.
References Publisher().
◆ operator=()
Assignment operator.
- Parameters
-
[in] _other The other Publisher.
- Returns
- A reference to this instance.
References Publisher().
◆ operator==()
bool operator== | ( | const Publisher & | _pub | ) | const |
Equality operator. This function checks if the given publisher has identical Topic, Addr, PUuid, NUuid, and Scope strings to this object.
- Parameters
-
[in] _pub The publisher to compare against.
- Returns
- True if this object matches the provided object.
References Publisher().
◆ Options()
|
virtual |
Get the advertised options.
- Returns
- The advertised options.
- See also
- SetOptions.
Reimplemented in MessagePublisher, and ServicePublisher.
Referenced by operator<<.
◆ Pack()
|
virtual |
Serialize the publisher. The caller has ownership of the buffer and is responsible for its [de]allocation.
- Parameters
-
[out] _buffer Destination buffer in which the publisher will be serialized.
- Returns
- Number of bytes serialized.
Reimplemented in MessagePublisher, and ServicePublisher.
◆ PackInternal()
|
protected |
Serialize all fields except the advertise options. This is useful when we are serializing a derived class that contains its own advertise options.
◆ PUuid()
std::string PUuid | ( | ) | const |
Get the process UUID of the publisher. return Process UUID.
- See also
- SetPUuid.
Referenced by MessagePublisher::operator<<, operator<<, and ServicePublisher::operator<<.
◆ SetAddr()
void SetAddr | ( | const std::string & | _addr | ) |
◆ SetNUuid()
void SetNUuid | ( | const std::string & | _nUuid | ) |
◆ SetOptions()
void SetOptions | ( | const AdvertiseOptions & | _opts | ) |
◆ SetPUuid()
void SetPUuid | ( | const std::string & | _pUuid | ) |
◆ SetTopic()
void SetTopic | ( | const std::string & | _topic | ) |
Set the topic name published by this publisher.
- Parameters
-
[in] _topic New topic name.
- See also
- Topic.
References ignition::transport::_topic.
◆ Topic()
std::string Topic | ( | ) | const |
Get the topic published by this publisher.
- Returns
- Topic name.
- See also
- SetTopic.
Referenced by MessagePublisher::operator<<, operator<<, and ServicePublisher::operator<<.
◆ Unpack()
|
virtual |
Unserialize the publisher.
- Parameters
-
[in] _buffer Input buffer with the data to be unserialized.
Reimplemented in MessagePublisher, and ServicePublisher.
◆ UnpackInternal()
|
protected |
Unserialize all fields except the advertise options. This is useful when we are unserializing a derived class that contains its own advertise options.
Member Data Documentation
◆ addr
|
protected |
ZeroMQ address of the publisher.
◆ nUuid
|
protected |
Node UUID of the publisher.
◆ pUuid
|
protected |
Process UUID of the publisher.
◆ topic
|
protected |
Topic name.
The documentation for this class was generated from the following file: