object_factory_i.cpp

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 52 行

CPP
52
字号
// Object_Factory_i.cpp,v 1.4 2002/07/26 16:12:43 pgontla Exp

#include "Object_Factory_i.h"
#include "tao/PortableServer/POA.h"
#include "tao/PortableServer/ObjectReferenceTemplate.h"

Object_Factory_i::Object_Factory_i (CORBA::ORB_ptr orb,
                                    PortableServer::POA_ptr gateway_poa)
  : orb_ (CORBA::ORB::_duplicate (orb)),
    gateway_poa_ (gateway_poa)
{
  /// Constructor
}


CORBA::Object_ptr
Object_Factory_i::create_object (const char *interface_repository_id,
                                 CORBA::Object_ptr gatewayed_object
                                 ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  CORBA::String_var stringified_object =
    this->orb_->object_to_string (gatewayed_object ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (CORBA::Object::_nil ());

  const PortableServer::ObjectId_var id =
    PortableServer::string_to_ObjectId (stringified_object.in ());

  const PortableInterceptor::ObjectId *obj_id =
    ACE_reinterpret_cast (const PortableInterceptor::ObjectId *,
                          &id.in ());

  TAO_POA *poa = ACE_dynamic_cast (TAO_POA *,
                                   this->gateway_poa_);
  ACE_CHECK_RETURN (CORBA::Object::_nil ());

  PortableInterceptor::ObjectReferenceTemplate *ort_template =
    poa->get_adapter_template();

  TAO_ObjectReferenceTemplate *ort =
    ACE_dynamic_cast (TAO_ObjectReferenceTemplate *,
                      ort_template);

  CORBA::Object_ptr object_ptr =
    ort->make_object (interface_repository_id,
                      *obj_id
                      ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (CORBA::Object::_nil ());

  return object_ptr;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?