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