forked from s-nakaoka/openhrp-plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
/
ModelLoaderServer.cpp
45 lines (35 loc) · 1.06 KB
/
ModelLoaderServer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*!
@file
@author Shizuko Hattori
*/
#include "ModelLoader_impl.h"
#include <cnoid/CorbaUtil>
#include <iostream>
using namespace std;
using namespace cnoid;
using namespace OpenHRP;
int main(int argc, char* argv[])
{
initializeCorbaUtil(true);
CORBA::ORB_var orb = getORB();
try {
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
ModelLoader_impl* modelLoaderImpl = new ModelLoader_impl(orb, poa);
poa->activate_object(modelLoaderImpl);
ModelLoader_var modelLoader = modelLoaderImpl->_this();
modelLoaderImpl->_remove_ref();
NamingContextHelper* namingContextHelper = getDefaultNamingContextHelper();
namingContextHelper->bindObject(modelLoader, "ModelLoader");
cout << "ready" << endl;
orb->run();
}
catch (CORBA::SystemException& ex) {
cerr << ex._rep_id() << endl;
}
catch (const string& error){
cerr << error << endl;
}
orb->destroy();
return 1;
}