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


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