00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 00009 #ifndef OPENDDS_DCPS_REPLAYER_H 00010 #define OPENDDS_DCPS_REPLAYER_H 00011 00012 #include "dds/DCPS/PoolAllocator.h" 00013 #include "dds/DCPS/RcObject_T.h" 00014 #include "dds/DCPS/RcHandle_T.h" 00015 #include "dds/DCPS/RawDataSample.h" 00016 00017 namespace OpenDDS { 00018 namespace DCPS { 00019 00020 class Replayer; 00021 00022 /** 00023 * @class ReplayerListener 00024 * 00025 * @brief Listener for handling callbacks from the Replayer 00026 * 00027 * This class is for handling callbacks from the Replayer object. 00028 */ 00029 class OpenDDS_Dcps_Export ReplayerListener : public RcObject<ACE_SYNCH_MUTEX> { 00030 public: 00031 ~ReplayerListener(); 00032 /** 00033 * Callback for when the Replayer is associated with a DataReader. 00034 * @param replayer Replayer that received the association 00035 */ 00036 virtual void on_replayer_matched(Replayer* replayer, 00037 const ::DDS::PublicationMatchedStatus & status ); 00038 }; 00039 00040 typedef RcHandle<ReplayerListener> ReplayerListener_rch; 00041 00042 typedef OPENDDS_VECTOR(RawDataSample) RawDataSampleList; 00043 00044 typedef Replayer* Replayer_ptr; 00045 typedef TAO_Objref_Var_T<Replayer> Replayer_var; 00046 00047 /** 00048 * @class Replayer 00049 * 00050 * @brief Send raw data samples in the system 00051 * 00052 * This class is for sending raw sample data. Combined with data saved from 00053 * a recorder, this allows the data to be replayed to DataReaders. 00054 */ 00055 class OpenDDS_Dcps_Export Replayer { 00056 public: 00057 typedef Replayer_ptr _ptr_type; 00058 typedef Replayer_var _var_type; 00059 00060 virtual ~Replayer(); 00061 00062 static Replayer_ptr _duplicate(Replayer_ptr obj); 00063 00064 virtual void _add_ref() = 0; 00065 virtual void _remove_ref() = 0; 00066 00067 /** 00068 * Send the sample to all associated DataReaders. 00069 * 00070 * @note Only samples of type SAMPLE_DATA should be sent. 00071 */ 00072 virtual DDS::ReturnCode_t write (const RawDataSample& sample )=0; 00073 00074 /** 00075 * Send the sample to the specified DataReader. 00076 * 00077 * @note Only samples of type SAMPLE_DATA should be sent. 00078 */ 00079 virtual DDS::ReturnCode_t write_to_reader (DDS::InstanceHandle_t subscription, // from PublicationMatchedStatus 00080 const RawDataSample& sample )=0; 00081 00082 /** 00083 * Send the samples to the specified DataReader. 00084 * 00085 * @note Only samples of type SAMPLE_DATA should be sent. 00086 */ 00087 virtual DDS::ReturnCode_t write_to_reader (DDS::InstanceHandle_t subscription, // from PublicationMatchedStatus 00088 const RawDataSampleList& samples )=0; 00089 00090 /** 00091 * Set the Quality of Service settings for the Replayer. 00092 * 00093 */ 00094 virtual DDS::ReturnCode_t set_qos (const ::DDS::PublisherQos & publisher_qos, 00095 const DDS::DataWriterQos & datawriter_qos)=0; 00096 00097 /** 00098 * Get the Quality of Service settings for the Replayer. 00099 * 00100 */ 00101 virtual DDS::ReturnCode_t get_qos (DDS::PublisherQos & publisher_qos, 00102 DDS::DataWriterQos & datawriter_qos)=0; 00103 00104 /** 00105 * Change the listener for this Replayer. 00106 * 00107 */ 00108 virtual DDS::ReturnCode_t set_listener (const ReplayerListener_rch & a_listener, 00109 DDS::StatusMask mask = DEFAULT_STATUS_MASK)=0; 00110 00111 /** 00112 * Get the listener for this Replayer. 00113 * 00114 */ 00115 virtual ReplayerListener_rch get_listener() = 0; 00116 }; 00117 00118 } 00119 } 00120 00121 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00122 00123 namespace TAO { 00124 00125 template<> 00126 struct OpenDDS_Dcps_Export Objref_Traits<OpenDDS::DCPS::Replayer> { 00127 static OpenDDS::DCPS::Replayer_ptr duplicate(OpenDDS::DCPS::Replayer_ptr p); 00128 static void release(OpenDDS::DCPS::Replayer_ptr p); 00129 static OpenDDS::DCPS::Replayer_ptr nil(); 00130 static CORBA::Boolean marshal(const OpenDDS::DCPS::Replayer_ptr p, 00131 TAO_OutputCDR& cdr); 00132 }; 00133 00134 } // namespace TAO 00135 00136 TAO_END_VERSIONED_NAMESPACE_DECL 00137 00138 00139 #endif /* end of include guard: OPENDDS_DCPS_REPLAYER_H */