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 264 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 266 of file FaceTSS.h.

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

Definition at line 343 of file FaceTSS.h.

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

Definition at line 342 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 272 of file FaceTSS.h.

00273     : connection_id_(connection_id)
00274   {
00275     callbacks_.push_back(callback);
00276   }


Member Function Documentation

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

Definition at line 278 of file FaceTSS.h.

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

00278                                        {
00279     GuardType guard(callbacks_lock_);
00280     callbacks_.push_back(callback);
00281   }

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

Definition at line 301 of file FaceTSS.h.

References DataReader, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::FaceTSS::Entities::instance(), 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.

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

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

Definition at line 293 of file FaceTSS.h.

00294                                        {}

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

Definition at line 284 of file FaceTSS.h.

00285                                              {}

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

Definition at line 287 of file FaceTSS.h.

00288                                               {}

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

Definition at line 299 of file FaceTSS.h.

00299 {}

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

Definition at line 290 of file FaceTSS.h.

00291                                     {}

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

Definition at line 296 of file FaceTSS.h.

00297                                          {}

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 344 of file FaceTSS.h.

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

Definition at line 346 of file FaceTSS.h.


The documentation for this class was generated from the following file:
Generated on Fri Feb 12 20:06:46 2016 for OpenDDS by  doxygen 1.4.7