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