ctaskbrowser.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Thu Jul 3 15:30:32 CEST 2008  ctaskbrowser.cpp
00003 
00004                         ctaskbrowser.cpp -  description
00005                            -------------------
00006     begin                : Thu July 03 2008
00007     copyright            : (C) 2008 Peter Soetens
00008     email                : peter.soetens@fmtc.be
00009 
00010  ***************************************************************************
00011  *   This program is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this program; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place,                                    *
00024  *   Suite 330, Boston, MA  02111-1307  USA                                *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 #include <rtt/os/main.h>
00029 #include <rtt/plugin/PluginLoader.hpp>
00030 #include <rtt/transports/corba/TaskContextProxy.hpp>
00031 #include <rtt/transports/corba/TaskContextServer.hpp>
00032 #include <taskbrowser/TaskBrowser.hpp>
00033 #include <iostream>
00034 #include <string>
00035 
00036 #include "installpath.hpp"
00037 
00038 using namespace RTT;
00039 using namespace RTT::corba;
00040 
00041 #define ORO_xstr(s) ORO_str(s)
00042 #define ORO_str(s) #s
00043 
00044 int ORO_main(int argc, char** argv)
00045 {
00046     
00047     if ( argc == 2 && strncmp(argv[1],"--version",9) == 0) {
00048         std::cout<< " OROCOS Toolchain version '" ORO_xstr(RTT_VERSION) "'";
00049 #ifdef __GNUC__
00050         std::cout << " ( GCC " ORO_xstr(__GNUC__) "." ORO_xstr(__GNUC_MINOR__) "." ORO_xstr(__GNUC_PATCHLEVEL__) " )";
00051 #endif
00052 #ifdef OROPKG_OS_LXRT
00053         std::cout<<" -- LXRT/RTAI.";
00054 #endif
00055 #ifdef OROPKG_OS_GNULINUX
00056         std::cout<<" -- GNU/Linux.";
00057 #endif
00058 #ifdef OROPKG_OS_XENOMAI
00059         std::cout<<" -- Xenomai.";
00060 #endif
00061         std::cout << std::endl;
00062         return 0;
00063     }
00064 
00065     if ( argc == 1 || (argc == 2 && strncmp(argv[1],"--help",6) == 0)) {
00066         std::cerr << "Please specify the CORBA TaskContext name or IOR to connect to." << std::endl;
00067         std::cerr << "  " << argv[0] << " [ComponentName | IOR]" << std::endl;
00068         return -1;
00069     }
00070     std::string name = argv[1];
00071 
00072     RTT::plugin::PluginLoader::Instance()->loadTypekits(ocl_install_path);
00073 
00074     TaskContextServer::InitOrb( argc, argv);
00075 
00076     TaskContextServer::ThreadOrb();
00077 
00078     RTT::TaskContext* proxy;
00079     if ( name.substr(0, 4) == "IOR:" ) {
00080         proxy = RTT::corba::TaskContextProxy::Create( name, true );
00081     } else {
00082         proxy = RTT::corba::TaskContextProxy::Create( name ); // is_ior = true
00083     }
00084 
00085     if (proxy == 0){
00086         std::cerr << "CORBA system error while looking up " << name << std::endl;
00087         return -1;
00088     }
00089 
00090     OCL::TaskBrowser tb( proxy );
00091     tb.loop();
00092 
00093     TaskContextServer::ShutdownOrb();
00094     TaskContextServer::DestroyOrb();
00095 
00096     return 0;
00097 }


ocl
Author(s): OCL Development Team
autogenerated on Thu Jan 2 2014 11:38:08