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