-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnalyzerComp.cpp
99 lines (82 loc) · 2.6 KB
/
AnalyzerComp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// -*- C++ -*-
/*!
* @file AnalyzerComp.cpp
* @brief Standalone component
* @date Nov 8, 2011
*
* Written by Gustavo Garcia
* Robotics Lab @ NAIST
*
*/
#include <rtm/Manager.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include "Analyzer.h"
void MyModuleInit(RTC::Manager* manager)
{
AnalyzerInit(manager);
RTC::RtcBase* comp;
// Create a component
comp = manager->createComponent("Analyzer");
if (comp==NULL)
{
std::cerr << "Component create failed." << std::endl;
abort();
}
// Example
// The following procedure is examples how handle RT-Components.
// These should not be in this function.
// Get the component's object reference
// RTC::RTObject_var rtobj;
// rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
// Get the port list of the component
// PortServiceList* portlist;
// portlist = rtobj->get_ports();
// getting port profiles
// std::cout << "Number of Ports: ";
// std::cout << portlist->length() << std::endl << std::endl;
// for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
// {
// PortService_ptr port;
// port = (*portlist)[i];
// std::cout << "Port" << i << " (name): ";
// std::cout << port->get_port_profile()->name << std::endl;
//
// RTC::PortInterfaceProfileList iflist;
// iflist = port->get_port_profile()->interfaces;
// std::cout << "---interfaces---" << std::endl;
// for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
// {
// std::cout << "I/F name: ";
// std::cout << iflist[i].instance_name << std::endl;
// std::cout << "I/F type: ";
// std::cout << iflist[i].type_name << std::endl;
// const char* pol;
// pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
// std::cout << "Polarity: " << pol << std::endl;
// }
// std::cout << "---properties---" << std::endl;
// NVUtil::dump(port->get_port_profile()->properties);
// std::cout << "----------------" << std::endl << std::endl;
// }
return;
}
int main (int argc, char** argv)
{
RTC::Manager* manager;
manager = RTC::Manager::init(argc, argv);
// Initialize manager
manager->init(argc, argv);
// Set module initialization proceduer
// This procedure will be invoked in activateManager() function.
manager->setModuleInitProc(MyModuleInit);
// Activate manager and register to naming service
manager->activateManager();
// run the manager in blocking mode
// runManager(false) is the default.
manager->runManager();
// If you want to run the manager in non-blocking mode, do like this
// manager->runManager(true);
return 0;
}