RTI Connext Modern C++ API Version 7.2.0
|
<<extension>> Stores key/value string pairs that can configure certain parameters of RTI Connext not exposed through QoS policies. It can also store and propagate through the discovery mechanism application-specific information associated to a dds::core::Entity. More...
#include <rti/core/policy/CorePolicy.hpp>
Public Types | |
typedef std::pair< std::string, std::string > | Entry |
The type of the elements that Property contains. More... | |
Public Member Functions | |
Property () | |
Creates an empty Property container. More... | |
template<typename EntryIter > | |
Property (EntryIter begin, EntryIter end, bool is_propagate=false) | |
Creates a Property container with the entries specified by an iterator range. More... | |
Property (std::initializer_list< Entry > entries) | |
<<C++11>> Creates a Property container with entries from an initializer_list More... | |
bool | exists (const std::string &key) const |
Returns true if a property exists. More... | |
std::string | get (const std::string &key) const |
Returns the value of a property identified by a key if it exists. More... | |
rti::core::optional_value< std::string > | try_get (const std::string &key) const |
Returns the value of a property identified by a key or an empty optional_value if it doesn't exist. More... | |
Property & | set (const Entry &property, bool propagate=false) |
Adds or assigns a property from a pair of strings. More... | |
template<typename EntryIter > | |
Property & | set (EntryIter begin, EntryIter end, bool is_propagate=false) |
Adds a range of properties. More... | |
bool | remove (const std::string &key) |
Removes the property identified by a key. More... | |
size_t | size () const |
Returns the number of properties. More... | |
std::map< std::string, std::string > | get_all () const |
Retrieves a copy of all the entries in a std::map. More... | |
void | set (std::initializer_list< Entry > entries, bool is_propagate=false) |
<<C++11>> Adds properties from an initializer_list More... | |
bool | propagate (const std::string &key) const |
Returns whether the 'propagate' attribute for a property is set or not. More... | |
<<extension>> Stores key/value string pairs that can configure certain parameters of RTI Connext not exposed through QoS policies. It can also store and propagate through the discovery mechanism application-specific information associated to a dds::core::Entity.
The PROPERTY QoS policy can be used to associate a set of properties in the form of (name, value) pairs with a dds::sub::DataReader, dds::pub::DataWriter, or dds::domain::DomainParticipant. This is similar to the dds::core::policy::UserData, except this policy uses (name, value) pairs, and you can select whether or not a particular pair should be propagated (included in the builtin topic).
You can find a complete list of predefined properties in the Property Reference Guide.
This QoS policy may be used to configure:
In addition, you may add your own name/value pairs to the Property QoS policy of an Entity. Via this QoS policy, you can direct RTI Connext to propagate these name/value pairs with the discovery information for the Entity. Applications that discover the Entity can then access the user-specific name/value pairs in the discovery information of the remote Entity. This allows you to add meta-information about an Entity for application-specific use, for example, authentication/authorization certificates (which can also be done using the dds::core::policy::UserData or dds::core::policy::GroupData).
Some of the RTI Connext capabilities configurable via the Property QoS policy can also be configured in code via APIs. However, the Property QoS policy allows you to configure those parameters via XML files. In addition, some of the configuration APIs will only work if the Entity was created in a disabled state and then enabled after the configuration change was applied. By configuring those parameters using the Property QoS policy during entity creation, you avoid the additional work of first creating a disabled entity and then enabling it afterwards.
There are helper functions to facilitate working with properties, see the PROPERTY page.
typedef std::pair<std::string, std::string> rti::core::policy::Property::Entry |
The type of the elements that Property contains.
Key/value string pairs.
|
inline |
Creates an empty Property container.
|
inline |
Creates a Property container with the entries specified by an iterator range.
|
inline |
|
inline |
Returns true if a property exists.
std::string rti::core::policy::Property::get | ( | const std::string & | key | ) | const |
Returns the value of a property identified by a key if it exists.
If the property doesn't exist it throws dds::core::PreconditionNotMetError.
rti::core::optional_value< std::string > rti::core::policy::Property::try_get | ( | const std::string & | key | ) | const |
Returns the value of a property identified by a key or an empty optional_value if it doesn't exist.
Adds or assigns a property from a pair of strings.
If the key doesn't exists it adds the new entry, otherwise it overrides its value with the new one.
property | property.first is the key and property.second is the value |
propagate | Indicates if the property must be propagated on discovery |
|
inline |
Adds a range of properties.
If a key is duplicated, only one entry will remain, with the value that comes last.
EntryIter | A forward iterator whose value type is Property::Entry, such as the iterators of a std::map<std::string, std::string> . |
begin | Beginning of a range of Entry |
end | End of that range |
is_propagate | Indicates if the property must be propagated on discovery |
bool rti::core::policy::Property::remove | ( | const std::string & | key | ) |
Removes the property identified by a key.
size_t rti::core::policy::Property::size | ( | ) | const |
Returns the number of properties.
std::map< std::string, std::string > rti::core::policy::Property::get_all | ( | ) | const |
Retrieves a copy of all the entries in a std::map.
|
inline |
<<C++11>> Adds properties from an initializer_list
bool rti::core::policy::Property::propagate | ( | const std::string & | key | ) | const |
Returns whether the 'propagate' attribute for a property is set or not.