JoystickComp.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 "Joystick.h"
15 
16 
17 void MyModuleInit(RTC::Manager* manager)
18 {
19  JoystickInit(manager);
20  RTC::RtcBase* comp;
21 
22  // Create a component
23  comp = manager->createComponent("Joystick");
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 }
void JoystickInit(RTC::Manager *manager)
Definition: Joystick.cpp:199
RTObject_impl * createComponent(const char *comp_args)
void runManager(bool no_block=false)
Access a joystick control device.
manager
static Manager * init(int argc, char **argv)
void MyModuleInit(RTC::Manager *manager)
bool activateManager()
void setModuleInitProc(ModuleInitProc proc)
int main(int argc, char **argv)


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50