SubscriptionInstance.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_SUBSCRIPTION_INSTANCE_H
00009 #define OPENDDS_DCPS_SUBSCRIPTION_INSTANCE_H
00010 
00011 #include "ace/OS_Memory.h"
00012 
00013 #include "dds/DdsDcpsInfrastructureC.h"
00014 
00015 #include "dcps_export.h"
00016 #include "ReceivedDataElementList.h"
00017 #include "ReceivedDataStrategy.h"
00018 #include "InstanceState.h"
00019 #include "PoolAllocationBase.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 #pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 namespace OpenDDS {
00026 namespace DCPS {
00027 
00028 class DataReaderImpl;
00029 
00030 /**
00031   * @class SubscriptionInstance
00032   *
00033   * @brief Struct that has information about an instance and the instance
00034   *        sample list.
00035   */
00036 class SubscriptionInstance : public PoolAllocationBase {
00037 public:
00038   SubscriptionInstance(DataReaderImpl *reader,
00039                        const DDS::DataReaderQos& qos,
00040                        ACE_Recursive_Thread_Mutex& lock,
00041                        DDS::InstanceHandle_t handle)
00042     : instance_state_(reader, lock, handle),
00043       last_sequence_(),
00044       rcvd_samples_(&instance_state_),
00045       rcvd_strategy_(0),
00046       instance_handle_(handle),
00047       deadline_timer_id_(-1)
00048   {
00049     switch (qos.destination_order.kind) {
00050     case DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS:
00051       ACE_NEW_NORETURN(this->rcvd_strategy_,
00052                        ReceptionDataStrategy(this->rcvd_samples_));
00053       break;
00054 
00055     case DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS:
00056       ACE_NEW_NORETURN(this->rcvd_strategy_,
00057                        SourceDataStrategy(this->rcvd_samples_));
00058       break;
00059     }
00060 
00061     if (this->rcvd_strategy_ == 0) {
00062       ACE_ERROR((LM_ERROR,
00063                  ACE_TEXT("(%P|%t) ERROR: SubscriptionInstance: ")
00064                  ACE_TEXT(" unable to allocate ReceiveDataStrategy!\n")));
00065     }
00066   }
00067 
00068   ~SubscriptionInstance()
00069   {
00070     delete this->rcvd_strategy_;
00071   }
00072 
00073   /// Instance state for this instance
00074   InstanceState instance_state_ ;
00075 
00076   /// sequence number of the move recect data sample received
00077   SequenceNumber last_sequence_ ;
00078 
00079   /// Data sample(s) in this instance
00080   ReceivedDataElementList rcvd_samples_ ;
00081 
00082   /// ReceivedDataElementList strategy
00083   ReceivedDataStrategy* rcvd_strategy_;
00084 
00085   /// The instance handle for the registered object
00086   DDS::InstanceHandle_t instance_handle_;
00087 
00088   ACE_Time_Value   last_sample_tv_;
00089 
00090   ACE_Time_Value   cur_sample_tv_;
00091 
00092   long             deadline_timer_id_;
00093 
00094   ACE_Time_Value   last_accepted_;
00095 };
00096 
00097 } // namespace DCPS
00098 } // namespace OpenDDS
00099 
00100 #endif /* OPENDDS_DCPS_SUBSCRIPTION_INSTANCE_H */

Generated on Fri Feb 12 20:05:27 2016 for OpenDDS by  doxygen 1.4.7