CORBAServantBase.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #ifndef DOIL_CORBA_CORBASERVANTBASE_H
00020 #define DOIL_CORBA_CORBASERVANTBASE_H
00021 
00022 #include <string>
00023 #include <rtm/config_rtc.h>
00024 #include <doil/ServantBase.h>
00025 #include <doil/ImplBase.h>
00026 #include <doil/corba/CORBA.h>
00027 
00028 namespace doil
00029 {
00030 namespace CORBA
00031 {
00032   class CORBAServantBase
00033     : public doil::ServantBase,
00034 #ifdef RTC_CORBA_CXXMAPPING11
00035       public virtual PortableServer::ServantBase
00036 #else
00037       public virtual PortableServer::RefCountServantBase
00038 #endif
00039   {
00040   public:
00041     CORBAServantBase(ImplBase* impl)
00042       : m_refcount(1), m_id(impl->id()), m_name(impl->name())
00043     {
00044     }
00045     virtual ~CORBAServantBase(){}
00046 
00047     virtual const char* id() const
00048     {
00049       return m_id.c_str();
00050     }
00051 
00052     virtual const char* name() const
00053     {
00054       return m_name.c_str();
00055     }
00056 
00057     virtual void incRef()
00058     {
00059       ++m_refcount;
00060     }
00061 
00062     virtual void decRef()
00063     {
00064       --m_refcount;
00065       if (m_refcount == 0)
00066         delete this;
00067     }
00068 
00069   protected:
00070     int m_refcount;
00071     std::string m_id;
00072     std::string m_name;
00073 
00074   };
00075 }; // namespoace doil
00076 }; // namespace CORBA
00077 #endif // DOIL_CORBA_CORBASERVANTBASE_H
00078 


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:37