Ignition Transport

API Reference

4.0.0
ServicePublisher Class Reference

This class stores all the information about a service publisher. More...

#include <Publisher.hh>

Public Member Functions

 ServicePublisher ()=default
 Default constructor.
 
 ServicePublisher (const ServicePublisher &_other)
 Copy constructor.
 
 ServicePublisher (const std::string &_topic, const std::string &_addr, const std::string &_id, const std::string &_pUuid, const std::string &_nUuid, const std::string &_reqType, const std::string &_repType, const AdvertiseServiceOptions &_opts)
 Constructor.
 
virtual ~ServicePublisher ()=default
 Destructor.
 
size_t MsgLength () const
 Get the total length of the message.
 
bool operator!= (const ServicePublisher &_srv) const
 Inequality operator. This function checks if the given service does not have identical Topic, Addr, PUuid, NUuid, Scope, SocketId, ReqTypeName, RepTypeName strings to this object.
 
bool operator== (const ServicePublisher &_srv) const
 Equality operator. This function checks if the given service has identical Topic, Addr, PUuid, NUuid, Scope, SocketId, ReqTypeName, RepTypeName strings to this object.
 
virtual const AdvertiseServiceOptions & Options () const
 Get the advertised options.
 
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 RepTypeName () const
 Get the name of the response's protobuf message advertised.
 
std::string ReqTypeName () const
 Get the name of the request's protobuf message advertised.
 
void SetOptions (const AdvertiseServiceOptions &_opts)
 Set the advertised options.
 
void SetRepTypeName (const std::string &_repTypeName)
 Set the name of the response's protobuf message advertised.
 
void SetReqTypeName (const std::string &_reqTypeName)
 Set the name of the request's protobuf message advertised.
 
void SetSocketId (const std::string &_socketId)
 Set the ZeroMQ socket ID for this publisher.
 
std::string SocketId () const
 Get the ZeroMQ socket ID used by this publisher.
 
size_t Unpack (const char *_buffer)
 Unserialize the publisher.
 
- Public Member Functions inherited from Publisher
 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.
 
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.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from Publisher
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 inherited from Publisher
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 service publisher.

ignition/transport/Publisher.hh

Constructor & Destructor Documentation

◆ ServicePublisher() [1/3]

ServicePublisher ( )
default

Default constructor.

◆ ServicePublisher() [2/3]

ServicePublisher ( const std::string & _topic,
const std::string & _addr,
const std::string & _id,
const std::string & _pUuid,
const std::string & _nUuid,
const std::string & _reqType,
const std::string & _repType,
const AdvertiseServiceOptions & _opts )

Constructor.

Parameters
[in]_topicTopic name.
[in]_addrZeroMQ address.
[in]_idZeroMQ socket ID.
[in]_pUuidProcess UUID.
[in]_nUUIDnode UUID.
[in]_reqTypeMessage type used in the service request.
[in]_repTypeMessage type used in the service response.
[in]_optsAdvertise options.

◆ ServicePublisher() [3/3]

Copy constructor.

Parameters
[in]_otherOther ServicePublisher object.

◆ ~ServicePublisher()

virtual ~ServicePublisher ( )
virtualdefault

Destructor.

Member Function Documentation

◆ MsgLength()

size_t MsgLength ( ) const
virtual

Get the total length of the message.

Returns
Return the length of the message in bytes.

Reimplemented from Publisher.

◆ operator!=()

bool operator!= ( const ServicePublisher & _srv) const

Inequality operator. This function checks if the given service does not have identical Topic, Addr, PUuid, NUuid, Scope, SocketId, ReqTypeName, RepTypeName strings to this object.

Parameters
[in]_srvThe service publisher to compare against.
Returns
True if this object does not match the provided object.

◆ operator==()

bool operator== ( const ServicePublisher & _srv) const

Equality operator. This function checks if the given service has identical Topic, Addr, PUuid, NUuid, Scope, SocketId, ReqTypeName, RepTypeName strings to this object.

Parameters
[in]_srvThe service publisher to compare against.
Returns
True if this object matches the provided object.

◆ Options()

virtual const AdvertiseServiceOptions & Options ( ) const
virtual

Get the advertised options.

Returns
The advertised options.
See also
SetOptions.

Reimplemented from Publisher.

◆ Pack()

size_t Pack ( char * _buffer) const
virtual

Serialize the publisher. The caller has ownership of the buffer and is responsible for its [de]allocation.

Parameters
[out]_bufferDestination buffer in which the publisher will be serialized.
Returns
Number of bytes serialized.

Reimplemented from Publisher.

◆ RepTypeName()

std::string RepTypeName ( ) const

Get the name of the response's protobuf message advertised.

Returns
The protobuf message type.
See also
SetRepTypeName.

◆ ReqTypeName()

std::string ReqTypeName ( ) const

Get the name of the request's protobuf message advertised.

Returns
The protobuf message type.
See also
SetReqTypeName.

◆ SetOptions()

void SetOptions ( const AdvertiseServiceOptions & _opts)

Set the advertised options.

Parameters
[in]_optsNew advertised options.
See also
Options.

◆ SetRepTypeName()

void SetRepTypeName ( const std::string & _repTypeName)

Set the name of the response's protobuf message advertised.

Parameters
[in]_repTypeNameThe protobuf message type.
See also
RepTypeName.

◆ SetReqTypeName()

void SetReqTypeName ( const std::string & _reqTypeName)

Set the name of the request's protobuf message advertised.

Parameters
[in]_reqTypeNameThe protobuf message type.
See also
ReqTypeName.

◆ SetSocketId()

void SetSocketId ( const std::string & _socketId)

Set the ZeroMQ socket ID for this publisher.

Parameters
[in]_socketIdNew socket ID.
See also
SocketId.

◆ SocketId()

std::string SocketId ( ) const

Get the ZeroMQ socket ID used by this publisher.

Returns
The socket ID.
See also
SetSocketId.

◆ Unpack()

size_t Unpack ( const char * _buffer)
virtual

Unserialize the publisher.

Parameters
[in]_bufferInput buffer with the data to be unserialized.

Reimplemented from Publisher.


The documentation for this class was generated from the following file: