SampleSimulationECComp.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #include <rtm/Manager.h>
00011 #include <iostream>
00012 #include <string>
00013 #include <stdlib.h>
00014 #include "SampleSimulationEC.h"
00015 
00016 
00017 void MyModuleInit(RTC::Manager* manager)
00018 {
00019   SampleSimulationECInit(manager);
00020   RTC::RtcBase* comp;
00021 
00022   // Create a component
00023   comp = manager->createComponent("SampleSimulationEC");
00024 
00025   if (comp==NULL)
00026   {
00027     std::cerr << "Component create failed." << std::endl;
00028     abort();
00029   }else
00030     std::cerr << "** SampleSimulationEC **" << std::endl;
00031 
00032   // Example
00033   // The following procedure is examples how handle RT-Components.
00034   // These should not be in this function.
00035 
00036   // Get the component's object reference
00037 //  RTC::RTObject_var rtobj;
00038 //  rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
00039 
00040   // Get the port list of the component
00041 //  PortServiceList* portlist;
00042 //  portlist = rtobj->get_ports();
00043 
00044   // getting port profiles
00045 //  std::cout << "Number of Ports: ";
00046 //  std::cout << portlist->length() << std::endl << std::endl; 
00047 //  for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
00048 //  {
00049 //    PortService_ptr port;
00050 //    port = (*portlist)[i];
00051 //    std::cout << "Port" << i << " (name): ";
00052 //    std::cout << port->get_port_profile()->name << std::endl;
00053 //    
00054 //    RTC::PortInterfaceProfileList iflist;
00055 //    iflist = port->get_port_profile()->interfaces;
00056 //    std::cout << "---interfaces---" << std::endl;
00057 //    for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
00058 //    {
00059 //      std::cout << "I/F name: ";
00060 //      std::cout << iflist[i].instance_name << std::endl;
00061 //      std::cout << "I/F type: ";
00062 //      std::cout << iflist[i].type_name << std::endl;
00063 //      const char* pol;
00064 //      pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
00065 //      std::cout << "Polarity: " << pol << std::endl;
00066 //    }
00067 //    std::cout << "---properties---" << std::endl;
00068 //    NVUtil::dump(port->get_port_profile()->properties);
00069 //    std::cout << "----------------" << std::endl << std::endl;
00070 //  }
00071 
00072   return;
00073 }
00074 
00075 int main (int argc, char** argv)
00076 {
00077   RTC::Manager* manager;
00078   manager = RTC::Manager::init(argc, argv);
00079 
00080   // Initialize manager
00081   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 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:56