UtDynamicsSimulator/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  * The University of Tokyo
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  * General Robotix Inc.
10  */
18 #include "DynamicsSimulator_impl.h"
19 
20 #ifdef _WIN32
21 #include "winbase.h"
22 #else
23 #include <unistd.h>
24 #endif /* _WIN32 */
25 
26 #include <iostream>
27 
28 using namespace std;
29 using namespace OpenHRP;
30 
31 
39 int main(int argc, char* argv[])
40 {
41  CORBA::ORB_var orb;
42  try {
43  orb = CORBA::ORB_init(argc, argv);
44  //
45  // Resolve Root POA
46  //
47  CORBA::Object_var poaObj = orb -> resolve_initial_references("RootPOA");
48  PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(poaObj);
49 
50  //
51  // Get a reference to the POA manager
52  //
53  PortableServer::POAManager_var manager = rootPOA -> the_POAManager();
54 
55  CosNaming::NamingContext_var cxT;
56  CORBA::Object_var nS = orb->resolve_initial_references("NameService");
57  cxT = CosNaming::NamingContext::_narrow(nS);
58 
59  CORBA::Object_var integratorFactory;
60  DynamicsSimulatorFactory_impl* integratorFactoryImpl = new DynamicsSimulatorFactory_impl(orb);
61  integratorFactory = integratorFactoryImpl -> _this();
62  CosNaming::Name nc;
63  nc.length(1);
64  nc[0].id = CORBA::string_dup("DynamicsSimulatorFactory");
65  nc[0].kind = CORBA::string_dup("");
66  cxT -> rebind(nc, integratorFactory);
67 
68  // クライアント側からの接続待ち //
69  manager -> activate();
70  cout << "ready" << endl;
71 
72  orb -> run();
73  } catch (CORBA::SystemException& ex) {
74  cerr << ex._rep_id() << endl;
75  return 1;
76  }
77  orb->destroy();
78  return 0;
79 }
manager
def run(tree, args)
int main(int argc, char *argv[])


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:25