OpenDDS::FaceTSS::Listener< Msg > Class Template Reference

#include <FaceTSS.h>

Inheritance diagram for OpenDDS::FaceTSS::Listener< Msg >:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::FaceTSS::Listener< Msg >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef void(* Callback )(FACE::TRANSACTION_ID_TYPE, Msg &, FACE::MESSAGE_TYPE_GUID, FACE::MESSAGE_SIZE_TYPE, const FACE::WAITSET_TYPE, FACE::RETURN_CODE_TYPE &)

Public Member Functions

 Listener (Callback callback, FACE::CONNECTION_ID_TYPE connection_id)
void add_callback (Callback callback)

Private Types

typedef ACE_SYNCH_MUTEX LockType
typedef ACE_Guard< LockTypeGuardType

Private Member Functions

void on_requested_deadline_missed (DDS::DataReader_ptr, const DDS::RequestedDeadlineMissedStatus &)
void on_requested_incompatible_qos (DDS::DataReader_ptr, const DDS::RequestedIncompatibleQosStatus &)
void on_sample_rejected (DDS::DataReader_ptr, const DDS::SampleRejectedStatus &)
void on_liveliness_changed (DDS::DataReader_ptr, const DDS::LivelinessChangedStatus &)
void on_subscription_matched (DDS::DataReader_ptr, const DDS::SubscriptionMatchedStatus &)
void on_sample_lost (DDS::DataReader_ptr, const DDS::SampleLostStatus &)
void on_data_available (DDS::DataReader_ptr reader)
 OPENDDS_VECTOR (Callback) callbacks_

Private Attributes

LockType callbacks_lock_
const FACE::CONNECTION_ID_TYPE connection_id_

Detailed Description

template<typename Msg>
class OpenDDS::FaceTSS::Listener< Msg >

Definition at line 276 of file FaceTSS.h.


Member Typedef Documentation

template<typename Msg>
typedef void(* OpenDDS::FaceTSS::Listener< Msg >::Callback)(FACE::TRANSACTION_ID_TYPE, Msg &, FACE::MESSAGE_TYPE_GUID, FACE::MESSAGE_SIZE_TYPE, const FACE::WAITSET_TYPE, FACE::RETURN_CODE_TYPE &)

Definition at line 278 of file FaceTSS.h.

template<typename Msg>
typedef ACE_Guard<LockType> OpenDDS::FaceTSS::Listener< Msg >::GuardType [private]

Definition at line 356 of file FaceTSS.h.

template<typename Msg>
typedef ACE_SYNCH_MUTEX OpenDDS::FaceTSS::Listener< Msg >::LockType [private]

Definition at line 355 of file FaceTSS.h.


Constructor & Destructor Documentation

template<typename Msg>
OpenDDS::FaceTSS::Listener< Msg >::Listener ( Callback  callback,
FACE::CONNECTION_ID_TYPE  connection_id 
) [inline]

Definition at line 284 of file FaceTSS.h.

00285     : connection_id_(connection_id)
00286   {
00287     callbacks_.push_back(callback);
00288   }


Member Function Documentation

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::add_callback ( Callback  callback  )  [inline]

Definition at line 290 of file FaceTSS.h.

Referenced by OpenDDS::FaceTSS::register_callback().

00290                                        {
00291     GuardType guard(callbacks_lock_);
00292     callbacks_.push_back(callback);
00293   }

Here is the caller graph for this function:

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_data_available ( DDS::DataReader_ptr  reader  )  [inline, private]

Definition at line 313 of file FaceTSS.h.

References DataReader, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::FaceTSS::Entities::instance(), LM_DEBUG, LM_ERROR, OpenDDS::FaceTSS::populate_header_received(), OpenDDS::FaceTSS::Entities::receivers_, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_OK, OpenDDS::FaceTSS::update_status(), and DDS::SampleInfo::valid_data.

00314   {
00315     typedef typename DCPS::DDSTraits<Msg>::DataReaderType DataReader;
00316     const typename DataReader::_var_type typedReader =
00317       DataReader::_narrow(reader);
00318     if (!typedReader) {
00319       update_status(connection_id_, DDS::RETCODE_BAD_PARAMETER);
00320       return;
00321     }
00322 
00323     FACE::MESSAGE_TYPE_GUID& msg_id = Entities::instance()->connections_[connection_id_].platform_view_guid;
00324     Msg sample;
00325     DDS::SampleInfo sinfo;
00326     while (typedReader->take_next_sample(sample, sinfo) == DDS::RETCODE_OK) {
00327       if (sinfo.valid_data) {
00328         DDS::Subscriber_var subscriber = typedReader->get_subscriber();
00329         DDS::DomainParticipant_var participant = subscriber->get_participant();
00330         FACE::RETURN_CODE_TYPE ret_code;
00331         populate_header_received(connection_id_, participant, sinfo, ret_code);
00332         if (ret_code != FACE::RC_NO_ERROR) {
00333           update_status(connection_id_, ret_code);
00334           return;
00335         }
00336 
00337         FACE::TRANSACTION_ID_TYPE transaction_id = ++Entities::instance()->receivers_[connection_id_]->last_msg_tid;
00338         update_status(connection_id_, DDS::RETCODE_OK);
00339         FACE::RETURN_CODE_TYPE retcode;
00340         GuardType guard(callbacks_lock_);
00341         if (OpenDDS::DCPS::DCPS_debug_level > 3) {
00342           ACE_DEBUG((LM_DEBUG, "Listener::on_data_available - invoking %d callbacks\n", callbacks_.size()));
00343         }
00344         for (size_t i = 0; i < callbacks_.size(); ++i) {
00345           retcode = FACE::RC_NO_ERROR;
00346           callbacks_.at(i)(transaction_id /*Transaction_ID*/, sample, msg_id, sizeof(Msg), 0 /*WAITSET_TYPE*/, retcode);
00347           if (retcode != FACE::RC_NO_ERROR) {
00348             ACE_ERROR((LM_ERROR, "ERROR: Listener::on_data_available - callback %d returned retcode: %d\n", i, retcode));
00349           }
00350         }
00351       }
00352     }
00353   }

Here is the call graph for this function:

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_liveliness_changed ( DDS::DataReader_ptr  ,
const DDS::LivelinessChangedStatus  
) [inline, private]

Definition at line 305 of file FaceTSS.h.

00306                                        {}

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_requested_deadline_missed ( DDS::DataReader_ptr  ,
const DDS::RequestedDeadlineMissedStatus  
) [inline, private]

Definition at line 296 of file FaceTSS.h.

00297                                              {}

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_requested_incompatible_qos ( DDS::DataReader_ptr  ,
const DDS::RequestedIncompatibleQosStatus  
) [inline, private]

Definition at line 299 of file FaceTSS.h.

00300                                               {}

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_sample_lost ( DDS::DataReader_ptr  ,
const DDS::SampleLostStatus  
) [inline, private]

Definition at line 311 of file FaceTSS.h.

00311 {}

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_sample_rejected ( DDS::DataReader_ptr  ,
const DDS::SampleRejectedStatus  
) [inline, private]

Definition at line 302 of file FaceTSS.h.

00303                                     {}

template<typename Msg>
void OpenDDS::FaceTSS::Listener< Msg >::on_subscription_matched ( DDS::DataReader_ptr  ,
const DDS::SubscriptionMatchedStatus  
) [inline, private]

Definition at line 308 of file FaceTSS.h.

00309                                          {}

template<typename Msg>
OpenDDS::FaceTSS::Listener< Msg >::OPENDDS_VECTOR ( Callback   )  [private]

Member Data Documentation

template<typename Msg>
LockType OpenDDS::FaceTSS::Listener< Msg >::callbacks_lock_ [private]

Definition at line 357 of file FaceTSS.h.

template<typename Msg>
const FACE::CONNECTION_ID_TYPE OpenDDS::FaceTSS::Listener< Msg >::connection_id_ [private]

Definition at line 359 of file FaceTSS.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1