OpenDDS::Federator::UpdateListener< DataType, ReaderType > Class Template Reference

#include <UpdateListener_T.h>

Inheritance diagram for OpenDDS::Federator::UpdateListener< DataType, ReaderType >:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::Federator::UpdateListener< DataType, ReaderType >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 UpdateListener (UpdateProcessor< DataType > &processor)
 Default constructor.
virtual ~UpdateListener ()
 Virtual destructor.
virtual void on_requested_deadline_missed (DDS::DataReader_ptr reader, const DDS::RequestedDeadlineMissedStatus &status)
virtual void on_requested_incompatible_qos (DDS::DataReader_ptr reader, const DDS::RequestedIncompatibleQosStatus &status)
virtual void on_liveliness_changed (DDS::DataReader_ptr reader, const DDS::LivelinessChangedStatus &status)
virtual void on_subscription_matched (DDS::DataReader_ptr reader, const DDS::SubscriptionMatchedStatus &status)
virtual void on_sample_rejected (DDS::DataReader_ptr reader, const DDS::SampleRejectedStatus &status)
virtual void on_data_available (DDS::DataReader_ptr reader)
virtual void on_sample_lost (DDS::DataReader_ptr reader, const DDS::SampleLostStatus &status)
void federationId (const TAO_DDS_DCPSFederationId &id)
 Access our Federation Id value.
const TAO_DDS_DCPSFederationIdfederationId () const
void stop ()
void join ()

Private Attributes

TAO_DDS_DCPSFederationId federationId_
 Our Federation Id value.
UpdateReceiver< DataType > receiver_
 Manager object to delegate sample processing to.

Detailed Description

template<class DataType, class ReaderType>
class OpenDDS::Federator::UpdateListener< DataType, ReaderType >

Definition at line 24 of file UpdateListener_T.h.


Constructor & Destructor Documentation

template<class DataType, class ReaderType>
OpenDDS::Federator::UpdateListener< DataType, ReaderType >::UpdateListener ( UpdateProcessor< DataType > &  processor  ) 

Default constructor.

Definition at line 16 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00017   : federationId_(NIL_REPOSITORY),
00018     receiver_(processor)
00019 {
00020   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00021     ACE_DEBUG((LM_DEBUG,
00022                ACE_TEXT("(%P|%t) UpdateListener::UpdateListener\n")));
00023   }
00024 }

template<class DataType, class ReaderType>
OpenDDS::Federator::UpdateListener< DataType, ReaderType >::~UpdateListener (  )  [virtual]

Virtual destructor.

Definition at line 27 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00028 {
00029   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00030     ACE_DEBUG((LM_DEBUG,
00031                ACE_TEXT("(%P|%t) UpdateListener::~UpdateListener\n")));
00032   }
00033 }


Member Function Documentation

template<class DataType, class ReaderType>
const TAO_DDS_DCPSFederationId & OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId (  )  const

Definition at line 44 of file UpdateListener_T.cpp.

References OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId_.

