Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00018 #include "DynamicsSimulator_impl.h"
00019
00020 #ifdef _WIN32
00021 #include "winbase.h"
00022 #else
00023 #include <unistd.h>
00024 #endif
00025
00026 #include <iostream>
00027
00028 using namespace std;
00029 using namespace OpenHRP;
00030
00031
00039 int main(int argc, char* argv[])
00040 {
00041 CORBA::ORB_var orb;
00042 try {
00043 orb = CORBA::ORB_init(argc, argv);
00044
00045
00046
00047 CORBA::Object_var poaObj = orb -> resolve_initial_references("RootPOA");
00048 PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObj);
00049
00050
00051
00052
00053 PortableServer::POAManager_var manager = rootPOA -> the_POAManager();
00054
00055 CosNaming::NamingContext_var cxT;
00056 CORBA::Object_var nS = orb->resolve_initial_references("NameService");
00057 cxT = CosNaming::NamingContext::_narrow(nS);
00058
00059 CORBA::Object_var integratorFactory;
00060 DynamicsSimulatorFactory_impl* integratorFactoryImpl = new DynamicsSimulatorFactory_impl(orb);
00061 integratorFactory = integratorFactoryImpl -> _this();
00062 CosNaming::Name nc;
00063 nc.length(1);
00064 nc[0].id = CORBA::string_dup("DynamicsSimulatorFactory");
00065 nc[0].kind = CORBA::string_dup("");
00066 cxT -> rebind(nc, integratorFactory);
00067
00068
00069 manager -> activate();
00070 cout << "ready" << endl;
00071
00072 orb -> run();
00073 } catch (CORBA::SystemException& ex) {
00074 cerr << ex._rep_id() << endl;
00075 return 1;
00076 }
00077 orb->destroy();
00078 return 0;
00079 }