00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 << 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 );
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 }