00001 00023 #ifndef SUBSCRIBER_H_ 00024 #define SUBSCRIBER_H_ 00025 00026 #include <iostream> 00027 #include <string.h> 00028 #include <boost/function.hpp> 00029 #include <boost/bind.hpp> 00030 #include "ccpp_dds_dcps.h" 00031 #include "check_status.h" 00032 #include "ccpp_GSDFPacket.h" 00033 #include "example_main.h" 00034 #include "GSDFPacket_listener.h" 00035 00036 using namespace DDS; 00037 00038 namespace opensplice_dds_broker{ 00039 class Subscriber 00040 { 00041 public: 00042 Subscriber(const std::string& topic_name); 00043 void subscribe(void (*callBack)(const GSDFPacket& packet)); 00044 void subscribe(boost::function<void(const GSDFPacket&)> callBack); 00045 ~Subscriber(); 00046 private: 00047 DomainId_t domain; 00048 ReturnCode_t status; 00049 const char *topic_name_; 00050 char *GSDFPacketTypeName; 00051 00052 //Generic DDS entities 00053 DomainParticipantFactory_var dpf; 00054 DomainParticipant_var participant; 00055 Topic_var GSDFPacketTopic; 00056 Subscriber_var subscriber_; 00057 DataReader_ptr parentReader; 00058 00059 GSDFPacketTypeSupport_var GSDFPacketTS; 00060 GSDFPacketDataReader_var GSDFPacketDR; 00061 00062 //QosPolicy holders 00063 TopicQos topic_qos; 00064 SubscriberQos sub_qos; 00065 DataReaderQos dr_qos; 00066 }; 00067 }; 00068 00069 #endif 00070