ConsoleOutComp.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include <rtm/Manager.h>
00011 #include <iostream>
00012 #include <string>
00013 #include "ConsoleOut.h"
00014 
00015 
00016 void MyModuleInit(RTC::Manager* manager)
00017 {
00018   ConsoleOutInit(manager);
00019   RTC::RtcBase* comp;
00020 
00021   // Create a component
00022   comp = manager->createComponent("ConsoleOut");
00023   std::cout << "succeed." << std::endl;
00024 
00025   RTC::ComponentProfile_var prof;
00026   prof = comp->get_component_profile();
00027   std::cout << "=================================================" << std::endl;
00028   std::cout << " Component Profile" << std::endl;
00029   std::cout << "-------------------------------------------------" << std::endl;
00030   std::cout << "InstanceID:     " << prof->instance_name << std::endl;
00031   std::cout << "Implementation: " << prof->type_name << std::endl;
00032   std::cout << "Description:    " << prof->description << std::endl;
00033   std::cout << "Version:        " << prof->version << std::endl;
00034   std::cout << "Maker:          " << prof->vendor << std::endl;
00035   std::cout << "Category:       " << prof->category << std::endl;
00036   std::cout << "  Other properties   " << std::endl;
00037   NVUtil::dump(prof->properties);
00038   std::cout << "=================================================" << std::endl;
00039 
00040   PortServiceList* portlist;
00041   portlist = comp->get_ports();
00042 
00043   for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
00044     {
00045       PortService_ptr port;
00046       port = (*portlist)[i];
00047       std::cout << "================================================="
00048                 << std::endl;
00049       std::cout << "Port" << i << " (name): ";
00050       std::cout << port->get_port_profile()->name << std::endl;
00051       std::cout << "-------------------------------------------------"
00052                 << std::endl;
00053 
00054     
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 << "-------------------------------------------------"
00071                 << std::endl;
00072     }
00073 
00074 
00075   return;
00076 }
00077 
00078 int main (int argc, char** argv)
00079 {
00080   RTC::Manager* manager;
00081   manager = RTC::Manager::init(argc, argv);
00082 
00083   // Set module initialization proceduer
00084   // This procedure will be invoked in activateManager() function.
00085   manager->setModuleInitProc(MyModuleInit);
00086 
00087   // Activate manager and register to naming service
00088   manager->activateManager();
00089 
00090   // run the manager in blocking mode
00091   // runManager(false) is the default.
00092   manager->runManager();
00093 
00094   // If you want to run the manager in non-blocking mode, do like this
00095   // manager->runManager(true);
00096 
00097   return 0;
00098 }


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:03