CoreDX DDS Java Reference Manual
Public Member Functions | List of all members
Requester< TReq extends RequestType, TRep extends ReplyType > Class Template Reference
Inheritance diagram for Requester< TReq extends RequestType, TRep extends ReplyType >:
ServiceProxy< TReq, TRep >

Public Member Functions

 Requester (Class< TReq > treq_class, Class< TRep > trep_class)
 
 Requester (Class< TReq > treq_class, Class< TRep > trep_class, RequesterParams req_params)
 
ReturnCode_t send_request (TReq request)
 
ReturnCode_t send_request_oneway (TReq request)
 
boolean receive_reply (Sample< TRep > reply, Duration_t timeout)
 
boolean receive_reply (Sample< TRep > reply, SampleIdentity_t relatedRequestId)
 
LoanedSamples< TRep > receive_replies (Duration_t max_wait)
 
LoanedSamples< TRep > receive_replies (int min_count, int max_count, Duration_t max_wait)
 
boolean wait_for_replies (int min_count, Duration_t max_wait)
 
boolean wait_for_replies (Duration_t max_wait)
 
boolean wait_for_replies (int min_count, Duration_t max_wait, SampleIdentity_t related_request_id)
 
boolean take_reply (Sample< TRep > reply)
 
boolean take_reply (Sample< TRep > reply, SampleIdentity_t related_request_id)
 
LoanedSamples< TRep > take_replies (int max_count)
 
LoanedSamples< TRep > take_replies (int max_count, SampleIdentity_t related_request_id)
 
LoanedSamples< TRep > take_replies (SampleIdentity_t related_request_id)
 
boolean read_reply (Sample< TRep > reply)
 
boolean read_reply (Sample< TRep > reply, SampleIdentity_t related_request_id)
 
LoanedSamples< TRep > read_replies (int max_count)
 
LoanedSamples< TRep > read_replies (int max_count, SampleIdentity_t related_request_id)
 
LoanedSamples< TRep > read_replies (SampleIdentity_t related_request_id)
 
boolean receive_nondata_samples (boolean enable)
 
RequesterParams get_requester_params ()
 
DataWriterI< TReq > get_request_datawriter ()
 
DataReaderI< TRep > get_reply_datareader ()
 
- Public Member Functions inherited from ServiceProxy< TReq, TRep >
void close ()
 
boolean is_null ()
 
void bind (String i_name)
 
void unbind ()
 
boolean is_bound ()
 
String get_bound_instance_name ()
 
Vector< String > get_discovered_service_instances ()
 
ReturnCode_t wait_for_service ()
 
ReturnCode_t wait_for_service (Duration_t maxWait)
 
ReturnCode_t wait_for_service (String instanceName)
 
ReturnCode_t wait_for_service (Duration_t max_wait, String instanceName)
 
ReturnCode_t wait_for_services (int count)
 
ReturnCode_t wait_for_services (Duration_t max_wait, int count)
 
ReturnCode_t wait_for_services (Vector< String > instanceNames)
 
ReturnCode_t wait_for_services (Duration_t max_wait, Vector< String > instanceNames)
 

Detailed Description

A Requester sends requests and receives replies.

An instance of a Requester is configured at the time of construction using RequesterParams, which is a container of configuration parameters, such as domain participant, QoS, listeners and more.

Requester is inherently asynchronous as sending a request and receiving its corresponding reply (or replies) are separated. Requester allows listener-based, polling-based, and future-based reception of replies.

SimpleRequesterListener<TRep> and RequesterListener<TReq, TRep> interfaces enable callback-based notification when a reply is available. On the other hand, Requester provides functions to allow polling reception of replies.

Future-based notification of replies is analogous to callback-based notification, however, no request-reply correlation is necessary because every future represents a reply to a unique request.

A requester reference may be bound to a specific service instance. Requests sent through a bound requester reference shall be sent to the bound service instance only.

Constructor & Destructor Documentation

Requester ( Class< TReq >  treq_class,
Class< TRep >  trep_class 
)

Default constructor.

Without any configuration, the Requester will construct DDS Entities as required in domain '0'.

Requester ( Class< TReq >  treq_class,
Class< TRep >  trep_class,
RequesterParams  req_params 
)

Constructor that accepts RequesterParams for configuration.

Member Function Documentation

DataReaderI<TRep> get_reply_datareader ( )

Obtain access to the underlying DataReader used for receiving Replies.

DataWriterI<TReq> get_request_datawriter ( )

Obtain access to the underlying DataWriter used for sending Requests.

RequesterParams get_requester_params ( )

Obtain the parameters used to configure this Reqeuster.

LoanedSamples<TRep> read_replies ( int  max_count)

Attempts to access up to 'max_count' replies.

The available replies (up to 'max_count') are returned in a LoanedSamples<TRep> object. This routine will not block.

LoanedSamples<TRep> read_replies ( int  max_count,
SampleIdentity_t  related_request_id 
)

