LoggerConsumer.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #include <coil/stringutil.h>
00020 #include <rtm/Typename.h>
00021 #include "LoggerSkel.h"
00022 #include "LoggerConsumer.h"
00023 #include <iostream>
00024 
00025 namespace RTC
00026 {
00034   LoggerConsumer::LoggerConsumer()
00035     : m_rtobj(NULL)
00036   {
00037   }
00038 
00046   LoggerConsumer::~LoggerConsumer()
00047   {
00048   }
00049 
00057   bool
00058   LoggerConsumer::init(RTObject_impl& rtobj,
00059                        const SDOPackage::ServiceProfile& profile)
00060   {
00061     if (!m_logger.setObject(profile.service))
00062       {
00063         // narrowing failed
00064         return false;
00065       }
00066 
00067     m_rtobj = &rtobj;
00068     m_profile = profile;
00069     coil::Properties prop;
00070     NVUtil::copyToProperties(prop, profile.properties);
00071     return true;
00072   }
00073 
00081   bool
00082   LoggerConsumer::reinit(const SDOPackage::ServiceProfile& profile)
00083   {
00084     if (!m_logger._ptr()->_is_equivalent(profile.service))
00085       {
00086         CorbaConsumer<OpenRTM::Logger> tmp;
00087         if (!tmp.setObject(profile.service))
00088           {
00089             return false;
00090           }
00091         m_logger.releaseObject();
00092         m_logger.setObject(profile.service);
00093       }
00094     m_profile= profile;
00095     coil::Properties prop;
00096     NVUtil::copyToProperties(prop, profile.properties);
00097     return true;
00098   }
00099 
00107   const SDOPackage::ServiceProfile&
00108   LoggerConsumer::getProfile() const
00109   {
00110     return m_profile;
00111   }  
00112 
00120   void LoggerConsumer::finalize()
00121   {
00122   }
00123 
00124   //============================================================
00125   // protected functions
00126  
00127 }; // namespace RTC
00128 
00129 extern "C"
00130 {
00131   void LoggerConsumerInit()
00132   {
00133     RTC::SdoServiceConsumerFactory& factory
00134       = RTC::SdoServiceConsumerFactory::instance();
00135     factory.addFactory(CORBA_Util::toRepositoryId<OpenRTM::Logger>(),
00136                        ::coil::Creator< ::RTC::SdoServiceConsumerBase,
00137                        ::RTC::LoggerConsumer>,
00138                        ::coil::Destructor< ::RTC::SdoServiceConsumerBase,
00139                        ::RTC::LoggerConsumer>);
00140   }
00141 };


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:04