SensorComp.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
9 #include <rtm/Manager.h>
10 #include <iostream>
11 #include <string>
12 #include "Sensor.h"
13 
14 
16 {
17  SensorInit(manager);
18  RTC::RtcBase* comp;
19 
20  // Create a component
21  comp = manager->createComponent("Sensor");
22 
23 
24  // Example
25  // The following procedure is examples how handle RT-Components.
26  // These should not be in this function.
27 
28  // Get the component's object reference
29 // RTC::RTObject_var rtobj;
30 // rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
31 
32  // Get the port list of the component
33 // PortList* portlist;
34 // portlist = rtobj->get_ports();
35 
36  // getting port profiles
37 // std::cout << "Number of Ports: ";
38 // std::cout << portlist->length() << std::endl << std::endl;
39 // for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
40 // {
41 // Port_ptr port;
42 // port = (*portlist)[i];
43 // std::cout << "Port" << i << " (name): ";
44 // std::cout << port->get_port_profile()->name << std::endl;
45 //
46 // RTC::PortInterfaceProfileList iflist;
47 // iflist = port->get_port_profile()->interfaces;
48 // std::cout << "---interfaces---" << std::endl;
49 // for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
50 // {
51 // std::cout << "I/F name: ";
52 // std::cout << iflist[i].instance_name << std::endl;
53 // std::cout << "I/F type: ";
54 // std::cout << iflist[i].type_name << std::endl;
55 // const char* pol;
56 // pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
57 // std::cout << "Polarity: " << pol << std::endl;
58 // }
59 // std::cout << "---properties---" << std::endl;
60 // NVUtil::dump(port->get_port_profile()->properties);
61 // std::cout << "----------------" << std::endl << std::endl;
62 // }
63 
64  return;
65 }
66 
67 int main (int argc, char** argv)
68 {
70  manager = RTC::Manager::init(argc, argv);
71 
72  // Initialize manager
73  manager->init(argc, argv);
74 
75  // Set module initialization proceduer
76  // This procedure will be invoked in activateManager() function.
78 
79  // Activate manager and register to naming service
80  manager->activateManager();
81 
82  // run the manager in blocking mode
83  // runManager(false) is the default.
84  manager->runManager();
85 
86  // If you want to run the manager in non-blocking mode, do like this
87  // manager->runManager(true);
88 
89  return 0;
90 }
91 
RTObject_impl * createComponent(const char *comp_args)
Create RT-Components.
Definition: Manager.cpp:520
void runManager(bool no_block=false)
Run the Manager.
Definition: Manager.cpp:318
RT-Component class.
Definition: RTObject.h:89
Manager class.
Definition: Manager.h:80
Sensor component *.
RTComponent manager class.
static Manager * init(int argc, char **argv)
Initialize manager.
Definition: Manager.cpp:110
void MyModuleInit(RTC::Manager *manager)
Definition: SensorComp.cpp:15
void SensorInit(RTC::Manager *manager)
Definition: Sensor.cpp:149
bool activateManager()
Activate the Manager.
Definition: Manager.cpp:244
void setModuleInitProc(ModuleInitProc proc)
Set initial procedure.
Definition: Manager.cpp:232
int main(int argc, char **argv)
Definition: SensorComp.cpp:67


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:56