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


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed May 15 2019 05:02:18