RTI Connext Modern C++ API
Version 6.0.1
|
<<extension>> Extensions to dds::sub More...
Classes | |
class | AckResponseData |
<<extension>> Data payload associated to an application-level acknowledgment More... | |
class | LoanedSample |
The element type of a dds::sub::LoanedSamples collection. More... | |
struct | IsValidData |
<<extension>> A functor that returns true when a sample has valid data. More... | |
class | ValidLoanedSamples |
<<extension>> <<C++11>> <<move-only-type>> Provides access to only those samples that contain valid data More... | |
class | SampleIterator |
A random-access iterator of LoanedSample. More... | |
class | ValidSampleIterator |
A forward iterator adapter that skips invalid samples. More... | |
class | ManipulatorSelector |
class | SharedSamples |
Provides access to a collection of middleware-loaned samples. More... | |
struct | TopicQuerySelectionKind_def |
The definition of the dds::core::safe_enum rti::sub::TopicQuerySelectionKind. More... | |
class | TopicQuerySelection |
<<extension>> <<value-type>> Specifies the data query that defines a TopicQuery. More... | |
class | TopicQueryData |
<<extension>> <<value-type>> Provides information about a TopicQuery More... | |
class | TopicQuery |
<<extension>> <<reference-type>> Allows a dds::sub::DataReader to query the sample cache of its matching dds::pub::DataWriters. More... | |
Typedefs | |
typedef dds::core::safe_enum < TopicQuerySelectionKind_def > | TopicQuerySelectionKind |
Safe Enumeration of TopicQuerySelectionKind_def | |
Functions | |
template<typename T > | |
dds::topic::ParticipantBuiltinTopicData | matched_publication_participant_data (const dds::sub::DataReader< T > &reader, const dds::core::InstanceHandle &handle) |
<<extension>> This operation retrieves the information on the discovered dds::domain::DomainParticipant associated with the publication that is currently matching with the dds::sub::DataReader. | |
template<typename SubscriberForwardIterator > | |
uint32_t | find_subscribers (const dds::domain::DomainParticipant participant, SubscriberForwardIterator begin, uint32_t max_size) |
<<extension>> Retrieve all of the dds::sub::Subscriber created from this dds::domain::DomainParticipant | |
template<typename SubscriberBackInsertIterator > | |
uint32_t | find_subscribers (const dds::domain::DomainParticipant participant, SubscriberBackInsertIterator begin) |
<<extension>> Retrieve all of the dds::sub::Subscriber created from this dds::domain::DomainParticipant | |
dds::sub::Subscriber | find_subscriber (const dds::domain::DomainParticipant participant, const std::string &subscriber_name) |
<<extension>> Finds a Subscriber by name | |
template<typename AnyDataReaderBackInsertIterator > | |
uint32_t | find_datareaders (dds::sub::Subscriber subscriber, AnyDataReaderBackInsertIterator begin) |
<<extension>> Retrieve all the dds::sub::DataReader created from this dds::sub::Subscriber | |
template<typename AnyDataReaderForwardIterator > | |
uint32_t | find_datareaders (dds::sub::Subscriber subscriber, AnyDataReaderForwardIterator begin, uint32_t max_size) |
<<extension>> Retrieve all the readers created from a subscriber. | |
template<typename Reader > | |
Reader | find_datareader_by_topic_name (dds::sub::Subscriber subscriber, const std::string &topic_name) |
<<extension>> Retrieves a dds::sub::DataReader with the given topic name within the dds::sub::Subscriber | |
template<typename Reader > | |
Reader | find_datareader_by_name (dds::sub::Subscriber subscriber, const std::string &datareader_name) |
<<extension>> Retrieves a dds::sub::DataReader with the given name within the dds::sub::Subscriber | |
template<typename Reader , typename T > | |
Reader | find_datareader_by_topic_description (const dds::sub::Subscriber &subscriber, const dds::topic::TopicDescription< T > &topic_description) |
<<extension>> Retrieves a dds::sub::DataReader with the given TopicDescription within the dds::sub::Subscriber | |
template<typename Reader > | |
Reader | find_datareader_by_name (dds::domain::DomainParticipant participant, const std::string &datareader_name) |
<<extension>> Retrieves a dds::sub::DataReader within the dds::domain::DomainParticipant with the given name | |
dds::sub::Subscriber | implicit_subscriber (const dds::domain::DomainParticipant &dp) |
<<extension>> Retrieves the implicit dds::sub::Subscriber for the given dds::domain::DomainParticipant. | |
template<typename T > | |
dds::sub::Sample< T > | copy_to_sample (const rti::sub::LoanedSample< T > &ls) |
Copies the contents of a rti::sub::LoanedSample into a dds::sub::Sample. | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const LoanedSample< T > &sample) |
Calls the operator on the data or prints [invalid data]. | |
template<typename T > | |
ValidLoanedSamples< T >::iterator | begin (ValidLoanedSamples< T > &ls) |
template<typename T > | |
ValidLoanedSamples< T > ::const_iterator | begin (const ValidLoanedSamples< T > &ls) |
template<typename T > | |
ValidLoanedSamples< T >::iterator | end (ValidLoanedSamples< T > &ls) |
template<typename T > | |
ValidLoanedSamples< T > ::const_iterator | end (const ValidLoanedSamples< T > &ls) |
template<typename T > | |
void | swap (ValidLoanedSamples< T > &ls1, ValidLoanedSamples< T > &ls2) throw () |
template<typename T > | |
ValidLoanedSamples< T > | valid_data (LoanedSamples< T > &&samples) |
<<C++11>> <<extension>> Returns a collection that provides access only to samples with valid data | |
bool | operator== (const SampleInfoImpl &other) const |
Compare two dds::sub::SampleInfo objects for equality. | |
template<typename T > | |
ValidSampleIterator< T > | valid_data (const SampleIterator< T > &sample_iterator) |
<<extension>> Returns an iterator that skips invalid samples | |
TopicQueryData | create_topic_query_data_from_service_request (const rti::topic::ServiceRequest &service_request) |
Creates a TopicQueryData from a ServiceRequest. | |
TopicQuery | find_topic_query (dds::sub::AnyDataReader datareader, const rti::core::Guid &guid) |
Looks up a TopicQuery by its GUID. | |
template<typename T > | |
void | unpack (const dds::sub::SharedSamples< T > &samples, std::vector< std::shared_ptr< const T > > &sample_vector) |
<<extension>> <<C++11>> Unpacks a SharedSamples collection into individual shared_ptr's in a vector | |
template<typename T > | |
std::vector< std::shared_ptr < const T > > | unpack (const dds::sub::SharedSamples< T > &samples) |
<<extension>> <<C++11>> Unpacks a SharedSamples collection into individual shared_ptr's in a vector | |
template<typename T > | |
std::vector< std::shared_ptr < const T > > | unpack (dds::sub::LoanedSamples< T > &&samples) |
<<extension>> <<C++11>> Unpacks a LoanedSamples collection into individual shared_ptr's in a vector | |
<<extension>> Extensions to dds::sub
dds::topic::ParticipantBuiltinTopicData rti::sub::matched_publication_participant_data | ( | const dds::sub::DataReader< T > & | reader, |
const dds::core::InstanceHandle & | handle | ||
) |
<<extension>> This operation retrieves the information on the discovered dds::domain::DomainParticipant associated with the publication that is currently matching with the dds::sub::DataReader.
Matched Participants are those with a matching dds::topic::Topic, compatible QoS and common partition that the application has not indicated should be "ignored" by means of the dds::pub::ignore operation.
The publication_handle
must correspond to a publication currently associated with the dds::sub::DataReader. Otherwise, the operation will fail with dds::core::InvalidArgumentError. The operation may also fail with dds::core::PreconditionNotMetError if the publication corresponds to the same dds::domain::DomainParticipant that the DataReader belongs to. Use the operation dds::sub::matched_publications to find the publications that are currently matched with the dds::sub::DataReader.
Note: This operation does not retrieve the dds::topic::ParticipantBuiltinTopicData::property.
The above information is available through dds::sub::DataReaderListener::on_data_available() (if a reader listener is installed on the dds::sub::DataReader<dds::topic::PublicationBuiltinTopicData>).
.
One | of the Standard Exceptions or dds::core::NotEnabledError |
T | The topic-type that the DataReader subscribes to |
reader | The reader to lookup the matched participant data of |
handle | The InstanceHandle to a specific publication associated with a DataWriter. Must correspond to a publication currently associated with the DataReader. This handle is available in the dds::sub::SampleInfo::publication_handle() |
uint32_t rti::sub::find_subscribers | ( | const dds::domain::DomainParticipant | participant, |
SubscriberForwardIterator | begin, | ||
uint32_t | max_size | ||
) |
<<extension>> Retrieve all of the dds::sub::Subscriber created from this dds::domain::DomainParticipant
SubscriberForwardIterator | Type of the forward iterator passed into this function, whose value_type must be dds::sub::Subscriber. |
participant | The dds::domain::DomainParticipant the Publishers belong to |
begin | A forward iterator to the position in the destination container where to begin copying the found Subscribers into |
max_size | The maximum size of Subscribers to add |
uint32_t rti::sub::find_subscribers | ( | const dds::domain::DomainParticipant | participant, |
SubscriberBackInsertIterator | begin | ||
) |
<<extension>> Retrieve all of the dds::sub::Subscriber created from this dds::domain::DomainParticipant
AnyDataReaderBackInsertIterator | Type of the back-inserting iterator passed into this function, whose value_type must be dds::sub::Subscriber. |
participant | The dds::domain::DomainParticipant the Subscribers belong to |
begin | A back-inserting iterator to the position in the destination container to insert the found Subscribers into |
dds::sub::Subscriber rti::sub::find_subscriber | ( | const dds::domain::DomainParticipant | participant, |
const std::string & | subscriber_name | ||
) |
<<extension>> Finds a Subscriber by name
AnyDataReaderBackInsertIterator | Type of the back-inserting iterator passed into this function, whose value_type must be dds::sub::AnyDataReader. |
participant | The dds::domain::DomainParticipant the Subscribers belong to |
subscriber_name | The name of the Subscriber |
dds::core::null
otherwise. uint32_t rti::sub::find_datareaders | ( | dds::sub::Subscriber | subscriber, |
AnyDataReaderBackInsertIterator | begin | ||
) |
<<extension>> Retrieve all the dds::sub::DataReader created from this dds::sub::Subscriber
AnyDataReaderBackInsertIterator | Type of the back-inserting iterator passed into this function, whose value_type must be dds::sub::AnyDataReader. |
subscriber | The dds::sub::Subscriber the DataReaders belong to |
begin | A back-inserting iterator to the position in the destination container to insert the found DataReaders into |
uint32_t rti::sub::find_datareaders | ( | dds::sub::Subscriber | subscriber, |
AnyDataReaderForwardIterator | begin, | ||
uint32_t | max_size | ||
) |
<<extension>> Retrieve all the readers created from a subscriber.
AnyDataReaderForwardIterator | A forward iterator whose value_type is dds::sub::AnyDataReader |
subscriber | The dds::sub::Subscriber the readers belong to |
begin | A forward iterator to the position in the destination container where to begin copying the found readers into. |
max_size | The maximum number of readers to return |
Reader rti::sub::find_datareader_by_topic_name | ( | dds::sub::Subscriber | subscriber, |
const std::string & | topic_name | ||
) |
<<extension>> Retrieves a dds::sub::DataReader with the given topic name within the dds::sub::Subscriber
Use this operation on the built-in dds::sub::Subscriber (Built-in Topics) to access the built-in dds::sub::DataReader entities for the built-in topics.
The built-in dds::sub::DataReader is created when this operation is called on a built-in topic for the first time. The built-in dds::sub::DataReader is deleted automatically when the dds::domain::DomainParticipant is deleted.
To ensure that builtin dds::sub::DataReader entities receive all the discovery traffic, it is suggested that you lookup the builtin dds::sub::DataReader before the dds::domain::DomainParticipant is enabled. Looking up builtin dds::sub::DataReader may implicitly register builtin transports due to creation of dds::sub::DataReader (see Built-in Transport Plugins for details on when a builtin transport is registered). Therefore, if you are want to modify builtin transport properties, do so before using this operation.
Therefore the suggested sequence when looking up builtin DataReaders is:
topic_name | <<in>> Name of the TopicDescription that the retrieved dds::sub::DataReader is attached to. Cannot be NULL. |
topic_name
. If no such dds::sub::DataReader exists, this operation returns NULL. The returned dds::sub::DataReader may be enabled or disabled.
If more than one dds::sub::DataReader is attached to the dds::sub::Subscriber, this operation may return any one of them.
Reader | The type of the reader. It can be dds::sub::AnyDataReader, or an instantiation of dds::sub::DataReader<T> (if T is not the correct type, this function throws dds::core::InvalidDowncastError) |
subscriber | The dds::sub::Subscriber that created the DataReader to find |
topic_name | Topic name of the DataReader to find |
Reader rti::sub::find_datareader_by_name | ( | dds::sub::Subscriber | subscriber, |
const std::string & | datareader_name | ||
) |
<<extension>> Retrieves a dds::sub::DataReader with the given name within the dds::sub::Subscriber
Reader | The type of the reader. It can be dds::sub::AnyDataReader, or an instantiation of dds::sub::DataReader<T> (if T is not the correct type, this function throws dds::core::InvalidDowncastError) |
Every dds::sub::DataReader in the system has an entity name which is configured and stored in the <<extension>> EntityName policy, ENTITY_NAME.
This operation retrieves the dds::sub::DataReader within the dds::sub::Subscriber whose name matches the one specified. If there are several dds::sub::DataReader with the same name within the dds::sub::Subscriber, the operation returns the first matching occurrence.
subscriber | The dds::sub::Subscriber that created the DataReader to find |
datareader_name | Entity name of the DataReader to find |
Reader rti::sub::find_datareader_by_topic_description | ( | const dds::sub::Subscriber & | subscriber, |
const dds::topic::TopicDescription< T > & | topic_description | ||
) |
<<extension>> Retrieves a dds::sub::DataReader with the given TopicDescription within the dds::sub::Subscriber
Reader | The type of the reader returned, for example, dds::sub::DataReader<Foo>, or dds::sub::AnyDataReader |
T | The topic-type |
subscriber | The Subscriber to which the DataReader belongs |
topic_description | The TopicDescription identifying the DataReader to find |
Reader rti::sub::find_datareader_by_name | ( | dds::domain::DomainParticipant | participant, |
const std::string & | datareader_name | ||
) |
<<extension>> Retrieves a dds::sub::DataReader within the dds::domain::DomainParticipant with the given name
Reader | The type of the reader. It can be dds::sub::AnyDataReader, or an instantiation of dds::sub::DataReader<T> (if T is not the correct type, this function throws dds::core::InvalidDowncastError) |
Every dds::sub::DataReader in the system has an entity name which is configured and stored in the EntityName policy, ENTITY_NAME.
Every dds::sub::Subscriber in the system has an entity name which is also configured and stored in the EntityName policy, ENTITY_NAME.
This operation retrieves a dds::sub::DataReader within a dds::sub::Subscriber given the specified name which encodes both to the dds::sub::DataReader and the dds::sub::Subscriber name.
If there are several dds::sub::DataReader with the same name within the corresponding dds::sub::Subscriber this function returns the first matching occurrence.
The specified name might be given as a fully-qualified entity name or as a plain name.
The fully qualified entity name is a concatenation of the dds::sub::Subscriber to which the dds::sub::DataReader belongs and the entity name of of the dds::sub::DataReader itself, separated by a double colon "::". For example: MySubscriberName::MyDataReaderName
The plain name contains the dds::sub::DataReader name only. In this situation it is implied that the dds::sub::DataReader belongs to the implicit dds::sub::Subscriber so the use of a plain name is equivalent to specifying a fully qualified name with the dds::sub::Subscriber name part being "implicit". For example: the plain name "MyDataReaderName" is equivalent to specifiying the fully qualified name "implicit::MyDataReaderName"
The dds::sub::DataReader is only looked up within the dds::sub::Subscriber specified in the fully qualified name, or within the implicit dds::sub::Subscriber if the name was not fully qualified.
participant | The dds::domain::DomainParticipant within which the dds::sub::DataReader exists |
datareader_name | EntityName of the DataReader to find |
dds::sub::Subscriber rti::sub::implicit_subscriber | ( | const dds::domain::DomainParticipant & | dp | ) |
<<extension>> Retrieves the implicit dds::sub::Subscriber for the given dds::domain::DomainParticipant.
If an implicit Subscriber does not already exist, this creates one.
The implicit Subscriber is created with default dds::sub::qos::SubscriberQos and no listener. When a DomainParticipant is deleted, if there are no attached dds::sub::DataReader that belong to the implicit Subscriber, the implicit Subscriber will be implicitly deleted.
\par MT Safety:
UNSAFE. it is not safe to create the implicit subscriber while another thread may be simultaneously calling dds::domain::DomainParticipant::default_subscriber_qos(const dds::sub::qos::SubscriberQos & qos ).
dp | The DomainParticipant that the implicit subscriber belongs to. |
dds::sub::Sample< T > copy_to_sample | ( | const rti::sub::LoanedSample< T > & | ls | ) |
Copies the contents of a rti::sub::LoanedSample into a dds::sub::Sample.
Example:
std::ostream & operator<< | ( | std::ostream & | out, |
const LoanedSample< T > & | sample | ||
) |
Calls the operator on the data or prints [invalid data].
ValidLoanedSamples< T >::iterator begin | ( | ValidLoanedSamples< T > & | ls | ) |
ValidLoanedSamples< T >::const_iterator begin | ( | const ValidLoanedSamples< T > & | ls | ) |
ValidLoanedSamples< T >::iterator end | ( | ValidLoanedSamples< T > & | ls | ) |
ValidLoanedSamples< T >::const_iterator end | ( | const ValidLoanedSamples< T > & | ls | ) |
void swap | ( | ValidLoanedSamples< T > & | ls1, |
ValidLoanedSamples< T > & | ls2 | ||
) | throw () |
ValidLoanedSamples< T > rti::sub::valid_data | ( | LoanedSamples< T > && | samples | ) |
<<C++11>> <<extension>> Returns a collection that provides access only to samples with valid data
T | The topic-type. It has to match the type of the DataReader. |
This function transforms a LoanedSamples collection into another collection whose iterators only access valid-data samples, skipping any sample such that !sample.info().valid().
This operation is O(1) and will not copy the data samples or allocated any additional memory.
The typical way to use this function is to directly call it on the return value of a read()/take() operation and use it in a for-loop. For example:
samples | The collection of LoanedSamples to transform into a ValidLoanedSamples. It must be an rvalue, so valid actual parameters are the result of one of the read/take operations: std::move'd existing collection: auto ls = reader.take();
auto vs = rti::sub::valid_data(std::move(ls));
// 'ls' is now invalid and can't be further used
|
samples
is invalid cannot be used after this callbool rti::sub::operator== | ( | const SampleInfoImpl & | other | ) | const |
Compare two dds::sub::SampleInfo objects for equality.
ValidSampleIterator< T > rti::sub::valid_data | ( | const SampleIterator< T > & | sample_iterator | ) |
<<extension>> Returns an iterator that skips invalid samples
Given a regular sample iterator, this functions creates another iterator it
that behaves exactly the same except that it++
moves to the next valid sample (or to the end of the collection). That is, if it
doesn't point to the end of the collection, it->info.valid()
is always true.
This is useful when your application doesn't need to deal with samples containing meta-information only.
For example, the following code copies all the data in a LoanedSamples collection skipping any invalid samples (otherwise, attempting to copy the data from an invalid sample would throw an exception, see rti::sub::LoanedSample::operator const DataType& ()).
Note that valid_data
(samples.begin()) won't point to the first element if that element is not a valid sample.
A similar utility is the functor rti::sub::IsValidData.
TopicQueryData create_topic_query_data_from_service_request | ( | const rti::topic::ServiceRequest & | service_request | ) |
Creates a TopicQueryData from a ServiceRequest.
This operation will extract the content from the request body of the rti::topic::ServiceRequest to create a rti::sub::TopicQueryData object.
The specified rti::topic::ServiceRequest must be a valid sample associated with the service id rti::core::ServiceRequestId_def::TOPIC_QUERY. Otherwise this operation will return false.
This operation can be called within the context of a dds::pub::DataWriterListener::on_service_request_accepted to retrieve the rti::sub::TopicQueryData of a rti::topic::ServiceRequest that has been received with service id rti::core::ServiceRequestId_def::TOPIC_QUERY
<<inout>> A rti::sub::TopicQueryData object where the content from the service request is extracted.
<<in>> Input rti::topic::ServiceRequest that contains the rti::sub::TopicQueryData as part of its request body.
service_request | The rti::topic::ServiceRequest that contains the rti::sub::TopicQueryData as part of its request body. |
TopicQuery find_topic_query | ( | dds::sub::AnyDataReader | datareader, |
const rti::core::Guid & | guid | ||
) |
Looks up a TopicQuery by its GUID.
datareader | The DataReader used to create the TopicQuery |
guid | The TopicQuery's GUID |
void rti::sub::unpack | ( | const dds::sub::SharedSamples< T > & | samples, |
std::vector< std::shared_ptr< const T > > & | sample_vector | ||
) |
<<extension>> <<C++11>> Unpacks a SharedSamples collection into individual shared_ptr's in a vector
#include
<rti/sub/unpack.hpp>
This function creates a reference (not a copy) to each sample with valid data in a SharedSamples container and pushes it back into a vector.
Each individual sample in the vector retains a reference to the original SharedSamples that controls when the loan is returned. These references can be further shared. When all the references go out of scope, the loan is returned.
This can be also useful to insert samples from different calls to read()/take() into the same vector. It is however recommended to not hold these samples indefinitely, since they use internal resources.
Example:
T | The topic-type |
samples | The collection of samples obtained from the DataReader |
sample_vector | The destination where the samples are pushed back. |
std::vector< std::shared_ptr< const T > > rti::sub::unpack | ( | const dds::sub::SharedSamples< T > & | samples | ) |
<<extension>> <<C++11>> Unpacks a SharedSamples collection into individual shared_ptr's in a vector
This overload returns a new vector instead of adding into an existing one.
std::vector< std::shared_ptr< const T > > rti::sub::unpack | ( | dds::sub::LoanedSamples< T > && | samples | ) |
<<extension>> <<C++11>> Unpacks a LoanedSamples collection into individual shared_ptr's in a vector
This overload is a shortcut for unpack
(SharedSamples<T>(loaned_samples)) to simplify code like the following: