00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef RtcOutPortBase_h
00036 #define RtcOutPortBase_h
00037
00038 #include <list>
00039 #include <ace/Task.h>
00040
00041 #include "rtm/RTC.h"
00042 #include "rtm/idl/RTCDataTypeSkel.h"
00043 #include "rtm/idl/RTCOutPortSkel.h"
00044 #include "rtm/idl/RTCOutPortStub.h"
00045 #include "rtm/RtcInPortBase.h"
00046 #include "rtm/RtcRingBuffer.h"
00047 #include "rtm/RtcSubscriber.h"
00048
00049
00050 namespace RTM {
00051 class SubscriberBase;
00052
00074 class EXPORTS OutPortBase :
00075 public POA_RTM::OutPort,
00076 public PortableServer::RefCountServantBase
00077 {
00078 public:
00093 OutPortBase()
00094 {
00095 m_Profile.name = _CORBA_String_helper::empty_string;
00096 };
00097
00112 virtual ~OutPortBase(){};
00113
00114
00115
00116
00128 virtual CORBA::Any* get() throw (CORBA::SystemException) = 0;
00129
00131
00132
00133
00134
00135
00147 virtual RtmRes subscribe(SubscriptionProfile &subs)
00148 throw (CORBA::SystemException, RTM::PortBase::InvalidSubscription);
00149
00161 virtual RtmRes notify_subscribe(SubscriptionProfile &subs)
00162 throw (CORBA::SystemException, RTM::PortBase::InvalidSubscription);
00163
00175 virtual RtmRes unsubscribe(const char* id)
00176 throw (CORBA::SystemException, RTM::PortBase::NoSubscription);
00177
00189 virtual RtmRes notify_unsubscribe(const char* id)
00190 throw (CORBA::SystemException, RTM::PortBase::NoSubscription);
00191
00203
00204
00216 virtual PortProfile* profile() throw (CORBA::SystemException);
00217
00229 virtual SubscriptionList* subscriptions();
00230
00231
00232
00233
00234
00235 bool createSubscriber(SubscriptionProfile& subscription);
00247
00248 virtual RtmRes push(InPort_ptr inport, std::string subsid) = 0;
00249
00261 virtual void updateall();
00262
00274 virtual void disconnect_all();
00275
00287 virtual const char* name() {return m_Profile.name;};
00288
00305 virtual void write_pm() = 0;
00306
00307 virtual OutPort_ptr getObjRef();
00308 virtual void setObjRef(OutPort_ptr objref);
00309
00310
00311 protected:
00312 virtual RtmRes unsubscribeNoLocked(const char* id)
00313 throw (CORBA::SystemException, RTM::PortBase::NoSubscription);
00314
00323 typedef std::list<SubscriberBase*>::iterator Subs_it;
00324 struct Subscribers
00325 {
00326 ACE_Thread_Mutex m_Mutex;
00327 std::list<SubscriberBase*> m_List;
00328
00329 class eq_id
00330 {
00331 public:
00332 const std::string m_id;
00333 eq_id(const char* id) : m_id(id){};
00334 bool operator()(SubscriberBase* subs);
00335 };
00336 Subs_it findById(const char* id);
00337 Subs_it eraseById(const char* id);
00338 };
00339 Subscribers m_Subscribers;
00340
00341
00349 PortProfile m_Profile;
00350
00358 OutPort_var m_thisObjRef;
00359
00360
00361
00362 };
00363
00364
00365
00366 };
00367
00368 #endif // RtcOutPortBase_h