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