00001 // -*- C++ -*- 00019 /* 00020 * $Log: OutPortBase.h,v $ 00021 * Revision 1.1 2006/12/02 18:46:13 n-ando 00022 * The first commitment. 00023 * 00024 * Revision 1.3 2005/05/27 07:34:21 n-ando 00025 * - InPort/OutPort interface was changed. 00026 * subscribe/unsubscribe were completely changed. 00027 * 00028 * Revision 1.2 2005/05/16 06:37:11 n-ando 00029 * - OutPortBase class was DLL exported for Windows port. 00030 * - m_Profile.name should be initialized with empty string. 00031 * 00032 * Revision 1.1.1.1 2005/05/12 09:06:18 n-ando 00033 * Public release. 00034 * 00035 * 00036 */ 00037 00038 #ifndef RtcOutPortBase_h 00039 #define RtcOutPortBase_h 00040 00041 #include <vector> 00042 #include <string> 00043 00044 namespace RTC 00045 { 00046 class PublisherBase; 00070 class OutPortBase 00071 { 00072 public: 00087 OutPortBase(const char* name) 00088 : m_name(name) 00089 { 00090 }; 00091 00092 00107 virtual ~OutPortBase(); 00108 00109 00124 inline const char* name() {return m_name.c_str();} 00125 00126 00141 void attach(const char* id, PublisherBase* publisher); 00142 00157 void attach_front(const char* id, PublisherBase* publisher); 00158 00173 void attach_back(const char* id, PublisherBase* publisher); 00174 00189 PublisherBase* detach(const char* id); 00190 00191 00206 void notify(); 00207 00208 protected: 00209 std::string m_name; 00210 00214 struct Publisher 00215 { 00216 Publisher(const char* _id, PublisherBase* _publisher) 00217 : id(_id), publisher(_publisher){}; 00218 std::string id; 00219 PublisherBase* publisher; 00220 }; 00221 00225 std::vector<Publisher*> m_publishers; 00226 00227 00228 // Functor to find Publisher by id 00229 struct find_id; 00230 00231 // Functor to notify update to Publishers 00232 struct pub_push; 00233 00234 // Functor to delete Publishers 00235 struct pub_del; 00236 00237 }; 00238 00239 00240 00241 }; // End of namespace RTM 00242 00243 #endif // RtcOutPortBase_h