Go to the documentation of this file.00001
00010 #include <rtm/Manager.h>
00011 #include <rtm/ModuleManager.h>
00012 #include <iostream>
00013 #include <string>
00014 #include "RobotHardware.h"
00015
00016
00017 void MyModuleInit(RTC::Manager* manager)
00018 {
00019 RobotHardwareInit(manager);
00020 RTC::RtcBase* comp;
00021
00022
00023 comp = manager->createComponent("RobotHardware");
00024
00025
00026
00027
00028
00029
00030
00031 RTC::RTObject_var rtobj;
00032 rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
00033
00034
00035 PortServiceList* portlist;
00036 portlist = rtobj->get_ports();
00037
00038
00039 std::cout << "Number of Ports: ";
00040 std::cout << portlist->length() << std::endl << std::endl;
00041 for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
00042 {
00043 PortService_ptr port;
00044 port = (*portlist)[i];
00045 std::cout << "Port" << i << " (name): ";
00046 std::cout << port->get_port_profile()->name << std::endl;
00047
00048 RTC::PortInterfaceProfileList iflist;
00049 iflist = port->get_port_profile()->interfaces;
00050 std::cout << "---interfaces---" << std::endl;
00051 for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
00052 {
00053 std::cout << "I/F name: ";
00054 std::cout << iflist[i].instance_name << std::endl;
00055 std::cout << "I/F type: ";
00056 std::cout << iflist[i].type_name << std::endl;
00057 const char* pol;
00058 pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
00059 std::cout << "Polarity: " << pol << std::endl;
00060 }
00061 std::cout << "---properties---" << std::endl;
00062 NVUtil::dump(port->get_port_profile()->properties);
00063 std::cout << "----------------" << std::endl << std::endl;
00064 }
00065
00066 return;
00067 }
00068
00069 int main (int argc, char** argv)
00070 {
00071 RTC::Manager* manager;
00072 manager = RTC::Manager::init(argc, argv);
00073
00074
00075 manager->init(argc, argv);
00076
00077 #ifndef __APPLE__
00078 try{
00079 manager->load("libhrpEC.so", "hrpECInit");
00080 }catch(RTC::ModuleManager::NotFound& ex){
00081 std::cerr << ex.name << std::endl;
00082 }catch(RTC::ModuleManager::Error& ex){
00083 std::cerr << ex.reason << std::endl;
00084 std::cerr << dlerror() << std::endl;
00085 }catch(...){
00086 std::cerr << "exception in loading libhrpEC.so" << std::endl;
00087 }
00088 #endif
00089
00090
00091
00092 manager->setModuleInitProc(MyModuleInit);
00093
00094
00095 manager->activateManager();
00096
00097
00098
00099 manager->runManager();
00100
00101
00102
00103
00104 return 0;
00105 }