PeriodicECSharedComposite.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef RTC_PERIODICECSHAREDCOMPOSITE_H
21 #define RTC_PERIODICECSHAREDCOMPOSITE_H
22 
23 #include <rtm/idl/RTCSkel.h>
24 #include <rtm/idl/OpenRTMSkel.h>
25 #include <rtm/RTObject.h>
27 #include <rtm/SdoOrganization.h>
28 #include <coil/stringutil.h>
29 
45 #ifdef WIN32
46 #pragma warning( disable : 4290 )
47 #endif
48 
49 namespace SDOPackage
50 {
67  : public Organization_impl
68  {
69  typedef std::vector<std::string> PortList;
70 
71  public:
103  virtual ~PeriodicECOrganization(void);
104 
127  virtual ::CORBA::Boolean add_members(const SDOList& sdo_list)
128  throw (::CORBA::SystemException,
129  InvalidParameter, NotAvailable, InternalError);
130 
154  virtual ::CORBA::Boolean set_members(const SDOList& sdos)
155  throw (::CORBA::SystemException,
156  InvalidParameter, NotAvailable, InternalError);
157 
179  virtual ::CORBA::Boolean remove_member(const char* id)
180  throw (::CORBA::SystemException,
181  InvalidParameter, NotAvailable, InternalError);
182 
190  void removeAllMembers(void);
198  void updateDelegatedPorts(void);
199 
200  protected:
201  class Member;
209  bool sdoToDFC(const SDO_ptr sdo, ::OpenRTM::DataFlowComponent_ptr& dfc);
210 
218  void stopOwnedEC(Member& member);
219 
227  void startOwnedEC(Member& member);
228 
236  void addOrganizationToTarget(Member& member);
237 
245  void removeOrganizationFromTarget(Member& member);
246 
254  void addParticipantToEC(Member& member);
255 
263  void removeParticipantFromEC(Member& member);
264 
272  void addPort(Member& member, PortList& portlist);
273 
281  void removePort(Member& member, PortList& portlist);
282 
290  void updateExportedPortsList(void);
291 
292  protected:
301 
310 
318  ::RTC::ExecutionContext_var m_ec;
319 
320  class Member
321  {
322  public:
323  Member(RTC::RTObject_ptr rtobj)
324  // : rtobj_(rtobj),
325  // profile_(rtobj->get_component_profile()),
326  // eclist_(rtobj->get_owned_contexts()),
327  // config_(rtobj->get_configuration())
328  {
329  rtobj_ = RTC::RTObject::_duplicate(rtobj);
330  profile_ = rtobj->get_component_profile();
331  eclist_ = rtobj->get_owned_contexts();
332  config_ = rtobj->get_configuration();
333  }
334 
335  virtual ~Member(void)
336  {
337  /*
338  rtobj_.out();
339  profile_.out();
340  eclist_.out();
341  config_.out();
342  */
343  }
344 
345  Member(const Member& x)
346  // : rtobj_(x.rtobj_),
347  // profile_(x.profile_),
348  // eclist_(x.eclist_),
349  // config_(x.config_)
350  {
351  rtobj_ = x.rtobj_;
352  profile_ = x.profile_;
353  eclist_ = x.eclist_;
354  config_ = x.config_;
355  }
356 
358  {
359 // std::cout << "####################op=" << std::endl;
360  Member tmp(x);
361  tmp.swap(*this);
362  return *this;
363  }
364 //
365  void swap(Member& x)
366  {
367  RTC::RTObject_var rtobj(x.rtobj_);
368  RTC::ComponentProfile_var profile(x.profile_);
369  RTC::ExecutionContextList_var eclist(x.eclist_);
370  SDOPackage::Configuration_var config(x.config_);
371 
372  x.rtobj_ = this->rtobj_;
373  x.profile_ = this->profile_;
374  x.eclist_ = this->eclist_;
375  x.config_ = this->config_;
376 
377  this->rtobj_ = rtobj;
378  this->profile_ = profile;
379  this->eclist_ = eclist;
380  this->config_ = config;
381  }
382 
383  RTC::RTObject_var rtobj_;
384  RTC::ComponentProfile_var profile_;
385  RTC::ExecutionContextList_var eclist_;
386  SDOPackage::Configuration_var config_;
387  };
388 
396  std::vector<Member> m_rtcMembers;
397  typedef std::vector<Member>::iterator MemIt;
398 
406  PortList m_expPorts;
407 
415  void print(PortList p)
416  {
417  for (int i(0), len(p.size()); i < len; ++i)
418  {
419  std::cout << p[i] << std::endl;
420  }
421  }
422  };
423 };
424 
425 
440 namespace RTC
441 {
442  class Manager;
443 
467  : public RTObject_impl
468  {
469  public:
488 
502  virtual ~PeriodicECSharedComposite(void);
503 
519  virtual ReturnCode_t onInitialize(void);
551  virtual ReturnCode_t onActivated(RTC::UniqueId exec_handle);
583  virtual ReturnCode_t onDeactivated(RTC::UniqueId exec_handle);
584 
615  virtual ReturnCode_t onReset(RTC::UniqueId exec_handle);
640  virtual ReturnCode_t onFinalize(void);
641 
642  protected:
650  std::vector<std::string> m_members;
651 
659  OpenRTM::DataFlowComponent_var m_ref;
660 // PeriodicExecutionContext* m_pec;
661 // ExecutionContextService_var m_ecref;
670  }; // class PeriodicECOrganization
671 }; // namespace RTC
672 
673 #ifdef WIN32
674 #pragma warning( default : 4290 )
675 #endif
676 
677 
678 extern "C"
679 {
681 };
682 
683 #endif // RTC_PERIODICECSHAREDCOMPOSITE_H
void removeAllMembers(void)
Remove a member of Organization.
RT-Component.
::RTC::ExecutionContext_var m_ec
ExecutionContext Object reference.
SDOPackage::PeriodicECOrganization * m_org
Reference of Organization.
ReturnCode_t
Definition: doil.h:53
::RTC::RTObject_impl * m_rtobj
RT Object.
std::vector< std::string > m_members
Components.
void stopOwnedEC(Member &member)
Stop Owned ExecutionContexts.
RT-Component class.
Definition: RTObject.h:89
Manager class.
Definition: Manager.h:80
bool sdoToDFC(const SDO_ptr sdo,::OpenRTM::DataFlowComponent_ptr &dfc)
Conversion from SDO to DFC.
SDO Organization implementation class.
std::vector< Member > m_rtcMembers
Member list.
SDO Package.
ExecutionContextHandle_t UniqueId
OpenRTM::DataFlowComponent_var m_ref
Reference of object.
Organization implementation class.
#define DLL_EXPORT
Definition: PluginC.cpp:8
void updateExportedPortsList(void)
PortsList is updated.
Logger class.
Definition: SystemLogger.h:99
virtual ::CORBA::Boolean remove_member(const char *id)
[CORBA interface] Remove a member of Organization
void addPort(Member &member, PortList &portlist)
Delegate given RTC&#39;s ports to the Composite.
DLL_EXPORT void PeriodicECSharedCompositeInit(RTC::Manager *manager)
void startOwnedEC(Member &member)
Start Owned ExecutionContexts.
void removeParticipantFromEC(Member &member)
Remove participant DFC from CompositeRTC&#39;s ExecutionContext.
virtual ::CORBA::Boolean set_members(const SDOList &sdos)
[CORBA interface] Set Organization member
PeriodicExecutionContext class.
void print(PortList p)
Output PortList to StandardOutput.
void removeOrganizationFromTarget(Member &member)
Remove Organization object from a target DFC.
virtual ~PeriodicECOrganization(void)
Destructor.
void removePort(Member &member, PortList &portlist)
Remove delegated participatns&#39;s ports from the composite.
std::vector< Member >::iterator MemIt
void addParticipantToEC(Member &member)
Set CompositeRTC&#39;s ExecutionContext to the given DFC.
virtual ::CORBA::Boolean add_members(const SDOList &sdo_list)
[CORBA interface] Add Organization member
void addOrganizationToTarget(Member &member)
Set Organization object to target DFC.
void updateDelegatedPorts(void)
Update/Remove a member of Organization.
PeriodicECOrganization(::RTC::RTObject_impl *rtobj)
Constructor.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:25:59