server.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * National Institute of Advanced Industrial Science and Technology (AIST)
00008  * General Robotix Inc. 
00009  */
00014 #include "ODE_DynamicsSimulator_impl.h"
00015 
00016 #ifdef _WIN32
00017 #include "winbase.h"
00018 #else
00019 #include <unistd.h>
00020 #endif /* _WIN32 */
00021 
00022 #include <iostream>
00023 
00024 using namespace std;
00025 
00026 
00027 int main(int argc, char* argv[])
00028 {
00029     CORBA::ORB_var orb;
00030     try {
00031         orb = CORBA::ORB_init(argc, argv);
00032         //
00033         // Resolve Root POA
00034         //
00035         CORBA::Object_var poaObj = orb -> resolve_initial_references("RootPOA");
00036         PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObj);
00037 
00038         //
00039         // Get a reference to the POA manager
00040         //
00041         PortableServer::POAManager_var manager = rootPOA -> the_POAManager();
00042 
00043         CosNaming::NamingContext_var cxT;
00044         CORBA::Object_var       nS = orb->resolve_initial_references("NameService");
00045         cxT = CosNaming::NamingContext::_narrow(nS);
00046 
00047         CORBA::Object_var integratorFactory;
00048         DynamicsSimulatorFactory_impl* integratorFactoryImpl = new DynamicsSimulatorFactory_impl(orb);
00049         integratorFactory = integratorFactoryImpl -> _this();
00050         CosNaming::Name nc;
00051         nc.length(1);
00052         nc[0].id = CORBA::string_dup("DynamicsSimulatorFactory");
00053         nc[0].kind = CORBA::string_dup("");
00054         cxT -> rebind(nc, integratorFactory);
00055 
00056         manager -> activate();
00057         cout << "ready" << endl;
00058 
00059         orb -> run();
00060     } catch (CORBA::SystemException& ex) {
00061         cerr << ex._rep_id() << endl;
00062         return 1;
00063     }
00064     orb->destroy();
00065     return 0;
00066 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:19