00001 // -*- C++ -*- 00010 #include <rtm/Manager.h> 00011 #include <iostream> 00012 #include <string> 00013 #include "MyServiceConsumer.h" 00014 00015 00016 void MyModuleInit(RTC::Manager* manager) 00017 { 00018 MyServiceConsumerInit(manager); 00019 RTC::RtcBase* comp; 00020 00021 // Create a component 00022 comp = manager->createComponent("MyServiceConsumer"); 00023 00024 00025 // Example 00026 // The following procedure is examples how handle RT-Components. 00027 // These should not be in this function. 00028 00029 // Get the component's object reference 00030 // RTC::RTObject_var rtobj; 00031 // rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp)); 00032 00033 // Get the port list of the component 00034 // PortList* portlist; 00035 // portlist = rtobj->get_ports(); 00036 00037 // getting port profiles 00038 // std::cout << "Number of Ports: "; 00039 // std::cout << portlist->length() << std::endl << std::endl; 00040 // for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i) 00041 // { 00042 // Port_ptr port; 00043 // port = (*portlist)[i]; 00044 // std::cout << "Port" << i << " (name): "; 00045 // std::cout << port->get_port_profile()->name << std::endl; 00046 // 00047 // RTC::PortInterfaceProfileList iflist; 00048 // iflist = port->get_port_profile()->interfaces; 00049 // std::cout << "---interfaces---" << std::endl; 00050 // for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i) 00051 // { 00052 // std::cout << "I/F name: "; 00053 // std::cout << iflist[i].instance_name << std::endl; 00054 // std::cout << "I/F type: "; 00055 // std::cout << iflist[i].type_name << std::endl; 00056 // const char* pol; 00057 // pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED"; 00058 // std::cout << "Polarity: " << pol << std::endl; 00059 // } 00060 // std::cout << "---properties---" << std::endl; 00061 // NVUtil::dump(port->get_port_profile()->properties); 00062 // std::cout << "----------------" << std::endl << std::endl; 00063 // } 00064 00065 return; 00066 } 00067 00068 int main (int argc, char** argv) 00069 { 00070 RTC::Manager* manager; 00071 manager = RTC::Manager::init(argc, argv); 00072 00073 // Set module initialization proceduer 00074 // This procedure will be invoked in activateManager() function. 00075 manager->setModuleInitProc(MyModuleInit); 00076 00077 // Activate manager and register to naming service 00078 manager->activateManager(); 00079 00080 // run the manager in blocking mode 00081 // runManager(false) is the default. 00082 manager->runManager(); 00083 00084 // If you want to run the manager in non-blocking mode, do like this 00085 // manager->runManager(true); 00086 00087 return 0; 00088 }