RTI Connext Modern C++ API  Version 5.2.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::core::policy::Property Class Reference

<<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.
 

Public Member Functions

 Property ()
 Creates an empty Property container.
 
template<typename EntryIter >
 Property (EntryIter begin, EntryIter end, bool propagate=false)
 Creates a Property container with the entries specified by an iterator range.
 
 Property (std::initializer_list< Entry > entries)
 <<C++11>> Creates a Property container with entries from an initializer_list
 
bool exists (const std::string &key) const
 Returns true if a property exists.
 
std::string get (const std::string &key) const
 Returns the value of a property identified by a key if it exists.
 
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.
 
Propertyset (const Entry &property, bool propagate=false)
 Adds or assigns a property from a pair of strings.
 
template<typename EntryIter >
Propertyset (EntryIter begin, EntryIter end, bool propagate=false)
 Adds a range of properties.
 
bool remove (const std::string &key)
 Removes the property identified by a key.
 
size_t size () const
 Returns the number of properties.
 
std::map< std::string,
std::string > 
get_all () const
 Retrieves a copy of all the entries in a std::map.
 
void set (std::initializer_list< Entry > entries, bool propagate=false)
 <<C++11>> Adds properties from an initializer_list
 
bool propagate (const std::string &key) const
 Returns whether the 'propagate' attribute for a property is set or not.
 

Detailed Description

<<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.

Entity:
dds::domain::DomainParticipant dds::sub::DataReader dds::pub::DataWriter
Properties:
RxO = N/A;
Changeable = YES
See Also
dds::sub::builtin_subscriber

Usage

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).

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).

Reasons for Using the PropertyQosPolicy

  • Supports dynamic loading of extension transports (such as RTI Secure WAN Transport)
  • Supports multiple instances of the builtin transports
  • Allows full pluggable transport configuration for non-C/C++ language bindings (Java, .NET, etc.)
  • Avoids the process of creating entities disabled, changing their QoS settings, then enabling them
  • Allows selection of clock

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.

Member Typedef Documentation

typedef std::pair<std::string, std::string> rti::core::policy::Property::Entry

The type of the elements that Property contains.

Key/value string pairs.

Constructor & Destructor Documentation

rti::core::policy::Property::Property ( )
inline

Creates an empty Property container.

template<typename EntryIter >
rti::core::policy::Property::Property ( EntryIter  begin,
EntryIter  end,
bool  propagate = false 
)
inline

Creates a Property container with the entries specified by an iterator range.

See Also
set(EntryIter, EntryIter, bool)
rti::core::policy::Property::Property ( std::initializer_list< Entry entries)
inline

<<C++11>> Creates a Property container with entries from an initializer_list

For example:

Property my_properties {{"key 1", "value 1"}, {"key 2", "value 2"}};

If a key is duplicated, only one entry will be inserted, with the value that comes last.

Member Function Documentation

bool rti::core::policy::Property::exists ( const std::string &  key) const
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.

Property& rti::core::policy::Property::set ( const Entry property,
bool  propagate = false 
)

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.

Parameters
propertyproperty.first is the key and property.second is the value
propagateIndicates if the property must be propagated on discovery
template<typename EntryIter >
Property& rti::core::policy::Property::set ( EntryIter  begin,
EntryIter  end,
bool  propagate = false 
)
inline

Adds a range of properties.

If a key is duplicated, only one entry will remain, with the value that comes last.

Template Parameters
EntryIterA forward iterator whose value type is Property::Entry
Parameters
beginBeginning of a range of Entry
endEnd of that range
propagateIndicates 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.

Returns
true if the property was removed or false if it didn't exist.
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.

void rti::core::policy::Property::set ( std::initializer_list< Entry entries,
bool  propagate = false 
)
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.


RTI Connext Modern C++ API Version 5.2.3 Copyright © Wed Apr 27 2016 Real-Time Innovations, Inc