20 #include <coil/stringutil.h> 24 #define UNUSED_ARG(a) do {} while (&a == 0) 94 while (
m_orb->work_pending())
97 if (
m_orb->work_pending())
98 m_orb->perform_work();
101 if (!::CORBA::is_nil(
m_poa))
107 m_poa->destroy(
false,
true);
108 m_poa = PortableServer::POA::_nil();
110 catch (::CORBA::SystemException& ex)
118 if (!::CORBA::is_nil(
m_orb))
122 m_orb->shutdown(
true);
123 m_orb = ::CORBA::ORB::_nil();
125 catch (::CORBA::SystemException& ex)
193 const char*
id = impl->id();
194 std::cout <<
"CORBAManager::activateObject: id " <<
id << std::endl;
195 std::cout <<
"CORBAManager::activateObject: name " << impl->name() << std::endl;
212 std::cout <<
"dynamic_cast<CORBAServantBase*> failed" << std::endl;
221 catch (std::bad_alloc& e)
238 if (factory_proxy == NULL)
return NOT_FOUND;
260 if (strcmp(impl->id(), servant->id()) != 0)
269 ::PortableServer::ObjectId_var
id =
m_poa->activate_object(svt);
270 ::CORBA::Object_ptr obj =
m_poa->id_to_reference(
id);
307 PortableServer::ObjectId_var oid;
309 m_poa->deactivate_object(oid);
328 if (
name == NULL)
return NULL;
331 if (entry == NULL)
return NULL;
345 if (servant == NULL)
return NULL;
347 std::cout <<
"toImpl(Servant)" << std::endl;
350 std::cout <<
"name: " << csvt->
name() << std::endl;
364 if (
name == NULL)
return NULL;
367 if (entry == NULL)
return NULL;
382 if (impl == NULL)
return NULL;
399 PortableServer::ServantBase* svt =
m_poa->reference_to_servant(obj);
401 if (csvt == NULL)
return NULL;
458 PortableServer::ServantBase* svt =
m_poa->reference_to_servant(obj);
459 if (svt == NULL)
return NULL;
461 if (csvt == NULL)
return NULL;
516 args.insert(args.begin(),
"manager");
518 int argc(args.size());
523 m_orb = ::CORBA::ORB_init(argc, argv);
524 assert(!::CORBA::is_nil(
m_orb));
526 ::CORBA::Object_var obj =
m_orb->resolve_initial_references(
"RootPOA");
527 m_poa = PortableServer::POA::_narrow(obj);
528 assert(!::CORBA::is_nil(
m_poa));
543 std::string endpoint(
m_config[
"endpoint"]);
545 if (!endpoint.empty())
547 if (!opt.empty()) opt +=
" ";
548 if (corba ==
"omniORB") opt =
"-ORBendPoint giop:tcp:" + endpoint;
549 else if (corba ==
"TAO") opt =
"-ORBEndPoint iiop://" + endpoint;
550 else if (corba ==
"MICO") opt =
"-ORBIIOPAddr inet:" + endpoint;
static CORBAManager * manager
virtual const char * name()
Getting ORB's name.
virtual ServantBase * create()
::PortableServer::POA_ptr getPOA()
Getting default POA pointer.
virtual ServantBase * toServant(doil::ImplBase *lobj)
Getting servant object by impl object.
ServantBase *(* ServantNewFunc)()
virtual const char * name() const
void(* ProxyDeleteFunc)(ProxyBase *)
void DoilCORBAInit(coil::Properties &prop)
virtual ReturnCode_t registerFactory(const char *id, doil::ServantNewFunc new_func, doil::ServantDeleteFunc delete_func)
Register servant's factory.
coil::Properties m_config
::CORBA::ORB_ptr getORB()
Getting ORB pointer.
ObjectManager< const char *, Entry, EntryPred > m_map
Object * find(const Identifier &id) const
Find the object.
virtual ReturnCode_t registerProxyFactory(const char *id, doil::ProxyNewFunc new_func, doil::ProxyDeleteFunc delete_func)
virtual ImplBase * toImpl(doil::ServantBase *servant)
Getting impl object by servant.
static CORBAManager & instance()
getting instance
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
virtual ServantBase * getServant(const char *name)
Getting servant object by name.
ObjectManager< const char *, ProxyFactory, ProxyFactoryPred > m_factory_proxy
static CORBAManager * init(coil::Properties prop)
initializer
void initOrb(coil::Properties prop)
CORBA ORB initialization.
::CORBA::Object_ptr toReference(doil::ImplBase *impl)
Converting Impl object to object reference.
::CORBA::Object_ptr getReference(const char *name)
Getting object reference from the given name.
static ORBManager & instance()
getting instance
virtual ImplBase * getImpl(const char *name)
Getting object by name.
bool registerObject(Object *obj)
Register the specified object.
CORBAServantBase * servant_
ProxyBase *(* ProxyNewFunc)(::CORBA::Object_ptr obj)
void(* ServantDeleteFunc)(ServantBase *)
::PortableServer::POAManager_ptr getPOAManager()
Getting POAManager pointer.
Object * unregisterObject(const Identifier &id)
Unregister the specified object.
char ** toArgv(const vstring &args)
Convert the given string list into the argument list.
prop
Organization::get_organization_property ();.
ReturnCode_t addORB(IORB *orb)
Register an ORB to the ORBManager.
virtual const char * name()=0
Class represents a set of properties.
::CORBA::Object_ptr objref_
ObjectManager< const char *, ServantFactory, FactoryPred > m_factory
virtual ReturnCode_t deactivateObject(doil::ImplBase *impl)
Deactivate object.
virtual void shutdown()
Shutdown ORB.
virtual const char * id() const
::PortableServer::POAManager_ptr m_poaManager
std::string createORBOptions()
Create ORB command options.
::PortableServer::POA_ptr m_poa
virtual ReturnCode_t activateObject(doil::ImplBase *impl)
Activate object.
virtual void destroy(ServantBase *servant)