AistDynamicsSimulator/server.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  * General Robotix Inc.
9  */
14 #include "DynamicsSimulator_impl.h"
15 
16 #ifdef _WIN32
17 #include "winbase.h"
18 #else
19 #include <unistd.h>
20 #endif /* _WIN32 */
21 
22 #include <iostream>
23 
24 using namespace std;
25 
26 
27 int main(int argc, char* argv[])
28 {
29  CORBA::ORB_var orb;
30  try {
31  orb = CORBA::ORB_init(argc, argv);
32  //
33  // Resolve Root POA
34  //
35  CORBA::Object_var poaObj = orb -> resolve_initial_references("RootPOA");
36  PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObj);
37 
38  //
39  // Get a reference to the POA manager
40  //
41  PortableServer::POAManager_var manager = rootPOA -> the_POAManager();
42 
43  CosNaming::NamingContext_var cxT;
44  CORBA::Object_var nS = orb->resolve_initial_references("NameService");
45  cxT = CosNaming::NamingContext::_narrow(nS);
46 
47  CORBA::Object_var integratorFactory;
48  DynamicsSimulatorFactory_impl* integratorFactoryImpl = new DynamicsSimulatorFactory_impl(orb);
49  integratorFactory = integratorFactoryImpl -> _this();
50  CosNaming::Name nc;
51  nc.length(1);
52  nc[0].id = CORBA::string_dup("DynamicsSimulatorFactory");
53  nc[0].kind = CORBA::string_dup("");
54  cxT -> rebind(nc, integratorFactory);
55 
56  manager -> activate();
57  cout << "ready" << endl;
58 
59  orb -> run();
60  } catch (CORBA::SystemException& ex) {
61  cerr << ex._rep_id() << endl;
62  return 1;
63  }
64  orb->destroy();
65  return 0;
66 }
int main(int argc, char *argv[])
manager
def run(tree, args)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05