ConsoleInComp.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include <rtm/Manager.h>
00011 #include <iostream>
00012 #include <string>
00013 #include "ConsoleIn.h"
00014 #include <rtm/NVUtil.h>
00015 
00016 
00017 void MyModuleInit(RTC::Manager* manager)
00018 {
00019   ConsoleInInit(manager);
00020   RTC::RtcBase* comp;
00021 
00022   // Create a component
00023   std::cout << "Creating a component: \"ConsoleIn\"....";
00024   comp = manager->createComponent("ConsoleIn");
00025   std::cout << "succeed." << std::endl;
00026 
00027   RTC::ComponentProfile_var prof;
00028   prof = comp->get_component_profile();
00029   std::cout << "=================================================" << std::endl;
00030   std::cout << " Component Profile" << std::endl;
00031   std::cout << "-------------------------------------------------" << std::endl;
00032   std::cout << "InstanceID:     " << prof->instance_name << std::endl;
00033   std::cout << "Implementation: " << prof->type_name << std::endl;
00034   std::cout << "Description:    " << prof->description << std::endl;
00035   std::cout << "Version:        " << prof->version << std::endl;
00036   std::cout << "Maker:          " << prof->vendor << std::endl;
00037   std::cout << "Category:       " << prof->category << std::endl;
00038   std::cout << "  Other properties   " << std::endl;
00039   NVUtil::dump(prof->properties);
00040   std::cout << "=================================================" << std::endl;
00041 
00042   PortServiceList* portlist;
00043   portlist = comp->get_ports();
00044 
00045   for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
00046     {
00047       PortService_ptr port;
00048       port = (*portlist)[i];
00049       std::cout << "================================================="
00050                 << std::endl;
00051       std::cout << "Port" << i << " (name): ";
00052       std::cout << port->get_port_profile()->name << std::endl;
00053       std::cout << "-------------------------------------------------"
00054                 << std::endl;    
00055       RTC::PortInterfaceProfileList iflist;
00056       iflist = port->get_port_profile()->interfaces;
00057 
00058       for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
00059         {
00060           std::cout << "I/F name: ";
00061           std::cout << iflist[i].instance_name << std::endl;
00062           std::cout << "I/F type: ";
00063           std::cout << iflist[i].type_name << std::endl;
00064           const char* pol;
00065           pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
00066           std::cout << "Polarity: " << pol << std::endl;
00067         }
00068       std::cout << "- properties -" << std::endl;
00069       NVUtil::dump(port->get_port_profile()->properties);
00070       std::cout << "-------------------------------------------------" << std::endl;
00071     }
00072   return;
00073 }
00074 
00075 
00076 
00077 int main (int argc, char** argv)
00078 {
00079   RTC::Manager* manager;
00080   manager = RTC::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 }


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15