00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00033 #include <iostream>
00034
00035 #include <archon/math/vector.H>
00036 #include <archon/util/time.H>
00037 #include <archon/util/mutex.H>
00038 #include <archon/util/ref.H>
00039 #include <archon/util/options.H>
00040
00041 #include <archon/x3d/proxy/exception.H>
00042 #include <archon/x3d/proxy/proxy.H>
00043
00044 namespace Archon
00045 {
00046 namespace SaiTestApps
00047 {
00048 namespace Clock
00049 {
00050 using namespace std;
00051 using namespace Math;
00052 using namespace Utilities;
00053 using namespace X3D::Proxy;
00054
00055 int main(int argc, const char *argv[])
00056 {
00057 bool opt_help = false;
00058 int opt_corbaEndpointPort = -1;
00059 string opt_serverName = "archon";
00060
00061 Options o;
00062
00063 o.addSwitch("h", "help", opt_help, true,
00064 "Describe the parameters");
00065 o.addConfig("p", "corba-endpoint-port", opt_corbaEndpointPort, opt_corbaEndpointPort,
00066 "The TCP/IP port on which the CORBA Orb listens (-1 for auto assign)",
00067 Options::wantArg_always);
00068 o.addConfig("n", "server-name", opt_serverName, opt_serverName,
00069 "The name of the server to connect to",
00070 Options::wantArg_always);
00071
00072 if(o.processCommandLine(argc, argv))
00073 {
00074 cerr << "Try --help\n";
00075 return 1;
00076 }
00077
00078 Uri uri;
00079 string uriException;
00080 if(argc>1) try
00081 {
00082 uri = Uri(argv[1]);
00083 }
00084 catch(Uri::SyntaxException &e)
00085 {
00086 uriException = Uri::explain(e);
00087 }
00088
00089 if(opt_help)
00090 {
00091 cout <<
00092 "Test Application for 3D-Console by Brian Kristiansen & Kristian Spangsege\n"
00093 "\n"
00094 "Synopsis: " << argv[0] << " URI\n"
00095 "\n"
00096 "Available options:\n";
00097 cout << o.list();
00098 return 0;
00099 }
00100
00101
00102 if(argc < 2)
00103 {
00104 cerr << "Too few arguments\n";
00105 cerr << "Try --help\n";
00106 return 1;
00107 }
00108
00109 if(argc > 2)
00110 {
00111 cerr << "Too many aguments\n";
00112 cerr << "Try --help\n";
00113 return 1;
00114 }
00115
00116 if(!uriException.empty())
00117 {
00118 cerr << uriException;
00119 exit(1);
00120 }
00121
00122 Ref<Session> session =
00123 Session::create(opt_serverName, opt_corbaEndpointPort);
00124
00125 Ref<Application> application = Application::load(session, uri);
00126
00127 application->launch();
00128
00129 Archon::Utilities::Time delay(0, 100000000l);
00130
00131 while(true)
00132 {
00133 Archon::Utilities::Thread::sleep(delay);
00134 }
00135
00136 return 0;
00137 }
00138 }
00139 }
00140 }
00141
00142 int main(int argc, const char *argv[]) throw()
00143 {
00144 using namespace std;
00145 using namespace Archon::Utilities;
00146 using namespace Archon::X3D;
00147
00148 set_unexpected(Exception::terminal<Proxy::exceptionCatchInfo>);
00149 set_terminate (Exception::terminal<Proxy::exceptionCatchInfo>);
00150
00151 return Archon::SaiTestApps::Clock::main(argc, argv);
00152 }