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


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