Attempts to access up to 'max_count' replies that match 'related_request_id'.

The available matching replies (up to 'max_count') are returned in a LoanedSamples<TRep> object. This routine will not block.

LoanedSamples<TRep> read_replies ( SampleIdentity_t  related_request_id)

Attempts to access all available replies that match 'related_request_id'.

The available matching replies are returned in a LoanedSamples<TRep> object. This routine will not block.

boolean read_reply ( Sample< TRep >  reply)

Attempts to access the next available reply.

This routine will block until a reply is available. This routines copies the reply data into the provided Sample<TRep> 'reply'.

boolean read_reply ( Sample< TRep >  reply,
SampleIdentity_t  related_request_id 
)

Attempts to access the next available reply that matches 'related_reqeust_id'.

This routine will block until a matching reply is available.

boolean receive_nondata_samples ( boolean  enable)

Toggle whether non-data samples are presented to the application.

Note
This is of little utility, as the only non-data samples are unregister, dispose, and not-alive indications which are uncommon with an un-keyed datatype.
LoanedSamples<TRep> receive_replies ( Duration_t  max_wait)

Attempts to access multiple received replies.

This method will access all available replies and return them in a LoanedSamples<TRep> object. If no replies are currently available, the routine will block for up to 'max_wait'.

Return values
booleanindicating if replies were found (true) or not (false).
LoanedSamples<TRep> receive_replies ( int  min_count,
int  max_count,
Duration_t  max_wait 
)

Attempts to access at least 'min_count' replies.

This method will access all available replies up to 'max_count' and return them in a LoanedSamples<TRep> object. If at least 'min_count' replies are currently not available, the routine will block for up to 'max_wait'.

Return values
booleanindicating if replies were found (true) or not (false).
boolean receive_reply ( Sample< TRep >  reply,
Duration_t  timeout 
)

Attempts to access a received reply.

This method accepts a parameter of Sample<TRep> & and a 'timeout'. The call will block until a reply is found, or the timeout period elapses.

Return values
booleanindicating if a reply was found (true) or not (false).
boolean receive_reply ( Sample< TRep >  reply,
SampleIdentity_t  relatedRequestId 
)

Attempts to access a received reply.

This method accepts a parameter of Sample<TRep> & and a SampleIdentity_t. The call will block until a specific reply is found that matches the identity provided the 'relatedRequestId' parameter.

Return values
booleanindicating if a reply was found (true) or not (false).
ReturnCode_t send_request ( TReq  request)

Transmits a request to any matched instances of this service This method accepts a parameter of TReq. Populates request.requestHeader

ReturnCode_t send_request_oneway ( TReq  request)

Transmits a request to any matched instances of this service This method accepts a parameter of TReq.

LoanedSamples<TRep> take_replies ( int  max_count)

Attempts to access up to 'max_count' replies.

This method will access all available replies up to 'max_count' and return them in a LoanedSamples<TRep> object. This routine will not block.

LoanedSamples<TRep> take_replies ( int  max_count,
SampleIdentity_t  related_request_id 
)

Attempts to access up to 'max_count' replies that match the 'related_request_id'.

This method will access all available replies up to 'max_count' and return them in a LoanedSamples<TRep> object. This routine will not block.

LoanedSamples<TRep> take_replies ( SampleIdentity_t  related_request_id)

Attempts to access any replies that match the 'related_request_id'.

This method will access all available matching replies and return them in a LoanedSamples<TRep> object. This routine will not block.

boolean take_reply ( Sample< TRep >  reply)

Attempts to access a received reply.

This method accepts a parameter of Sample<TRep> & . The call will not block.

Return values
booleanindicating if a reply was found (true) or not (false).
boolean take_reply ( Sample< TRep >  reply,
SampleIdentity_t  related_request_id 
)

Attempts to access a received reply.

This method accepts a parameter of Sample<TRep> & . The call will not block.

Return values
booleanindicating if a reply was found (true) or not (false).
boolean wait_for_replies ( int  min_count,
Duration_t  max_wait 
)

Blocks until at least 'min_count' replies are available.

If at least 'min_count' replies are currently not available, the routine will block for up to 'max_wait'.

Return values
booleanindicating if replies were found (true) or not (false).
boolean wait_for_replies ( Duration_t  max_wait)

Blocks until a reply is available.

If no replies are currently available, the routine will block for up to 'max_wait'.

Return values
booleanindicating if replies were found (true) or not (false).
boolean wait_for_replies ( int  min_count,
Duration_t  max_wait,
SampleIdentity_t  related_request_id 
)

Blocks until at least 'min_count' replies to 'related_request_id' are available.

If at least 'min_count' matching replies are currently not available, the routine will block for up to 'max_wait'.

Return values
booleanindicating if replies were found (true) or not (false).
Not Yet Supported:
This routine currently ignores 'related_request_id', and will return with success if any 'min_count' replies are available.

© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.