RTI Connext .Net APIs
Version 5.2.0
|
Allows sending requests and receiving replies. More...
Inherits AlreadyDisposedHelper< Requester< TReq, TRep >>, and IDisposable.
Public Member Functions | |
Requester (RequesterParams parameters) | |
Creates a Requester with parameters. | |
Requester (DomainParticipant participant, String serviceName, TypeSupport requestTypeSupport, TypeSupport replyTypeSupport) | |
Creates a Requester with the minimum set of parameters. | |
void | SendRequest (TReq request) |
Sends a request. | |
void | SendRequest (WriteSample< TReq > request) |
Sends a request and gets back information about it that allows correlation with future replies. | |
bool | ReceiveReply (Sample< TRep > reply, Duration_t maxWait) |
Waits for a reply and copies its contents into a Sample. | |
IList< Sample< TRep > > | ReceiveReplies (IList< Sample< TRep >> replies, int maxCount, Duration_t maxWait) |
Waits for multiple replies and copies them into a list. | |
IList< Sample< TRep > > | ReceiveReplies (IList< Sample< TRep >> replies, int minCount, int maxCount, Duration_t maxWait) |
Waits for multiple replies and copies them into a list. | |
LoanedSamples< TRep > | ReceiveReplies (Duration_t maxWait) |
Waits for multiple replies and provides a loaned container to access them. | |
LoanedSamples< TRep > | ReceiveReplies (int minCount, int maxCount, Duration_t maxWait) |
Waits for multiple replies and provides a loaned container to access them. | |
bool | TakeReply (Sample< TRep > reply) |
Copies the contents of a reply into a Sample. | |
LoanedSamples< TRep > | TakeReplies () |
Provides a loaned container to access the existing replies. | |
LoanedSamples< TRep > | TakeReplies (int maxCount) |
Provides a loaned container to access the existing replies. | |
IList< Sample< TRep > > | TakeReplies (IList< Sample< TRep >> replies, int maxCount) |
Copies existing replies into a list. | |
bool | TakeReply (Sample< TRep > reply, SampleIdentity_t relatedRequestId) |
Copies the contents of a reply for a specific request. | |
LoanedSamples< TRep > | TakeReplies (SampleIdentity_t relatedRequestId) |
Provides a loaned container to access the existing replies for a specific request. | |
LoanedSamples< TRep > | TakeReplies (int maxCount, SampleIdentity_t relatedRequestId) |
Provides a loaned container to access the existing replies for a specific request. | |
IList< Sample< TRep > > | TakeReplies (IList< Sample< TRep >> replies, int maxCount, SampleIdentity_t relatedRequestId) |
Copies existing replies for a specific request into a list. | |
bool | ReadReply (Sample< TRep > reply) |
Copies the contents of a reply into a Sample. | |
LoanedSamples< TRep > | ReadReplies () |
Provides a loaned container to access the existing replies. | |
LoanedSamples< TRep > | ReadReplies (int maxCount) |
Provides a loaned container to access the existing replies. | |
IList< Sample< TRep > > | ReadReplies (IList< Sample< TRep >> replies, int maxCount) |
Copies existing replies into a list. | |
bool | ReadReply (Sample< TRep > reply, SampleIdentity_t relatedRequestId) |
Copies the contents of a reply for a specific request. | |
LoanedSamples< TRep > | ReadReplies (SampleIdentity_t relatedRequestId) |
Provides a loaned container to access the existing replies for a specific request. | |
LoanedSamples< TRep > | ReadReplies (int maxCount, SampleIdentity_t relatedRequestId) |
Provides a loaned container to access the existing replies for a specific request. | |
IList< Sample< TRep > > | ReadReplies (IList< Sample< TRep >> replies, int maxCount, SampleIdentity_t relatedRequestId) |
Copies existing replies for a specific request into a list. | |
bool | WaitForReplies (Duration_t maxWait) |
Waits for replies to any request. | |
bool | WaitForReplies (int minCount, Duration_t maxWait) |
Waits for replies to any request. | |
bool | WaitForReplies (int minCount, Duration_t maxWait, SampleIdentity_t relatedRequestId) |
Waits for replies to a specific request. | |
WriteSample< TReq > | CreateRequestSample () |
Creates a WriteSample for sending requests. | |
WriteSample< TReq > | CreateRequestSample (TReq data) |
Creates a WriteSample for sending requests. | |
Sample< TRep > | CreateReplySample () |
Creates a Sample for getting replies. | |
Properties | |
TypedDataWriter< TReq > | RequestDataWriter [get] |
Retrieves the underlying DDS::DataWriter. | |
TypedDataReader< TRep > | ReplyDataReader [get] |
Retrieves the underlying DDS::DataReader. | |
Allows sending requests and receiving replies.
A requester is an entity with two associated topics: a request topic and a reply topic. It can send requests by publishing samples of the request topic and receive replies to those requests by subscribing to the reply topic.
Valid types for these topics (TReq
and TRep
) are: those generated by the rtiddsgen code generator, the DDS built-in types, and DynamicData
.
For example:
A Replier and a Requester communicate when they use the same topics for requests and replies (see RTI::Connext::RequestReply::RequesterParams::SetServiceName) on the same domain.
A Requester can send requests and receive one or multiple replies. It does that using the following operations:
In all cases, the middleware guarantees that a requester only receives reply samples that are associated with that requests that it sends.
For multi-reply scenarios, in which a Requester receives multiple replies from a Replier for a given request, the Requester can check if a reply is the last reply of a sequence of replies. To do so, see if the bit ::DDS::SampleFlagBits::INTERMEDIATE_REPLY_SEQUENCE_SAMPLE is set in DDS::SampleInfo::flag after receiving each reply. This indicates it is NOT the last reply.
A requester has an associated DDS::DomainParticipant, which can be shared with other requesters or RTI Connext routines. All the other RTI Connext entities required for the request-reply interaction, including a DDS::DataWriter for writing requests and a DDS::DataReader for reading replies, are automatically created when the requester is constructed.
Quality of Service for the underlying DataWriter and DataReader can be configured (see RTI::Connext::RequestReply::RequesterParams::SetQosProfile). By default, they are created with reliable quality of service. The exact default configuration is described here: Configuring Request-Reply QoS profiles
TReq | The data type for the request topic |
TRep | The data type for the reply topic |
TReq | : | class | |
TReq | : | global | |
TReq | : | DDS.ICopyable<TReq> | |
TReq | : | new() | |
TRep | : | class | |
TRep | : | global | |
TRep | : | DDS.ICopyable<TRep> | |
TRep | : | new() |
|
inline |
Creates a Requester with parameters.
params | All the parameters that configure this requester. See RTI::Connext::RequestReply::RequesterParams for the list of mandatory parameters. |
One | of the Standard Return Codes |
|
inline |
Creates a Requester with the minimum set of parameters.
participant | The DomainParticipant this requester uses to join a DDS domain |
serviceName | The service name. See RTI::Connext::RequestReply::RequesterParams::SetServiceName |
requestTypeSupport | The type support for type TReq |
replyTypeSupport | The type support for type TReq |
One | of the Standard Return Codes |
|
inline |
Sends a request.
If a future reply needs to be correlated to exactly this request, use RTI::Connext::RequestReply::Requester<TReq,TRep>::SendRequest(WriteSample<TReq>).
request | The request to be sent |
One | of the Standard Return Codes |
|
inline |
Sends a request and gets back information about it that allows correlation with future replies.
After calling this operation, the sample contains a valid identity that can be used for correlation with future replies.
See example code in Correlating requests and replies.
request | <<inout>> Contains the request and optional write parameters. When this call ends succesfully, RTI::Connext::Infrastructure::WriteSample<T> contains a valid identity that can be used for correlation with future replies. |
One | of the Standard Return Codes ; DDS::Retcode_Timeout may be reported in the same conditions as in DDS::TypedDataWriter::write. |
|
inline |
Waits for a reply and copies its contents into a Sample.
This operation is equivalent to using WaitForReplies(int,Duration_t) and TakeReply(Sample<TRep>).
|
inline |
Waits for multiple replies and copies them into a list.
This operation is equivalent to using ReceiveReplies(IList<Sample<TRep>>,int,int,Duration_t) with min_count = 0
|
inline |
Waits for multiple replies and copies them into a list.
This operation is equivalent to using WaitForReplies(int,Duration_t) and TakeReplies(IList<Sample<TRep>>,int).
|
inline |
Waits for multiple replies and provides a loaned container to access them.
This operation is equivalent to using ReceiveReplies(int,int,Duration_t) with min_count=1
and max_count=DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED
|
inline |
Waits for multiple replies and provides a loaned container to access them.
This operation is equivalent to using WaitForReplies(int,Duration_t) and TakeReplies(int).
One | of the Standard Return Codes |
|
inline |
Copies the contents of a reply into a Sample.
Takes a reply sample from the Requester and makes a copy.
This operation may be used after a call to WaitForReplies(int,Duration_t).
To avoid copies, you can use TakeReplies(int).
reply | The sample where the reply data and the related SampleInfo are copied |
reply
remain unchanged, except DDS::SampleInfo::valid_data becomes false. One | of the Standard Return Codes |
|
inline |
Provides a loaned container to access the existing replies.
Equivalent to using TakeReplies(int) with max_count=DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED
.
|
inline |
Provides a loaned container to access the existing replies.
Takes all the existing replies up to maxCount
and provides a loaned container to access them.
This operation does not make a copy of the data.
The loan is returned with RTI::Connext::Infrastructure::LoanedSamples<T>::Dispose
This operation may be used after a call to WaitForReplies(int,Duration_t)
See an example here: Taking loaned samples
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. This value will read up to the limit specified by DDS::DataReaderResourceLimitsQosPolicy::max_samples_per_read |
One | of the Standard Return Codes |
|
inline |
Copies existing replies into a list.
Takes all the existing replies up to maxCount
and copies them into a list.
If the first argument is null, a new list containing the copies is created and returned.
If a non-null list is passed as the first argument, the copies are inserted into that list. The list may already contain some elements. Any existing elements are overwritten. If the list contains less elements, samples are inserted at the end; if it contains more elements, the excess samples are removed from the end.
This operation may be used after a call to WaitForReplies(int,Duration_t).
replies | The list where the samples are copied or null to create a new list. |
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. |
replies
if it's not null
. Otherwise it returns a new list. One | of the Standard Return Codes |
|
inline |
Copies the contents of a reply for a specific request.
This operation is analogous to TakeReply(Sample<TRep>) except the reply corresponds to a specific request.
reply | The sample where a reply is copied into |
relatedRequestId | The identity of a request previously sent by this Requester |
reply
remain unchanged, except DDS::SampleInfo::valid_data becomes false.
|
inline |
Provides a loaned container to access the existing replies for a specific request.
Equivalent to using TakeReplies(int,SampleIdentity_t) with max_count=DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED
|
inline |
Provides a loaned container to access the existing replies for a specific request.
This operation is analogous to TakeReplies(int) except the replies this operation provides correspond to a specific request.
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. |
relatedRequestId | The identity of a request previously sent by this Requester |
|
inline |
Copies existing replies for a specific request into a list.
This operation is analogous to TakeReplies(IList<Sample<TRep>>,int) except the replies correspond to a specific request.
replies | The list where the samples are copied or null to create a new List. |
maxCount | The maximum number of samples that are taken at a time. The special value DDS::ResourceLimitsQosPolicy::LENGTH_UNLIMITED may be used. |
relatedRequestId | The identity of a request previously sent by this Requester |
replies
if it is not null
. Otherwise it returns a new List
.
|
inline |
Copies the contents of a reply into a Sample.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReply(Sample<TRep>) except the reply remains in the Requester and can be read or taken again.
|
inline |
Provides a loaned container to access the existing replies.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies() except the replies remain in the Requester and can be read or taken again.
|
inline |
Provides a loaned container to access the existing replies.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies(int) except the replies remain in the Requester and can be read or taken again.
|
inline |
Copies existing replies into a list.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies(IList<Sample<TRep>>,int) except the replies remain in the Requester and can be read or taken again.
|
inline |
Copies the contents of a reply for a specific request.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReply(Sample<TRep>,SampleIdentity_t) except the reply remains in the Requester and can be read or taken again.
|
inline |
Provides a loaned container to access the existing replies for a specific request.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies(SampleIdentity_t) except the replies remain in the Requester and can be read or taken again.
|
inline |
Provides a loaned container to access the existing replies for a specific request.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies(int,SampleIdentity_t) except the replies remain in the Requester and can be read or taken again.
|
inline |
Copies existing replies for a specific request into a list.
This operation is equivalent to RTI::Connext::RequestReply::Requester<TReq,TRep>::TakeReplies(IList<Sample<TRep>>,int,SampleIdentity_t) except the replies remain in the Requester and can be read or taken again.
|
inline |
Waits for replies to any request.
This operation is equivalent to using WaitForReplies(int,Duration_t) with min_count=1
.
|
inline |
Waits for replies to any request.
This operation waits for minCount requests to be available for up to maxWait .
If this operation is called several times but the available replies are not taken (with TakeReplies(int)), this operation may return immediately and will not wait for new replies. New replies may replace existing ones if they are not taken, depending on the DDS::HistoryQosPolicy used to configure this Requester.
minCount | Minimum number of replies that need to be available for this operation to unblock. |
maxWait | Maximum waiting time after which this operation unblocks, regardless of how many replies are available. |
|
inline |
Waits for replies to a specific request.
This operation is analogous to WaitForReplies(int,Duration_t) except this operation waits for replies for a specific request.
minCount | Minimum number of replies for the related request that need to be available for this operation to unblock. |
maxWait | Maximum wait time after which this operation unblocks, regardless of how many replies are available. |
relatedRequestId | The identity of a request previously sent by this Requester |
One | of the Standard Return Codes |
|
inline |
Creates a WriteSample for sending requests.
TReq
initialized with default values and default write parameters.
|
inline |
Creates a WriteSample for sending requests.
|
inline |
Creates a Sample for getting replies.
TRep
and invalid SampleInfo.
|
get |
Retrieves the underlying DDS::DataWriter.
Accessing the request DataWriter may be useful for a number of advanced use cases, such as:
|
get |
Retrieves the underlying DDS::DataReader.
Accessing the reply DataReader may be useful for a number of advanced use cases, such as: