00001 // -*- C++ -*- 00020 #ifndef RtcOutPortBase_h 00021 #define RtcOutPortBase_h 00022 00023 #include <vector> 00024 #include <string> 00025 00026 namespace RTC 00027 { 00028 class PublisherBase; 00060 class OutPortBase 00061 { 00062 public: 00080 OutPortBase(const char* name) 00081 : m_name(name) 00082 { 00083 }; 00084 00101 virtual ~OutPortBase(); 00102 00121 inline const char* name() {return m_name.c_str();} 00122 00146 void attach(const char* id, PublisherBase* publisher); 00147 00168 void attach_front(const char* id, PublisherBase* publisher); 00169 00190 void attach_back(const char* id, PublisherBase* publisher); 00191 00217 PublisherBase* detach(const char* id); 00218 00233 void notify(); 00234 00235 protected: 00243 std::string m_name; 00244 00252 struct Publisher 00253 { 00254 Publisher(const char* _id, PublisherBase* _publisher) 00255 : id(_id), publisher(_publisher){}; 00256 std::string id; 00257 PublisherBase* publisher; 00258 }; 00259 00267 std::vector<Publisher*> m_publishers; 00268 00276 // Functor to find Publisher by id 00277 struct find_id; 00278 00286 // Functor to notify update to Publishers 00287 struct pub_push; 00288 00296 // Functor to delete Publishers 00297 struct pub_del; 00298 }; 00299 }; // End of namespace RTM 00300 #endif // RtcOutPortBase_h