SampleSimulationECComp.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 "SampleSimulationEC.h"
15 
16 
17 void MyModuleInit(RTC::Manager* manager)
18 {
19  SampleSimulationECInit(manager);
20  RTC::RtcBase* comp;
21 
22  // Create a component
23  comp = manager->createComponent("SampleSimulationEC");
24 
25  if (comp==NULL)
26  {
27  std::cerr << "Component create failed." << std::endl;
28  abort();
29  }else
30  std::cerr << "** SampleSimulationEC **" << std::endl;
31 
32  // Example
33  // The following procedure is examples how handle RT-Components.
34  // These should not be in this function.
35 
36  // Get the component's object reference
37 // RTC::RTObject_var rtobj;
38 // rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
39 
40  // Get the port list of the component
41 // PortServiceList* portlist;
42 // portlist = rtobj->get_ports();
43 
44  // getting port profiles
45 // std::cout << "Number of Ports: ";
46 // std::cout << portlist->length() << std::endl << std::endl;
47 // for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
48 // {
49 // PortService_ptr port;
50 // port = (*portlist)[i];
51 // std::cout << "Port" << i << " (name): ";
52 // std::cout << port->get_port_profile()->name << std::endl;
53 //
54 // RTC::PortInterfaceProfileList iflist;
55 // iflist = port->get_port_profile()->interfaces;
56 // std::cout << "---interfaces---" << std::endl;
57 // for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
58 // {
59 // std::cout << "I/F name: ";
60 // std::cout << iflist[i].instance_name << std::endl;
61 // std::cout << "I/F type: ";
62 // std::cout << iflist[i].type_name << std::endl;
63 // const char* pol;
64 // pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
65 // std::cout << "Polarity: " << pol << std::endl;
66 // }
67 // std::cout << "---properties---" << std::endl;
68 // NVUtil::dump(port->get_port_profile()->properties);
69 // std::cout << "----------------" << std::endl << std::endl;
70 // }
71 
72  return;
73 }
74 
75 int main (int argc, char** argv)
76 {
78  manager = RTC::Manager::init(argc, argv);
79 
80  // Initialize manager
81  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)
void runManager(bool no_block=false)
int main(int argc, char **argv)
manager
static Manager * init(int argc, char **argv)
SampleSimulationEC.
bool activateManager()
void setModuleInitProc(ModuleInitProc proc)
void SampleSimulationECInit(RTC::Manager *manager)
void MyModuleInit(RTC::Manager *manager)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:25