A class for customizing the behavior of the Node. E.g.: Set a custom namespace or a partition name.
More...
#include <gz/transport/NodeOptions.hh>
|
| NodeOptions () |
| Constructor. More...
|
|
| NodeOptions (const NodeOptions &_other) |
| Copy constructor. More...
|
|
virtual | ~NodeOptions () |
| Destructor. More...
|
|
bool | AddTopicRemap (const std::string &_fromTopic, const std::string &_toTopic) |
| Add a new topic remapping. Any [Un]Advertise(), [Un]Subscribe() or Request() operation will check for topic remappings. If a topic is remapped, the '_fromTopic' topic will be renamed to '_toTopic' in any of the previous functions. Is not possible to add two remaps over the same '_fromTopic'. More...
|
|
const std::string & | NameSpace () const |
| Get the namespace used in this node. More...
|
|
NodeOptions & | operator= (const NodeOptions &_other) |
| Assignment operator. More...
|
|
const std::string & | Partition () const |
| Get the partition used in this node. More...
|
|
bool | SetNameSpace (const std::string &_ns) |
| Set the node's namespace. A namespace is considered a prefix that might be potentially applied to some of the topic/services advertised in a node. E.g.: Node1 sets a namespace 'ns1' and advertises the topics 't1', 't2' and '/t3'. '/t3' is considered an absolute topic (starts with '/') and it won't be affected by a namespace. However, 't1' and 't2' will be advertised as '/ns1/t1' and '/ns1/t2'. A namespace is any alphanumeric string with a few exceptions. The symbol '/' is allowed as part of a namespace but just '/' is not allowed. The symbols '@', '~' and ' ' are not allowed as part of a namespace. Two or more consecutive slashes ('//') are not allowed. More...
|
|
bool | SetPartition (const std::string &_partition) |
| Set the node's partition name. A partition is used to isolate a set of topics or services from other nodes that use the same names. E.g.: Node1 advertises topics '/foo' and Node2 advertises '/foo' too. If we don't use a partition, a node subscribed to '/foo' will receive the messages published from Node1 and Node2. Alternatively, we could specify 'p1' as a partition for Node1 and 'p2' as a partition for Node2. When we create the node for our subscriber, if we specify 'p1' as a partition name, we'll receive the messages published only by Node1. If we use 'p2', we'll only receive the messages published by Node2. If we don't set a partition name, we won't receive any messages from Node1 or Node2. A partition name is any alphanumeric string with a few exceptions. The symbol '/' is allowed as part of a partition name but just '/' is not allowed. The symbols '@', '~' and ' ' are not allowed as part of a partition name. Two or more consecutive slashes ('//') are not allowed. More...
|
|
bool | TopicRemap (const std::string &_fromTopic, std::string &_toTopic) const |
| Get a topic remapping. More...
|
|
A class for customizing the behavior of the Node. E.g.: Set a custom namespace or a partition name.
◆ NodeOptions() [1/2]
◆ NodeOptions() [2/2]
Copy constructor.
- Parameters
-
◆ ~NodeOptions()
◆ AddTopicRemap()
Add a new topic remapping. Any [Un]Advertise(), [Un]Subscribe() or Request() operation will check for topic remappings. If a topic is remapped, the '_fromTopic' topic will be renamed to '_toTopic' in any of the previous functions. Is not possible to add two remaps over the same '_fromTopic'.
- Parameters
-
[in] | _fromTopic | Original topic to be renamed. |
[in] | _toTopic | New topic to be used. |
- Returns
- True if the topic remap is possible or false otherwise.
◆ NameSpace()
Get the namespace used in this node.
- Returns
- The namespace.
- See also
- SetNameSpace.
◆ operator=()
Assignment operator.
- Parameters
-
- Returns
- A reference to this instance.
◆ Partition()
Get the partition used in this node.
- Returns
- The partition name.
- See also
- SetPartition.
◆ SetNameSpace()
Set the node's namespace. A namespace is considered a prefix that might be potentially applied to some of the topic/services advertised in a node. E.g.: Node1 sets a namespace 'ns1' and advertises the topics 't1', 't2' and '/t3'. '/t3' is considered an absolute topic (starts with '/') and it won't be affected by a namespace. However, 't1' and 't2' will be advertised as '/ns1/t1' and '/ns1/t2'. A namespace is any alphanumeric string with a few exceptions. The symbol '/' is allowed as part of a namespace but just '/' is not allowed. The symbols '@', '~' and ' ' are not allowed as part of a namespace. Two or more consecutive slashes ('//') are not allowed.
- Parameters
-
- Returns
- True when operation succeed or false if the namespace was invalid.
- See also
- NameSpace.
◆ SetPartition()
Set the node's partition name. A partition is used to isolate a set of topics or services from other nodes that use the same names. E.g.: Node1 advertises topics '/foo' and Node2 advertises '/foo' too. If we don't use a partition, a node subscribed to '/foo' will receive the messages published from Node1 and Node2. Alternatively, we could specify 'p1' as a partition for Node1 and 'p2' as a partition for Node2. When we create the node for our subscriber, if we specify 'p1' as a partition name, we'll receive the messages published only by Node1. If we use 'p2', we'll only receive the messages published by Node2. If we don't set a partition name, we won't receive any messages from Node1 or Node2. A partition name is any alphanumeric string with a few exceptions. The symbol '/' is allowed as part of a partition name but just '/' is not allowed. The symbols '@', '~' and ' ' are not allowed as part of a partition name. Two or more consecutive slashes ('//') are not allowed.
- Parameters
-
[in] | _partition | The partition's name. The default partition value is created using a combination of your hostname, followed by ':' and your username. E.g.: "bb9:caguero" . It's also possible to use the environment variable GZ_PARTITION for setting a partition name. |
- Returns
- True when operation succeed or false if the partition name was invalid.
- See also
- Partition
◆ TopicRemap()
Get a topic remapping.
- Parameters
-
[in] | _fromTopic | The original topic. |
[out] | _toTopic | The new topic name. _toTopic is unchanged if there is no remapping. |
- Returns
- True if a topic remap was found for '_fromTopic' or false otherwise.
◆ dataPtr
The documentation for this class was generated from the following file: