ArtExecutionContext.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
19 /*
20  * $Log$
21  */
22 
23 #include "ArtExecutionContext.h"
24 #include <rtm/ECFactory.h>
25 #include <linux/art_task.h>
26 
27 #include <iostream>
28 
29 namespace RTC
30 {
33  m_priority(ART_PRIO_MAX-1)
34  {
35  rtclog.setName("ArtEC");
36  coil::Properties& prop(Manager::instance().getConfig());
37 
38  // Priority
39  getProperty(prop, "exec_cxt.periodic.priority", m_priority);
40  getProperty(prop, "exec_cxt.periodic.art.priority", m_priority);
41  RTC_DEBUG(("Priority: %d", m_priority));
42  }
43 
45  {
46  }
47 
48 
50  {
51  int usec(m_period.sec() * 1000000 + m_period.usec());
52  if (art_enter(m_priority, ART_TASK_PERIODIC, usec) == -1)
53  {
54  std::cerr << "fatal error: art_enter" << std::endl;
55  }
56  do
57  {
58  std::for_each(m_comps.begin(), m_comps.end(), invoke_worker());
59  if (art_wait() == -1)
60  {
61  std::cerr << "fatal error: art_wait " << std::endl;
62  }
63  } while (m_running);
64 
65  if (art_exit() == -1)
66  {
67  std::cerr << "fatal error: art_exit" << std::endl;
68  }
69  return 0;
70  }
71 };
72 
73 
74 extern "C"
75 {
77  {
78  RTC::Manager::instance().registerECFactory("ArtExecutionContext",
79  RTC::ECCreate<RTC::ArtExecutionContext>,
80  RTC::ECDelete<RTC::ArtExecutionContext>);
81  }
82 };
RT-Component.
std::vector< Comp > m_comps
List of the participating component.
void ArtExecutionContextInit(RTC::Manager *manager)
Manager class.
Definition: Manager.h:80
void setName(const char *name)
Set suffix of date/time string of header.
static Manager & instance()
Get instance of the manager.
Definition: Manager.cpp:140
void getProperty(coil::Properties &prop, const char *key, T &value)
#define RTC_DEBUG(fmt)
Debug level log output macro.
Definition: SystemLogger.h:488
ArtExecutionContext class.
bool registerECFactory(const char *name, ECNewFunc new_func, ECDeleteFunc delete_func)
Register ExecutionContext Factory.
Definition: Manager.cpp:600
prop
Organization::get_organization_property ();.
Class represents a set of properties.
Definition: Properties.h:101
ExecutionContext Factory class.
long int sec() const
Get value of second time scale.
Definition: TimeValue.h:110
long int usec() const
Get value of micro second time scale.
Definition: TimeValue.h:131
virtual int svc(void)
Thread execution function for ExecutionContext.
bool m_running
The running state of ExecutionContext true: running, false: stopped.
coil::TimeValue m_period
Execution cycle of ExecutionContext.
Functor for_each(CorbaSequence &seq, Functor f)
Apply the functor to all CORBA sequence elements.
Definition: CORBA_SeqUtil.h:98


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:42