00045 {
00046   return this->federationId_;
00047 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId ( const TAO_DDS_DCPSFederationId id  ) 

Access our Federation Id value.

Definition at line 37 of file UpdateListener_T.cpp.

References OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId_.

00038 {
00039   this->federationId_ = id;
00040 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::join (  ) 

Definition at line 183 of file UpdateListener_T.cpp.

References OpenDDS::Federator::UpdateListener< DataType, ReaderType >::receiver_.

00184 {
00185   this->receiver_.wait();
00186 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_data_available ( DDS::DataReader_ptr  reader  )  [virtual]

Definition at line 51 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level, OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId_, TAO_DDS_DCPSFederationId::id(), DDS::RETCODE_NO_DATA, and DDS::RETCODE_OK.

00053 {
00054   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00055     ACE_DEBUG((LM_DEBUG,
00056                ACE_TEXT("(%P|%t) UpdateListener::on_data_available\n")));
00057   }
00058 
00059   try {
00060     // Get the type specific reader.
00061     typename ReaderType::_var_type dataReader = ReaderType::_narrow(reader);
00062 
00063     if (CORBA::is_nil(dataReader.in())) {
00064       ACE_ERROR((LM_ERROR,
00065                  ACE_TEXT("(%P|%t) UpdateListener::on_data_available - _narrow failed.\n")));
00066       return;
00067     }
00068 
00069     // Process all available data.
00070     while (true) {
00071       DataType*           sample = new DataType();
00072       DDS::SampleInfo*  info   = new DDS::SampleInfo();
00073       DDS::ReturnCode_t status = dataReader->read_next_sample(*sample, *info);
00074 
00075       if (status == DDS::RETCODE_OK) {
00076         // Check if we should process the sample.
00077         if (this->federationId_.overridden() &&
00078             this->federationId_.id() != sample->sender) {
00079 
00080           // Delegate processing to the federation manager.
00081           this->receiver_.add(sample, info);
00082         }
00083 
00084       } else if (status == DDS::RETCODE_NO_DATA) {
00085         break;
00086 
00087       } else {
00088         ACE_ERROR((LM_ERROR,
00089                    ACE_TEXT("(%P|%t) ERROR: UpdateListener::on_data_available: read status==%d\n"),
00090                    status));
00091         break;
00092       }
00093     }
00094 
00095   } catch (const CORBA::Exception& ex) {
00096     ex._tao_print_exception("(%P|%t) UpdateListener::read - ");
00097   }
00098 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_liveliness_changed ( DDS::DataReader_ptr  reader,
const DDS::LivelinessChangedStatus status 
) [virtual]

Definition at line 128 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00131 {
00132   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00133     ACE_DEBUG((LM_DEBUG,
00134                ACE_TEXT("(%P|%t) UpdateListener::on_liveliness_changed\n")));
00135   }
00136 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_requested_deadline_missed ( DDS::DataReader_ptr  reader,
const DDS::RequestedDeadlineMissedStatus status 
) [virtual]

Definition at line 102 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00105 {
00106   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00107     ACE_DEBUG((LM_DEBUG,
00108                ACE_TEXT("(%P|%t) ")
00109                ACE_TEXT("Federatorer::on_requested_deadline_missed\n")));
00110   }
00111 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_requested_incompatible_qos ( DDS::DataReader_ptr  reader,
const DDS::RequestedIncompatibleQosStatus status 
) [virtual]

Definition at line 115 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00118 {
00119   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00120     ACE_DEBUG((LM_DEBUG,
00121                ACE_TEXT("(%P|%t) UpdateListener::")
00122                ACE_TEXT("on_requested_incompatible_qos\n")));
00123   }
00124 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_sample_lost ( DDS::DataReader_ptr  reader,
const DDS::SampleLostStatus status 
) [virtual]

Definition at line 164 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00167 {
00168   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00169     ACE_DEBUG((LM_DEBUG,
00170                ACE_TEXT("(%P|%t) UpdateListener::on_sample_lost\n")));
00171   }
00172 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_sample_rejected ( DDS::DataReader_ptr  reader,
const DDS::SampleRejectedStatus status 
) [virtual]

Definition at line 152 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00155 {
00156   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00157     ACE_DEBUG((LM_DEBUG,
00158                ACE_TEXT("(%P|%t) UpdateListener::on_sample_rejected\n")));
00159   }
00160 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_subscription_matched ( DDS::DataReader_ptr  reader,
const DDS::SubscriptionMatchedStatus status 
) [virtual]

Definition at line 140 of file UpdateListener_T.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

00143 {
00144   if (OpenDDS::DCPS::DCPS_debug_level > 0) {
00145     ACE_DEBUG((LM_DEBUG,
00146                ACE_TEXT("(%P|%t) UpdateListener::on_subscription_matched\n")));
00147   }
00148 }

template<class DataType, class ReaderType>
void OpenDDS::Federator::UpdateListener< DataType, ReaderType >::stop (  ) 

Definition at line 176 of file UpdateListener_T.cpp.

References OpenDDS::Federator::UpdateListener< DataType, ReaderType >::receiver_.

00177 {
00178   this->receiver_.stop();
00179 }


Member Data Documentation

template<class DataType, class ReaderType>
TAO_DDS_DCPSFederationId OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId_ [private]

Our Federation Id value.

Definition at line 69 of file UpdateListener_T.h.

Referenced by OpenDDS::Federator::UpdateListener< DataType, ReaderType >::federationId(), and OpenDDS::Federator::UpdateListener< DataType, ReaderType >::on_data_available().

template<class DataType, class ReaderType>
UpdateReceiver<DataType> OpenDDS::Federator::UpdateListener< DataType, ReaderType >::receiver_ [private]

Manager object to delegate sample processing to.

Definition at line 72 of file UpdateListener_T.h.

Referenced by OpenDDS::Federator::UpdateListener< DataType, ReaderType >::join(), and OpenDDS::Federator::UpdateListener< DataType, ReaderType >::stop().


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