SimpleIO/ConsoleOutComp.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
10 #include <rtm/Manager.h>
11 #include <iostream>
12 #include <string>
13 #include "ConsoleOut.h"
14 
15 
17 {
18  ConsoleOutInit(manager);
19  RTC::RtcBase* comp;
20 
21  // Create a component
22  comp = manager->createComponent("ConsoleOut");
23  std::cout << "succeed." << std::endl;
24 
25  RTC::ComponentProfile_var prof;
26  prof = comp->get_component_profile();
27  std::cout << "=================================================" << std::endl;
28  std::cout << " Component Profile" << std::endl;
29  std::cout << "-------------------------------------------------" << std::endl;
30  std::cout << "InstanceID: " << prof->instance_name << std::endl;
31  std::cout << "Implementation: " << prof->type_name << std::endl;
32  std::cout << "Description: " << prof->description << std::endl;
33  std::cout << "Version: " << prof->version << std::endl;
34  std::cout << "Maker: " << prof->vendor << std::endl;
35  std::cout << "Category: " << prof->category << std::endl;
36  std::cout << " Other properties " << std::endl;
37  NVUtil::dump(prof->properties);
38  std::cout << "=================================================" << std::endl;
39 
40  PortServiceList* portlist;
41  portlist = comp->get_ports();
42 
43  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
44  {
45  PortService_ptr port;
46  port = (*portlist)[i];
47  std::cout << "================================================="
48  << std::endl;
49  std::cout << "Port" << i << " (name): ";
50  std::cout << port->get_port_profile()->name << std::endl;
51  std::cout << "-------------------------------------------------"
52  << std::endl;
53 
54 
56  iflist = port->get_port_profile()->interfaces;
57 
58  for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
59  {
60  std::cout << "I/F name: ";
61  std::cout << iflist[i].instance_name << std::endl;
62  std::cout << "I/F type: ";
63  std::cout << iflist[i].type_name << std::endl;
64  const char* pol;
65  pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
66  std::cout << "Polarity: " << pol << std::endl;
67  }
68  std::cout << "- properties -" << std::endl;
69  NVUtil::dump(port->get_port_profile()->properties);
70  std::cout << "-------------------------------------------------"
71  << std::endl;
72  }
73 
74 
75  return;
76 }
77 
78 int main (int argc, char** argv)
79 {
81  manager = RTC::Manager::init(argc, argv);
82 
83  // Set module initialization proceduer
84  // This procedure will be invoked in activateManager() function.
86 
87  // Activate manager and register to naming service
88  manager->activateManager();
89 
90  // run the manager in blocking mode
91  // runManager(false) is the default.
92  manager->runManager();
93 
94  // If you want to run the manager in non-blocking mode, do like this
95  // manager->runManager(true);
96 
97  return 0;
98 }
RTObject_impl * createComponent(const char *comp_args)
Create RT-Components.
Definition: Manager.cpp:520
virtual ComponentProfile * get_component_profile()
[RTObject CORBA interface] Get RTC&#39;s profile
Definition: RTObject.cpp:698
void ConsoleOutInit(RTC::Manager *manager)
int main(int argc, char **argv)
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
virtual PortServiceList * get_ports()
[RTObject CORBA interface] Get Ports
Definition: RTObject.cpp:748
void MyModuleInit(RTC::Manager *manager)
RTComponent manager class.
std::vector< PortInterfaceProfile * > PortInterfaceProfileList
Definition: IPortService.h:38
static Manager * init(int argc, char **argv)
Initialize manager.
Definition: Manager.cpp:110
void dump(const SDOPackage::NVList &nv)
Print information configured in NVList as a string type to Standard Outport.
Definition: NVUtil.cpp:394
bool activateManager()
Activate the Manager.
Definition: Manager.cpp:244
std::vector< IPortService * > PortServiceList
Definition: IPortService.h:39
void setModuleInitProc(ModuleInitProc proc)
Set initial procedure.
Definition: Manager.cpp:232


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