// -*- C++ -*-
//
// DomainC.cpp,v 1.62 2002/02/08 01:07:32 coryan Exp

// ****  Code generated by the The ACE ORB (TAO) IDL Compiler ****
// TAO and the TAO IDL Compiler have been developed by:
//       Center for Distributed Object Computing
//       Washington University
//       St. Louis, MO
//       USA
//       http://www.cs.wustl.edu/~schmidt/doc-center.html
// and
//       Distributed Object Computing Laboratory
//       University of California at Irvine
//       Irvine, CA
//       USA
//       http://doc.ece.uci.edu/
//
// Information about TAO is available at:
//     http://www.cs.wustl.edu/~schmidt/TAO.html

#include "DomainC.h"

#include "tao/Stub.h"
#include "tao/Invocation.h"
#include "tao/PortableInterceptor.h"

#if TAO_HAS_INTERCEPTORS == 1
#include "tao/RequestInfo_Util.h"
#include "tao/ClientRequestInfo_i.h"
#include "tao/ClientInterceptorAdapter.h"
#endif  /* TAO_HAS_INTERCEPTORS == 1 */

#include "tao/IFR_Client_Adapter.h"
#include "ace/Dynamic_Service.h"

#if defined (__BORLANDC__)
#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig
#endif /* __BORLANDC__ */

#if !defined (__ACE_INLINE__)
#include "DomainC.i"
#endif /* !defined INLINE */

int CORBA::DomainManager::_tao_class_id = 0;

CORBA::DomainManager_ptr
tao_CORBA_DomainManager_duplicate (
    CORBA::DomainManager_ptr p
  )
{
  return CORBA::DomainManager::_duplicate (p);
}

void
tao_CORBA_DomainManager_release (
    CORBA::DomainManager_ptr p
  )
{
  CORBA::release (p);
}

CORBA::DomainManager_ptr
tao_CORBA_DomainManager_nil (
    void
  )
{
  return CORBA::DomainManager::_nil ();
}

CORBA::DomainManager_ptr
tao_CORBA_DomainManager_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return CORBA::DomainManager::_narrow (p ACE_ENV_ARG_PARAMETER);
}

CORBA::Object *
tao_CORBA_DomainManager_upcast (
    void *src
  )
{
  CORBA::DomainManager **tmp =
    ACE_static_cast (CORBA::DomainManager **, src);
  return *tmp;
}

// *************************************************************
// CORBA::DomainManager_var
// TAO_IDL - Generated from
// be/be_interface.cpp:654
// *************************************************************

CORBA::DomainManager_var::DomainManager_var (void) // default constructor
  : ptr_ (DomainManager::_nil ())
{}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::ptr (void) const
{
  return this->ptr_;
}

CORBA::DomainManager_var::DomainManager_var (const ::CORBA::DomainManager_var &p) // copy constructor
  : TAO_Base_var (),
    ptr_ (DomainManager::_duplicate (p.ptr ()))
{}

CORBA::DomainManager_var::~DomainManager_var (void) // destructor
{
  CORBA::release (this->ptr_);
}

CORBA::DomainManager_var &
CORBA::DomainManager_var::operator= (DomainManager_ptr p)
{
  CORBA::release (this->ptr_);
  this->ptr_ = p;
  return *this;
}

CORBA::DomainManager_var &
CORBA::DomainManager_var::operator= (const ::CORBA::DomainManager_var &p)
{
  if (this != &p)
  {
    CORBA::release (this->ptr_);
    this->ptr_ = ::CORBA::DomainManager::_duplicate (p.ptr ());
  }
  return *this;
}

CORBA::DomainManager_var::operator const ::CORBA::DomainManager_ptr &() const // cast
{
  return this->ptr_;
}

CORBA::DomainManager_var::operator ::CORBA::DomainManager_ptr &() // cast
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::operator-> (void) const
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::in (void) const
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr &
CORBA::DomainManager_var::inout (void)
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr &
CORBA::DomainManager_var::out (void)
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::DomainManager::_nil ();
  return this->ptr_;
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::_retn (void)
{
  // yield ownership of managed obj reference
  ::CORBA::DomainManager_ptr val = this->ptr_;
  this->ptr_ = ::CORBA::DomainManager::_nil ();
  return val;
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::tao_duplicate (DomainManager_ptr p)
{
  return ::CORBA::DomainManager::_duplicate (p);
}

void
CORBA::DomainManager_var::tao_release (DomainManager_ptr p)
{
  CORBA::release (p);
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::tao_nil (void)
{
  return ::CORBA::DomainManager::_nil ();
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_var::tao_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return ::CORBA::DomainManager::_narrow (p ACE_ENV_ARG_PARAMETER);
}

CORBA::Object *
CORBA::DomainManager_var::tao_upcast (void *src)
{
  DomainManager **tmp =
    ACE_static_cast (DomainManager **, src);
  return *tmp;
}

// *************************************************************
// CORBA::DomainManager_out
// TAO_IDL - Generated from
// be/be_interface.cpp:932
// *************************************************************

CORBA::DomainManager_out::DomainManager_out (DomainManager_ptr &p)
  : ptr_ (p)
{
  this->ptr_ = ::CORBA::DomainManager::_nil ();
}

CORBA::DomainManager_out::DomainManager_out (DomainManager_var &p) // constructor from _var
  : ptr_ (p.out ())
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::DomainManager::_nil ();
}

CORBA::DomainManager_out::DomainManager_out (const ::CORBA::DomainManager_out &p) // copy constructor
  : ptr_ (ACE_const_cast (DomainManager_out &, p).ptr_)
{}

::CORBA::DomainManager_out &
CORBA::DomainManager_out::operator= (const ::CORBA::DomainManager_out &p)
{
  this->ptr_ = ACE_const_cast (DomainManager_out&, p).ptr_;
  return *this;
}

CORBA::DomainManager_out &
CORBA::DomainManager_out::operator= (const ::CORBA::DomainManager_var &p)
{
  this->ptr_ = ::CORBA::DomainManager::_duplicate (p.ptr ());
  return *this;
}

CORBA::DomainManager_out &
CORBA::DomainManager_out::operator= (DomainManager_ptr p)
{
  this->ptr_ = p;
  return *this;
}

CORBA::DomainManager_out::operator ::CORBA::DomainManager_ptr &() // cast
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr &
CORBA::DomainManager_out::ptr (void) // ptr
{
  return this->ptr_;
}

::CORBA::DomainManager_ptr
CORBA::DomainManager_out::operator-> (void)
{
  return this->ptr_;
}


#if (TAO_HAS_INTERCEPTORS == 1)
class TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy : public TAO_ClientRequestInfo_i
{
public:
  TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy (
      TAO_GIOP_Invocation *_tao_invocation,
      CORBA::Object_ptr _tao_target,
      const CORBA::PolicyType & policy_type ACE_ENV_ARG_DECL_WITH_DEFAULTS
    );

  virtual Dynamic::ParameterList * arguments (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual Dynamic::ExceptionList * exceptions (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA::Any * result (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  void result (CORBA::Policy_ptr result);

private:
  TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy (const TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy &);
  void operator= (const TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy &);

  const CORBA::PolicyType & policy_type_;
  CORBA::Policy_ptr _result;
};

TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy::TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy (
    TAO_GIOP_Invocation *_tao_invocation,
    CORBA::Object_ptr _tao_target,
    const CORBA::PolicyType & policy_type ACE_ENV_ARG_DECL_NOT_USED
  )
  : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target),
    policy_type_ (policy_type)
{}

Dynamic::ParameterList *
TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy::arguments (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the argument list on demand.
  Dynamic::ParameterList *parameter_list =
    TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  Dynamic::ParameterList_var safe_parameter_list = parameter_list;

  parameter_list->length (1);
  CORBA::ULong len = 0;

    (*parameter_list)[len].argument <<= policy_type_;
  (*parameter_list)[len].mode = CORBA::PARAM_IN;
  len++;

  return safe_parameter_list._retn ();
}

Dynamic::ExceptionList *
TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy::exceptions (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the exception list on demand.
  Dynamic::ExceptionList *exception_list =
    TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  return exception_list;
}

CORBA::Any *
TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy::result (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the result on demand.
  CORBA::Boolean tk_void_any = 0;
  CORBA::Any *result_any =
    TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  CORBA::Any_var safe_result_any = result_any;

  (*result_any) <<= this->_result;
  return safe_result_any._retn ();
}

void
TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy::result (::CORBA::Policy_ptr result)
{
  // update the result
  this->_result = result;
}

#endif /* TAO_HAS_INTERCEPTORS */

///////////////////////////////////////////////////////////////////////
//                Base & Remote Proxy  Implementation.
//

CORBA::_TAO_DomainManager_Proxy_Impl::_TAO_DomainManager_Proxy_Impl (void)
{}

CORBA::_TAO_DomainManager_Remote_Proxy_Impl::_TAO_DomainManager_Remote_Proxy_Impl (void)
{}

// Remote Implementation of the IDL interface methods

::CORBA::Policy_ptr CORBA::_TAO_DomainManager_Remote_Proxy_Impl::get_domain_policy (
    CORBA_Object *_collocated_tao_target_,
    CORBA::PolicyType policy_type
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{

  CORBA::Policy_var _tao_retval (CORBA::Policy::_nil ());



  TAO_Stub *istub = _collocated_tao_target_->_stubobj ();
  if (istub == 0)
    ACE_THROW_RETURN (CORBA::INTERNAL (),_tao_retval._retn ());


  TAO_GIOP_Twoway_Invocation _tao_call (
      istub,
      "get_domain_policy",
      17,
      1,
      istub->orb_core ()
    );

  int _invoke_status;

#if (TAO_HAS_INTERCEPTORS == 1)
  TAO_ClientRequestInterceptor_Adapter _tao_vfr (
      istub->orb_core ()->client_request_interceptors (),
      &_tao_call,
      _invoke_status
    );

#endif  /* TAO_HAS_INTERCEPTORS */

  for (;;)
    {
      _invoke_status = TAO_INVOKE_EXCEPTION;

#if TAO_HAS_INTERCEPTORS == 1
      TAO_ClientRequestInfo_CORBA_DomainManager_get_domain_policy _tao_ri (
        &_tao_call,
        _collocated_tao_target_,
        policy_type ACE_ENV_ARG_PARAMETER
      );
            ACE_CHECK_RETURN (_tao_retval._retn ());

#endif /* TAO_HAS_INTERCEPTORS */


      CORBA::Short _tao_response_flag = TAO_TWOWAY_RESPONSE_FLAG;
      TAO_INTERCEPTOR (_tao_ri.response_expected (1));

#if TAO_HAS_INTERCEPTORS == 1

      ACE_TRY
        {
          _tao_vfr.send_request (
            &_tao_ri
            ACE_ENV_ARG_PARAMETER
          );
          ACE_TRY_CHECK;

          if (_invoke_status == TAO_INVOKE_RESTART)
            {
              _tao_call.restart_flag (1);
              continue;
            }

#endif /* TAO_HAS_INTERCEPTORS */

          _tao_call.start (ACE_ENV_SINGLE_ARG_PARAMETER);
                    TAO_INTERCEPTOR_CHECK_RETURN (_tao_retval._retn ());

          _tao_call.prepare_header (
              ACE_static_cast (CORBA::Octet, _tao_response_flag)
              ACE_ENV_ARG_PARAMETER
            );
                    TAO_INTERCEPTOR_CHECK_RETURN (_tao_retval._retn ());

          TAO_OutputCDR &_tao_out = _tao_call.out_stream ();
          if (!(
                            (_tao_out << policy_type)
            ))
            TAO_INTERCEPTOR_THROW_RETURN (
              CORBA::MARSHAL (),
              0
            );

          _invoke_status =
            _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
                    TAO_INTERCEPTOR_CHECK_RETURN (_tao_retval._retn ());

          if (_invoke_status == TAO_INVOKE_EXCEPTION)
            {
              TAO_INTERCEPTOR_THROW_RETURN (
                CORBA::UNKNOWN (TAO_OMG_VMCID | 1, CORBA::COMPLETED_YES),
                0
              );

            }
          else if (_invoke_status == TAO_INVOKE_RESTART)
            {
              TAO_INTERCEPTOR (
                _tao_ri.reply_status (_invoke_status);
                _tao_vfr.receive_other (
                  &_tao_ri
                  ACE_ENV_ARG_PARAMETER
                );
                ACE_TRY_CHECK;
              )

              continue;
            }

          TAO_InputCDR &_tao_in = _tao_call.inp_stream ();
          if (!(
                            (_tao_in >> _tao_retval.inout ())
              ))
            {
              TAO_INTERCEPTOR_THROW_RETURN (
                CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES),
                0
              );

            }

#if TAO_HAS_INTERCEPTORS == 1
          ::CORBA::Policy_ptr _tao_retval_info = _tao_retval._retn ();
          _tao_ri.result (_tao_retval_info);
          _tao_retval = _tao_retval_info;

          _tao_ri.reply_status (_invoke_status);
          _tao_vfr.receive_reply (
            &_tao_ri
            ACE_ENV_ARG_PARAMETER
          );
          ACE_TRY_CHECK;

      }
    ACE_CATCHANY
      {
        _tao_ri.exception (&ACE_ANY_EXCEPTION);
        _tao_vfr.receive_exception (
          &_tao_ri
          ACE_ENV_ARG_PARAMETER
        );
        ACE_TRY_CHECK;

        PortableInterceptor::ReplyStatus _tao_status =
          _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);
        ACE_TRY_CHECK;

        if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION
            || _tao_status == PortableInterceptor::USER_EXCEPTION)
          ACE_RE_THROW;
      }
    ACE_ENDTRY;
        ACE_CHECK_RETURN (_tao_retval._retn ());

    PortableInterceptor::ReplyStatus _tao_status =
      _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);
        ACE_CHECK_RETURN (_tao_retval._retn ());

    if (_tao_status == PortableInterceptor::LOCATION_FORWARD
        || _tao_status == PortableInterceptor::TRANSPORT_RETRY)
      continue;

#endif  /* TAO_HAS_INTERCEPTORS */

    break;
  }
return _tao_retval._retn ();
}


//
//            End  Base & Remote  Proxy Implemeentation.
///////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////
//           Remote & Base  Proxy Broker Implementation
//

CORBA::_TAO_DomainManager_Proxy_Broker::_TAO_DomainManager_Proxy_Broker (void)
{
}

CORBA::_TAO_DomainManager_Proxy_Broker::~_TAO_DomainManager_Proxy_Broker (void)
{
}

CORBA::_TAO_DomainManager_Proxy_Broker * (*CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer) (
    CORBA::Object_ptr obj
  ) = 0;

// Factory Member function Implementation.
CORBA::_TAO_DomainManager_Remote_Proxy_Broker *
CORBA::_TAO_DomainManager_Remote_Proxy_Broker::the_TAO_DomainManager_Remote_Proxy_Broker (void)
{
  static ::CORBA::_TAO_DomainManager_Remote_Proxy_Broker remote_proxy_broker;
  return &remote_proxy_broker;
}

CORBA::_TAO_DomainManager_Remote_Proxy_Broker::_TAO_DomainManager_Remote_Proxy_Broker (void)
{
}

CORBA::_TAO_DomainManager_Remote_Proxy_Broker::~_TAO_DomainManager_Remote_Proxy_Broker (void)
{
}

CORBA::_TAO_DomainManager_Proxy_Impl&
CORBA::_TAO_DomainManager_Remote_Proxy_Broker::select_proxy (
  ::CORBA::DomainManager *
  ACE_ENV_ARG_DECL_NOT_USED
)
{
  return this->remote_proxy_impl_;
}


//
//           End Remote & Base Proxy Broker Implementation
///////////////////////////////////////////////////////////////////////


// TAO_IDL - Generated from
// be/be_visitor_interface/interface_cs.cpp:209

CORBA::DomainManager::DomainManager (int collocated)
{
  this->CORBA_DomainManager_setup_collocation (collocated);
}

CORBA::DomainManager::~DomainManager (void)
{}

void
CORBA::DomainManager::CORBA_DomainManager_setup_collocation (int collocated)
{
  if (collocated)
    this->the_TAO_DomainManager_Proxy_Broker_ =
      ::CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer (this);
  else
    this->the_TAO_DomainManager_Proxy_Broker_ =
      ::CORBA::_TAO_DomainManager_Remote_Proxy_Broker::the_TAO_DomainManager_Remote_Proxy_Broker ();
}

void CORBA::DomainManager::_tao_any_destructor (void *_tao_void_pointer)
{
  DomainManager *tmp = ACE_static_cast (DomainManager*, _tao_void_pointer);
  CORBA::release (tmp);
}

CORBA::DomainManager_ptr CORBA::DomainManager::_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL
  )
{
  if (CORBA::is_nil (obj))
    return DomainManager::_nil ();
  if (! obj->_is_local ())
    {
      CORBA::Boolean is_a = obj->_is_a ("IDL:omg.org/CORBA/DomainManager:1.0" ACE_ENV_ARG_PARAMETER);
      ACE_CHECK_RETURN (DomainManager::_nil ());
      if (is_a == 0)
        return DomainManager::_nil ();
    }
  return DomainManager::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);
}

CORBA::DomainManager_ptr
CORBA::DomainManager::_unchecked_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL_NOT_USED
  )
{
  if (CORBA::is_nil (obj))
    return DomainManager::_nil ();
  if (! obj->_is_local ())
    {
      TAO_Stub* stub = obj->_stubobj ();
      if (stub)
        stub->_incr_refcnt ();
      DomainManager_ptr default_proxy = DomainManager::_nil ();

      if (
          !CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&
          stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&
          obj->_is_collocated () &&
          CORBA__TAO_DomainManager_Proxy_Broker_Factory_function_pointer != 0
        )
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::DomainManager (
                  stub,
                  1,
                  obj->_servant ()
                ),
              DomainManager::_nil ()
            );
        }

      if (CORBA::is_nil (default_proxy))
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::DomainManager (
                  stub,
                  0,
                  obj->_servant ()
                ),
              DomainManager::_nil ()
            );
        }

      return default_proxy;
    }
  else
    return
      ACE_reinterpret_cast
        (
          DomainManager_ptr,
            obj->_tao_QueryInterface
              (
                ACE_reinterpret_cast
                  (
                    ptr_arith_t,
                    &DomainManager::_tao_class_id
                  )
              )
        );
}

CORBA::DomainManager_ptr
CORBA::DomainManager::_duplicate (DomainManager_ptr obj)
{
  if (!CORBA::is_nil (obj))
    obj->_add_ref ();
  return obj;
}

CORBA::Boolean CORBA::DomainManager::_is_a (const CORBA::Char *value ACE_ENV_ARG_DECL)
{
  if (
    (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/DomainManager:1.0")) ||
    (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/Object:1.0")))
  return 1; // success using local knowledge
  else
    return this->CORBA_Object::_is_a (value ACE_ENV_ARG_PARAMETER);
}

void *CORBA::DomainManager::_tao_QueryInterface (ptr_arith_t type)
{
  void *retv = 0;
  if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, DomainManager)::_tao_class_id))
    retv = ACE_reinterpret_cast (void*, this);
  else if (type == ACE_reinterpret_cast (ptr_arith_t, &CORBA::Object::_tao_class_id))
    retv = ACE_reinterpret_cast (void *,
      ACE_static_cast (CORBA::Object_ptr, this));

  if (retv)
    this->_add_ref ();
  return retv;
}

const char* CORBA::DomainManager::_interface_repository_id (void) const
{
  return "IDL:omg.org/CORBA/DomainManager:1.0";
}

::CORBA::Policy_ptr CORBA::DomainManager::get_domain_policy (
    CORBA::PolicyType policy_type
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  _TAO_DomainManager_Proxy_Impl &proxy =
    this->the_TAO_DomainManager_Proxy_Broker_->select_proxy (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  return proxy.get_domain_policy (
      this,
      policy_type ACE_ENV_ARG_PARAMETER
    );
}

static const CORBA::Long _oc_CORBA_DomainManager[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  36,
  ACE_NTOHL (0x49444c3a),
  ACE_NTOHL (0x6f6d672e),
  ACE_NTOHL (0x6f72672f),
  ACE_NTOHL (0x434f5242),
  ACE_NTOHL (0x412f446f),
  ACE_NTOHL (0x6d61696e),
  ACE_NTOHL (0x4d616e61),
  ACE_NTOHL (0x6765723a),
  ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CORBA/DomainManager:1.0
  14,
  ACE_NTOHL (0x446f6d61),
  ACE_NTOHL (0x696e4d61),
  ACE_NTOHL (0x6e616765),
  ACE_NTOHL (0x72000000),  // name = DomainManager
};

static CORBA::TypeCode _tc_TAO_tc_CORBA_DomainManager (
    CORBA::tk_objref,
    sizeof (_oc_CORBA_DomainManager),
    (char *) &_oc_CORBA_DomainManager,
    0,
    sizeof (CORBA::DomainManager)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_DomainManager, &_tc_TAO_tc_CORBA_DomainManager)
TAO_NAMESPACE_END

TAO_NAMESPACE_TYPE (const CORBA::ULong)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::ULong, SecConstruction, 11U)
TAO_NAMESPACE_END
int CORBA::ConstructionPolicy::_tao_class_id = 0;

CORBA::ConstructionPolicy_ptr
tao_CORBA_ConstructionPolicy_duplicate (
    CORBA::ConstructionPolicy_ptr p
  )
{
  return CORBA::ConstructionPolicy::_duplicate (p);
}

void
tao_CORBA_ConstructionPolicy_release (
    CORBA::ConstructionPolicy_ptr p
  )
{
  CORBA::release (p);
}

CORBA::ConstructionPolicy_ptr
tao_CORBA_ConstructionPolicy_nil (
    void
  )
{
  return CORBA::ConstructionPolicy::_nil ();
}

CORBA::ConstructionPolicy_ptr
tao_CORBA_ConstructionPolicy_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return CORBA::ConstructionPolicy::_narrow (p ACE_ENV_ARG_PARAMETER);
}

CORBA::Object *
tao_CORBA_ConstructionPolicy_upcast (
    void *src
  )
{
  CORBA::ConstructionPolicy **tmp =
    ACE_static_cast (CORBA::ConstructionPolicy **, src);
  return *tmp;
}

// *************************************************************
// CORBA::ConstructionPolicy_var
// TAO_IDL - Generated from
// be/be_interface.cpp:654
// *************************************************************

CORBA::ConstructionPolicy_var::ConstructionPolicy_var (void) // default constructor
  : ptr_ (ConstructionPolicy::_nil ())
{}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::ptr (void) const
{
  return this->ptr_;
}

CORBA::ConstructionPolicy_var::ConstructionPolicy_var (const ::CORBA::ConstructionPolicy_var &p) // copy constructor
  : TAO_Base_var (),
    ptr_ (ConstructionPolicy::_duplicate (p.ptr ()))
{}

CORBA::ConstructionPolicy_var::~ConstructionPolicy_var (void) // destructor
{
  CORBA::release (this->ptr_);
}

CORBA::ConstructionPolicy_var &
CORBA::ConstructionPolicy_var::operator= (ConstructionPolicy_ptr p)
{
  CORBA::release (this->ptr_);
  this->ptr_ = p;
  return *this;
}

CORBA::ConstructionPolicy_var &
CORBA::ConstructionPolicy_var::operator= (const ::CORBA::ConstructionPolicy_var &p)
{
  if (this != &p)
  {
    CORBA::release (this->ptr_);
    this->ptr_ = ::CORBA::ConstructionPolicy::_duplicate (p.ptr ());
  }
  return *this;
}

CORBA::ConstructionPolicy_var::operator const ::CORBA::ConstructionPolicy_ptr &() const // cast
{
  return this->ptr_;
}

CORBA::ConstructionPolicy_var::operator ::CORBA::ConstructionPolicy_ptr &() // cast
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::operator-> (void) const
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::in (void) const
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr &
CORBA::ConstructionPolicy_var::inout (void)
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr &
CORBA::ConstructionPolicy_var::out (void)
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::ConstructionPolicy::_nil ();
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::_retn (void)
{
  // yield ownership of managed obj reference
  ::CORBA::ConstructionPolicy_ptr val = this->ptr_;
  this->ptr_ = ::CORBA::ConstructionPolicy::_nil ();
  return val;
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::tao_duplicate (ConstructionPolicy_ptr p)
{
  return ::CORBA::ConstructionPolicy::_duplicate (p);
}

void
CORBA::ConstructionPolicy_var::tao_release (ConstructionPolicy_ptr p)
{
  CORBA::release (p);
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::tao_nil (void)
{
  return ::CORBA::ConstructionPolicy::_nil ();
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_var::tao_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return ::CORBA::ConstructionPolicy::_narrow (p ACE_ENV_ARG_PARAMETER);
}

CORBA::Object *
CORBA::ConstructionPolicy_var::tao_upcast (void *src)
{
  ConstructionPolicy **tmp =
    ACE_static_cast (ConstructionPolicy **, src);
  return *tmp;
}

// *************************************************************
// CORBA::ConstructionPolicy_out
// TAO_IDL - Generated from
// be/be_interface.cpp:932
// *************************************************************

CORBA::ConstructionPolicy_out::ConstructionPolicy_out (ConstructionPolicy_ptr &p)
  : ptr_ (p)
{
  this->ptr_ = ::CORBA::ConstructionPolicy::_nil ();
}

CORBA::ConstructionPolicy_out::ConstructionPolicy_out (ConstructionPolicy_var &p) // constructor from _var
  : ptr_ (p.out ())
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::ConstructionPolicy::_nil ();
}

CORBA::ConstructionPolicy_out::ConstructionPolicy_out (const ::CORBA::ConstructionPolicy_out &p) // copy constructor
  : ptr_ (ACE_const_cast (ConstructionPolicy_out &, p).ptr_)
{}

::CORBA::ConstructionPolicy_out &
CORBA::ConstructionPolicy_out::operator= (const ::CORBA::ConstructionPolicy_out &p)
{
  this->ptr_ = ACE_const_cast (ConstructionPolicy_out&, p).ptr_;
  return *this;
}

CORBA::ConstructionPolicy_out &
CORBA::ConstructionPolicy_out::operator= (const ::CORBA::ConstructionPolicy_var &p)
{
  this->ptr_ = ::CORBA::ConstructionPolicy::_duplicate (p.ptr ());
  return *this;
}

CORBA::ConstructionPolicy_out &
CORBA::ConstructionPolicy_out::operator= (ConstructionPolicy_ptr p)
{
  this->ptr_ = p;
  return *this;
}

CORBA::ConstructionPolicy_out::operator ::CORBA::ConstructionPolicy_ptr &() // cast
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr &
CORBA::ConstructionPolicy_out::ptr (void) // ptr
{
  return this->ptr_;
}

::CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy_out::operator-> (void)
{
  return this->ptr_;
}


#if (TAO_HAS_INTERCEPTORS == 1)
class TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager : public TAO_ClientRequestInfo_i
{
public:
  TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager (
      TAO_GIOP_Invocation *_tao_invocation,
      CORBA::Object_ptr _tao_target,
      CORBA::InterfaceDef_ptr object_type,
      const CORBA::Boolean & constr_policy ACE_ENV_ARG_DECL_WITH_DEFAULTS
    );

  virtual Dynamic::ParameterList * arguments (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual Dynamic::ExceptionList * exceptions (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA::Any * result (ACE_ENV_SINGLE_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

private:
  TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager (const TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager &);
  void operator= (const TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager &);

  CORBA::InterfaceDef_ptr object_type_;
  const CORBA::Boolean & constr_policy_;

};

TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager::TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager (
    TAO_GIOP_Invocation *_tao_invocation,
    CORBA::Object_ptr _tao_target,
    CORBA::InterfaceDef_ptr object_type,
    const CORBA::Boolean & constr_policy ACE_ENV_ARG_DECL_NOT_USED
  )
  : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target),
    object_type_ (object_type),
    constr_policy_ (constr_policy)
{}

Dynamic::ParameterList *
TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager::arguments (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the argument list on demand.
  Dynamic::ParameterList *parameter_list =
    TAO_RequestInfo_Util::make_parameter_list (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  Dynamic::ParameterList_var safe_parameter_list = parameter_list;

  parameter_list->length (2);
  CORBA::ULong len = 0;

  TAO_IFR_Client_Adapter *adapter =
    ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
        TAO_ORB_Core::ifr_client_adapter_name ()
      );

  adapter->interfacedef_any_insert (
      (*parameter_list)[len].argument,
      this->object_type_
    );
  (*parameter_list)[len].mode = CORBA::PARAM_IN;
  len++;
    (*parameter_list)[len].argument <<= CORBA::Any::from_boolean (this->constr_policy_);
  (*parameter_list)[len].mode = CORBA::PARAM_IN;
  len++;

  return safe_parameter_list._retn ();
}

Dynamic::ExceptionList *
TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager::exceptions (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the exception list on demand.
  Dynamic::ExceptionList *exception_list =
    TAO_RequestInfo_Util::make_exception_list (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  return exception_list;
}

CORBA::Any *
TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager::result (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // Generate the result on demand.
  CORBA::Boolean tk_void_any = 1;
  CORBA::Any *result_any =
    TAO_RequestInfo_Util::make_any (tk_void_any ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);

  return result_any;
}

#endif /* TAO_HAS_INTERCEPTORS */

///////////////////////////////////////////////////////////////////////
//                Base & Remote Proxy  Implementation.
//

CORBA::_TAO_ConstructionPolicy_Proxy_Impl::_TAO_ConstructionPolicy_Proxy_Impl (void)
{}

CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::_TAO_ConstructionPolicy_Remote_Proxy_Impl (void)
{}

// Remote Implementation of the IDL interface methods

void CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Impl::make_domain_manager (
    CORBA_Object *_collocated_tao_target_,
    CORBA::InterfaceDef_ptr object_type,
    CORBA::Boolean constr_policy
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{




  TAO_Stub *istub = _collocated_tao_target_->_stubobj ();
  if (istub == 0)
    ACE_THROW (CORBA::INTERNAL ());


  TAO_GIOP_Twoway_Invocation _tao_call (
      istub,
      "make_domain_manager",
      19,
      2,
      istub->orb_core ()
    );

  int _invoke_status;

#if (TAO_HAS_INTERCEPTORS == 1)
  TAO_ClientRequestInterceptor_Adapter _tao_vfr (
      istub->orb_core ()->client_request_interceptors (),
      &_tao_call,
      _invoke_status
    );

#endif  /* TAO_HAS_INTERCEPTORS */

  TAO_IFR_Client_Adapter *adapter =
    ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
        TAO_ORB_Core::ifr_client_adapter_name ()
      );

  for (;;)
    {
      _invoke_status = TAO_INVOKE_EXCEPTION;

#if TAO_HAS_INTERCEPTORS == 1
      TAO_ClientRequestInfo_CORBA_ConstructionPolicy_make_domain_manager _tao_ri (
        &_tao_call,
        _collocated_tao_target_,
        object_type,
        constr_policy ACE_ENV_ARG_PARAMETER
      );
            ACE_CHECK;

#endif /* TAO_HAS_INTERCEPTORS */


      CORBA::Short _tao_response_flag = TAO_TWOWAY_RESPONSE_FLAG;
      TAO_INTERCEPTOR (_tao_ri.response_expected (1));

#if TAO_HAS_INTERCEPTORS == 1

      ACE_TRY
        {
          _tao_vfr.send_request (
            &_tao_ri
            ACE_ENV_ARG_PARAMETER
          );
          ACE_TRY_CHECK;

          if (_invoke_status == TAO_INVOKE_RESTART)
            {
              _tao_call.restart_flag (1);
              continue;
            }

#endif /* TAO_HAS_INTERCEPTORS */

          _tao_call.start (ACE_ENV_SINGLE_ARG_PARAMETER);
                    TAO_INTERCEPTOR_CHECK;

          _tao_call.prepare_header (
              ACE_static_cast (CORBA::Octet, _tao_response_flag)
              ACE_ENV_ARG_PARAMETER
            );
                    TAO_INTERCEPTOR_CHECK;

          TAO_OutputCDR &_tao_out = _tao_call.out_stream ();
          if (!(
              (adapter->interfacedef_cdr_insert (_tao_out, object_type)) &&
              (_tao_out << CORBA::Any::from_boolean (constr_policy))
            ))
            TAO_INTERCEPTOR_THROW (
              CORBA::MARSHAL ()
            );

          _invoke_status =
            _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
                    TAO_INTERCEPTOR_CHECK;

          if (_invoke_status == TAO_INVOKE_EXCEPTION)
            {
              TAO_INTERCEPTOR_THROW (
                CORBA::UNKNOWN (TAO_OMG_VMCID | 1, CORBA::COMPLETED_YES)
              );

            }
          else if (_invoke_status == TAO_INVOKE_RESTART)
            {
              TAO_INTERCEPTOR (
                _tao_ri.reply_status (_invoke_status);
                _tao_vfr.receive_other (
                  &_tao_ri
                  ACE_ENV_ARG_PARAMETER
                );
                ACE_TRY_CHECK;
              )

              continue;
            }


#if TAO_HAS_INTERCEPTORS == 1

          _tao_ri.reply_status (_invoke_status);
          _tao_vfr.receive_reply (
            &_tao_ri
            ACE_ENV_ARG_PARAMETER
          );
          ACE_TRY_CHECK;

      }
    ACE_CATCHANY
      {
        _tao_ri.exception (&ACE_ANY_EXCEPTION);
        _tao_vfr.receive_exception (
          &_tao_ri
          ACE_ENV_ARG_PARAMETER
        );
        ACE_TRY_CHECK;

        PortableInterceptor::ReplyStatus _tao_status =
          _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);
        ACE_TRY_CHECK;

        if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION
            || _tao_status == PortableInterceptor::USER_EXCEPTION)
          ACE_RE_THROW;
      }
    ACE_ENDTRY;
        ACE_CHECK;

    PortableInterceptor::ReplyStatus _tao_status =
      _tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);
        ACE_CHECK;

    if (_tao_status == PortableInterceptor::LOCATION_FORWARD
        || _tao_status == PortableInterceptor::TRANSPORT_RETRY)
      continue;

#endif  /* TAO_HAS_INTERCEPTORS */

    break;
  }

}


//
//            End  Base & Remote  Proxy Implemeentation.
///////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////
//           Remote & Base  Proxy Broker Implementation
//

CORBA::_TAO_ConstructionPolicy_Proxy_Broker::_TAO_ConstructionPolicy_Proxy_Broker (void)
{
}

CORBA::_TAO_ConstructionPolicy_Proxy_Broker::~_TAO_ConstructionPolicy_Proxy_Broker (void)
{
}

CORBA::_TAO_ConstructionPolicy_Proxy_Broker * (*CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer) (
    CORBA::Object_ptr obj
  ) = 0;

// Factory Member function Implementation.
CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker *
CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker::the_TAO_ConstructionPolicy_Remote_Proxy_Broker (void)
{
  static ::CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker remote_proxy_broker;
  return &remote_proxy_broker;
}

CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker::_TAO_ConstructionPolicy_Remote_Proxy_Broker (void)
{
}

CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker::~_TAO_ConstructionPolicy_Remote_Proxy_Broker (void)
{
}

CORBA::_TAO_ConstructionPolicy_Proxy_Impl&
CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker::select_proxy (
  ::CORBA::ConstructionPolicy *
  ACE_ENV_ARG_DECL_NOT_USED
)
{
  return this->remote_proxy_impl_;
}


//
//           End Remote & Base Proxy Broker Implementation
///////////////////////////////////////////////////////////////////////


// TAO_IDL - Generated from
// be/be_visitor_interface/interface_cs.cpp:209

CORBA::ConstructionPolicy::ConstructionPolicy (int collocated)
{
  this->CORBA_ConstructionPolicy_setup_collocation (collocated);
}

CORBA::ConstructionPolicy::~ConstructionPolicy (void)
{}

void
CORBA::ConstructionPolicy::CORBA_ConstructionPolicy_setup_collocation (int collocated)
{
  if (collocated)
    this->the_TAO_ConstructionPolicy_Proxy_Broker_ =
      ::CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer (this);
  else
    this->the_TAO_ConstructionPolicy_Proxy_Broker_ =
      ::CORBA::_TAO_ConstructionPolicy_Remote_Proxy_Broker::the_TAO_ConstructionPolicy_Remote_Proxy_Broker ();

  this->CORBA_Policy_setup_collocation (collocated);
}

void CORBA::ConstructionPolicy::_tao_any_destructor (void *_tao_void_pointer)
{
  ConstructionPolicy *tmp = ACE_static_cast (ConstructionPolicy*, _tao_void_pointer);
  CORBA::release (tmp);
}

CORBA::ConstructionPolicy_ptr CORBA::ConstructionPolicy::_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL
  )
{
  if (CORBA::is_nil (obj))
    return ConstructionPolicy::_nil ();
  if (! obj->_is_local ())
    {
      CORBA::Boolean is_a = obj->_is_a ("IDL:omg.org/CORBA/ConstructionPolicy:1.0" ACE_ENV_ARG_PARAMETER);
      ACE_CHECK_RETURN (ConstructionPolicy::_nil ());
      if (is_a == 0)
        return ConstructionPolicy::_nil ();
    }
  return ConstructionPolicy::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);
}

CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy::_unchecked_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL_NOT_USED
  )
{
  if (CORBA::is_nil (obj))
    return ConstructionPolicy::_nil ();
  if (! obj->_is_local ())
    {
      TAO_Stub* stub = obj->_stubobj ();
      if (stub)
        stub->_incr_refcnt ();
      ConstructionPolicy_ptr default_proxy = ConstructionPolicy::_nil ();

      if (
          !CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&
          stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&
          obj->_is_collocated () &&
          CORBA__TAO_ConstructionPolicy_Proxy_Broker_Factory_function_pointer != 0
        )
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::ConstructionPolicy (
                  stub,
                  1,
                  obj->_servant ()
                ),
              ConstructionPolicy::_nil ()
            );
        }

      if (CORBA::is_nil (default_proxy))
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::ConstructionPolicy (
                  stub,
                  0,
                  obj->_servant ()
                ),
              ConstructionPolicy::_nil ()
            );
        }

      return default_proxy;
    }
  else
    return
      ACE_reinterpret_cast
        (
          ConstructionPolicy_ptr,
            obj->_tao_QueryInterface
              (
                ACE_reinterpret_cast
                  (
                    ptr_arith_t,
                    &ConstructionPolicy::_tao_class_id
                  )
              )
        );
}

CORBA::ConstructionPolicy_ptr
CORBA::ConstructionPolicy::_duplicate (ConstructionPolicy_ptr obj)
{
  if (!CORBA::is_nil (obj))
    obj->_add_ref ();
  return obj;
}

CORBA::Boolean CORBA::ConstructionPolicy::_is_a (const CORBA::Char *value ACE_ENV_ARG_DECL)
{
  if (
    (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/ConstructionPolicy:1.0")) ||
    (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/Policy:1.0")) ||
    (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/Object:1.0")))
  return 1; // success using local knowledge
  else
    return this->CORBA_Object::_is_a (value ACE_ENV_ARG_PARAMETER);
}

void *CORBA::ConstructionPolicy::_tao_QueryInterface (ptr_arith_t type)
{
  void *retv = 0;
  if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, ConstructionPolicy)::_tao_class_id))
    retv = ACE_reinterpret_cast (void*, this);
  else if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &::CORBA::Policy::_tao_class_id))
    retv = ACE_reinterpret_cast
      (
        void *,
        ACE_static_cast
          (
            CORBA::Policy_ptr,
            this
          )
      );
  else if (type == ACE_reinterpret_cast (ptr_arith_t, &CORBA::Object::_tao_class_id))
    retv = ACE_reinterpret_cast (void *,
      ACE_static_cast (CORBA::Object_ptr, this));

  if (retv)
    this->_add_ref ();
  return retv;
}

const char* CORBA::ConstructionPolicy::_interface_repository_id (void) const
{
  return "IDL:omg.org/CORBA/ConstructionPolicy:1.0";
}

void CORBA::ConstructionPolicy::make_domain_manager (
    CORBA::InterfaceDef_ptr object_type,
    CORBA::Boolean constr_policy
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  _TAO_ConstructionPolicy_Proxy_Impl &proxy =
    this->the_TAO_ConstructionPolicy_Proxy_Broker_->select_proxy (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  proxy.make_domain_manager (
      this,
      object_type,
      constr_policy ACE_ENV_ARG_PARAMETER
    );
}

static const CORBA::Long _oc_CORBA_ConstructionPolicy[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  41,
  ACE_NTOHL (0x49444c3a),
  ACE_NTOHL (0x6f6d672e),
  ACE_NTOHL (0x6f72672f),
  ACE_NTOHL (0x434f5242),
  ACE_NTOHL (0x412f436f),
  ACE_NTOHL (0x6e737472),
  ACE_NTOHL (0x75637469),
  ACE_NTOHL (0x6f6e506f),
  ACE_NTOHL (0x6c696379),
  ACE_NTOHL (0x3a312e30),
  ACE_NTOHL (0x0),  // repository ID = IDL:omg.org/CORBA/ConstructionPolicy:1.0
  19,
  ACE_NTOHL (0x436f6e73),
  ACE_NTOHL (0x74727563),
  ACE_NTOHL (0x74696f6e),
  ACE_NTOHL (0x506f6c69),
  ACE_NTOHL (0x63790000),  // name = ConstructionPolicy
};

static CORBA::TypeCode _tc_TAO_tc_CORBA_ConstructionPolicy (
    CORBA::tk_objref,
    sizeof (_oc_CORBA_ConstructionPolicy),
    (char *) &_oc_CORBA_ConstructionPolicy,
    0,
    sizeof (CORBA::ConstructionPolicy)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_ConstructionPolicy, &_tc_TAO_tc_CORBA_ConstructionPolicy)
TAO_NAMESPACE_END


#if !defined (TAO_USE_SEQUENCE_TEMPLATES)

#if !defined (__TAO_UNBOUNDED_OBJECT_SEQUENCE_CORBA_DOMAINMANAGERLIST_CS_)
#define __TAO_UNBOUNDED_OBJECT_SEQUENCE_CORBA_DOMAINMANAGERLIST_CS_

// The Base_Sequence functions, please see tao/Sequence.h
void
CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::_allocate_buffer (CORBA::ULong length)
{
  CORBA::DomainManager **tmp = 0;
  tmp = _TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::allocbuf (length);

  if (this->buffer_ != 0)
  {
    CORBA::DomainManager **old = ACE_reinterpret_cast (CORBA::DomainManager**, this->buffer_);
    for (CORBA::ULong i = 0; i < this->length_; ++i)
      {
        if (!this->release_)
          {
            tmp[i] = CORBA::DomainManager::_duplicate (old[i]);
          }
        else
          {
            tmp[i] = old[i];
          }
      }

    if (this->release_)
      {
        delete[] old;
      }
  }
  this->buffer_ = tmp;
}

void
CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::_deallocate_buffer (void)
{
  if (this->buffer_ == 0 || this->release_ == 0)
    return;
  CORBA::DomainManager **tmp = ACE_reinterpret_cast (CORBA::DomainManager**, this->buffer_);

  for (CORBA::ULong i = 0; i < this->length_; ++i)
    {
      CORBA::release (tmp[i]);
      tmp[i] = CORBA::DomainManager::_nil ();
    }

  _TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::freebuf (tmp);
  this->buffer_ = 0;
}

CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::~_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList (void)
{
  this->_deallocate_buffer ();
}

void
CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::_shrink_buffer (CORBA::ULong nl, CORBA::ULong ol)
{
  CORBA::DomainManager **tmp = ACE_reinterpret_cast (CORBA::DomainManager**, this->buffer_);

  for (CORBA::ULong i = nl; i < ol; ++i)
    {
      CORBA::release (tmp[i]);
      tmp[i] = CORBA::DomainManager::_nil ();
    }
}

void
CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::_downcast (
    void* target,
    CORBA_Object *src
    ACE_ENV_ARG_DECL
  )
{
  CORBA::DomainManager **tmp = ACE_static_cast (CORBA::DomainManager**, target);
  *tmp = CORBA::DomainManager::_narrow (src ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

CORBA_Object*
CORBA::_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList::_upcast (void *src) const
{
  CORBA::DomainManager **tmp = ACE_static_cast (CORBA::DomainManager**, src);
  return *tmp;
}

#endif /* end #if !defined */


#endif /* !TAO_USE_SEQUENCE_TEMPLATES */

#if !defined (_CORBA_DOMAINMANAGERLIST_CS_)
#define _CORBA_DOMAINMANAGERLIST_CS_

// *************************************************************
// CORBA::DomainManagerList
// *************************************************************

CORBA::DomainManagerList::DomainManagerList (void)
{}
CORBA::DomainManagerList::DomainManagerList (CORBA::ULong max) // uses max size
  :
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Object_Sequence<CORBA::DomainManager,CORBA::DomainManager_var>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */
 (max)
{}
CORBA::DomainManagerList::DomainManagerList (CORBA::ULong max, CORBA::ULong length, CORBA::DomainManager_ptr *buffer, CORBA::Boolean release)
  :
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Object_Sequence<CORBA::DomainManager,CORBA::DomainManager_var>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */
 (max, length, buffer, release)
{}
CORBA::DomainManagerList::DomainManagerList (const DomainManagerList &seq) // copy ctor
  :
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Object_Sequence_CORBA_DomainManagerList
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Object_Sequence<CORBA::DomainManager,CORBA::DomainManager_var>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */
 (seq)
{}
CORBA::DomainManagerList::~DomainManagerList (void) // dtor
{}
void CORBA::DomainManagerList::_tao_any_destructor (void *_tao_void_pointer)
{
  DomainManagerList *tmp = ACE_static_cast (DomainManagerList*, _tao_void_pointer);
  delete tmp;
}


#endif /* end #if !defined */

static const CORBA::Long _oc_CORBA_DomainManagerList[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  40,
  ACE_NTOHL (0x49444c3a),
  ACE_NTOHL (0x6f6d672e),
  ACE_NTOHL (0x6f72672f),
  ACE_NTOHL (0x434f5242),
  ACE_NTOHL (0x412f446f),
  ACE_NTOHL (0x6d61696e),
  ACE_NTOHL (0x4d616e61),
  ACE_NTOHL (0x6765724c),
  ACE_NTOHL (0x6973743a),
  ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CORBA/DomainManagerList:1.0
  18,
  ACE_NTOHL (0x446f6d61),
  ACE_NTOHL (0x696e4d61),
  ACE_NTOHL (0x6e616765),
  ACE_NTOHL (0x724c6973),
  ACE_NTOHL (0x74000000),  // name = DomainManagerList
  CORBA::tk_sequence, // typecode kind
  80, // encapsulation length
    TAO_ENCAP_BYTE_ORDER, // byte order
    CORBA::tk_objref, // typecode kind
    64, // encapsulation length
      TAO_ENCAP_BYTE_ORDER, // byte order
      36,
      ACE_NTOHL (0x49444c3a),
      ACE_NTOHL (0x6f6d672e),
      ACE_NTOHL (0x6f72672f),
      ACE_NTOHL (0x434f5242),
      ACE_NTOHL (0x412f446f),
      ACE_NTOHL (0x6d61696e),
      ACE_NTOHL (0x4d616e61),
      ACE_NTOHL (0x6765723a),
      ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CORBA/DomainManager:1.0
      14,
      ACE_NTOHL (0x446f6d61),
      ACE_NTOHL (0x696e4d61),
      ACE_NTOHL (0x6e616765),
      ACE_NTOHL (0x72000000),  // name = DomainManager

    0U,

};

static CORBA::TypeCode _tc_TAO_tc_CORBA_DomainManagerList (
    CORBA::tk_alias,
    sizeof (_oc_CORBA_DomainManagerList),
    (char *) &_oc_CORBA_DomainManagerList,
    0,
    sizeof (CORBA::DomainManagerList)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_DomainManagerList, &_tc_TAO_tc_CORBA_DomainManagerList)
TAO_NAMESPACE_END

void operator<<= (CORBA::Any &_tao_any, CORBA::DomainManager_ptr _tao_elem)
{
  TAO_OutputCDR stream;
  if (stream << _tao_elem)
  {
    _tao_any._tao_replace (
        CORBA::_tc_DomainManager,
        TAO_ENCAP_BYTE_ORDER,
        stream.begin (),
        1,
        CORBA::DomainManager::_duplicate (_tao_elem),
        CORBA::DomainManager::_tao_any_destructor
      );
  }
}

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::DomainManager_ptr &_tao_elem)
{
  ACE_TRY_NEW_ENV
  {
    _tao_elem = CORBA::DomainManager::_nil ();
    CORBA::TypeCode_var type = _tao_any.type ();

    CORBA::Boolean result = type->equivalent (CORBA::_tc_DomainManager ACE_ENV_ARG_PARAMETER);
    ACE_TRY_CHECK;

    if (!result)
      return 0; // not equivalent

    TAO_InputCDR stream (
        _tao_any._tao_get_cdr (),
        _tao_any._tao_byte_order ()
      );
    if (stream >> _tao_elem)
    {
      ((CORBA::Any *)&_tao_any)->_tao_replace (
          CORBA::_tc_DomainManager,
          1,
          _tao_elem,
          CORBA::DomainManager::_tao_any_destructor
        );
      return 1;
    }
  }
  ACE_CATCHANY
  {
    _tao_elem = CORBA::DomainManager::_nil ();
    return 0;
  }
  ACE_ENDTRY;
  _tao_elem = CORBA::DomainManager::_nil ();
  return 0;
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)  || \
    defined (ACE_HAS_GNU_REPO)
    template class TAO_Object_Manager<CORBA::DomainManager,CORBA::DomainManager_var>;
  #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
  #  pragma instantiate TAO_Object_Manager<CORBA::DomainManager,CORBA::DomainManager_var>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

void operator<<= (CORBA::Any &_tao_any, CORBA::ConstructionPolicy_ptr _tao_elem)
{
  TAO_OutputCDR stream;
  if (stream << _tao_elem)
  {
    _tao_any._tao_replace (
        CORBA::_tc_ConstructionPolicy,
        TAO_ENCAP_BYTE_ORDER,
        stream.begin (),
        1,
        CORBA::ConstructionPolicy::_duplicate (_tao_elem),
        CORBA::ConstructionPolicy::_tao_any_destructor
      );
  }
}

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::ConstructionPolicy_ptr &_tao_elem)
{
  ACE_TRY_NEW_ENV
  {
    _tao_elem = CORBA::ConstructionPolicy::_nil ();
    CORBA::TypeCode_var type = _tao_any.type ();

    CORBA::Boolean result = type->equivalent (CORBA::_tc_ConstructionPolicy ACE_ENV_ARG_PARAMETER);
    ACE_TRY_CHECK;

    if (!result)
      return 0; // not equivalent

    TAO_InputCDR stream (
        _tao_any._tao_get_cdr (),
        _tao_any._tao_byte_order ()
      );
    if (stream >> _tao_elem)
    {
      ((CORBA::Any *)&_tao_any)->_tao_replace (
          CORBA::_tc_ConstructionPolicy,
          1,
          _tao_elem,
          CORBA::ConstructionPolicy::_tao_any_destructor
        );
      return 1;
    }
  }
  ACE_CATCHANY
  {
    _tao_elem = CORBA::ConstructionPolicy::_nil ();
    return 0;
  }
  ACE_ENDTRY;
  _tao_elem = CORBA::ConstructionPolicy::_nil ();
  return 0;
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)  || \
    defined (ACE_HAS_GNU_REPO)
    template class TAO_Object_Manager<CORBA::ConstructionPolicy,CORBA::ConstructionPolicy_var>;
  #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
  #  pragma instantiate TAO_Object_Manager<CORBA::ConstructionPolicy,CORBA::ConstructionPolicy_var>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

void operator<<= (
    CORBA::Any &_tao_any,
    const CORBA::DomainManagerList &_tao_elem
  ) // copying
{
  TAO_OutputCDR stream;
  if (stream << _tao_elem)
  {
    _tao_any._tao_replace (
        CORBA::_tc_DomainManagerList,
        TAO_ENCAP_BYTE_ORDER,
        stream.begin ()
      );
  }
}

void operator<<= (CORBA::Any &_tao_any, CORBA::DomainManagerList *_tao_elem) // non copying
{
  TAO_OutputCDR stream;
  stream << *_tao_elem;
  _tao_any._tao_replace (
      CORBA::_tc_DomainManagerList,
      TAO_ENCAP_BYTE_ORDER,
      stream.begin (),
      1,
      _tao_elem,
      CORBA::DomainManagerList::_tao_any_destructor
    );
}

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::DomainManagerList *&_tao_elem)
{
  return _tao_any >>= ACE_const_cast(
      const CORBA::DomainManagerList*&,
      _tao_elem
    );
}

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::DomainManagerList *&_tao_elem)
{
  _tao_elem = 0;
  ACE_TRY_NEW_ENV
  {
    CORBA::TypeCode_var type = _tao_any.type ();

    CORBA::Boolean result = type->equivalent (CORBA::_tc_DomainManagerList ACE_ENV_ARG_PARAMETER);
    ACE_TRY_CHECK;

    if (!result)
      return 0; // not equivalent

    if (_tao_any.any_owns_data ())
    {
      _tao_elem = ACE_static_cast(
          const CORBA::DomainManagerList*,
          _tao_any.value ()
        );
      return 1;
    }
    else
    {
      CORBA::DomainManagerList *tmp;
      ACE_NEW_RETURN (tmp, CORBA::DomainManagerList, 0);
      TAO_InputCDR stream (
          _tao_any._tao_get_cdr (),
          _tao_any._tao_byte_order ()
        );
      if (stream >> *tmp)
      {
        ((CORBA::Any *)&_tao_any)->_tao_replace (
            CORBA::_tc_DomainManagerList,
            1,
            ACE_static_cast (void *, tmp),
            CORBA::DomainManagerList::_tao_any_destructor
          );
        _tao_elem = tmp;
        return 1;
      }
      else
      {
        delete tmp;
      }
    }
  }
  ACE_CATCHANY
  {
  }
  ACE_ENDTRY;
  return 0;
}

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const CORBA::DomainManager_ptr _tao_objref
  )
{
  CORBA::Object_ptr _tao_corba_obj = _tao_objref;
  return (strm << _tao_corba_obj);
}

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CORBA::DomainManager_ptr &_tao_objref
  )
{
  ACE_TRY_NEW_ENV
  {
    CORBA::Object_var obj;
    if ((strm >> obj.inout ()) == 0)
      return 0;
    // narrow to the right type
    _tao_objref =
      CORBA::DomainManager::_unchecked_narrow (
          obj.in ()
          ACE_ENV_ARG_PARAMETER
        );
    ACE_TRY_CHECK;
    return 1;
  }
  ACE_CATCHANY
  {
    // do nothing
  }
  ACE_ENDTRY;
  return 0;
}

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const CORBA::ConstructionPolicy_ptr _tao_objref
  )
{
  CORBA::Object_ptr _tao_corba_obj = _tao_objref;
  return (strm << _tao_corba_obj);
}

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CORBA::ConstructionPolicy_ptr &_tao_objref
  )
{
  ACE_TRY_NEW_ENV
  {
    CORBA::Object_var obj;
    if ((strm >> obj.inout ()) == 0)
      return 0;
    // narrow to the right type
    _tao_objref =
      CORBA::ConstructionPolicy::_unchecked_narrow (
          obj.in ()
          ACE_ENV_ARG_PARAMETER
        );
    ACE_TRY_CHECK;
    return 1;
  }
  ACE_CATCHANY
  {
    // do nothing
  }
  ACE_ENDTRY;
  return 0;
}

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const CORBA::DomainManagerList &_tao_sequence
  )
{
  if (strm << _tao_sequence.length ())
  {
    // encode all elements
    CORBA::Boolean _tao_marshal_flag = 1;
    for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++)
    {
      _tao_marshal_flag = (strm << _tao_sequence[i].in ());
    }
    return _tao_marshal_flag;
  }
  return 0; // error
}

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CORBA::DomainManagerList &_tao_sequence
  )
{
  CORBA::ULong _tao_seq_len;
  if (strm >> _tao_seq_len)
  {
    // set the length of the sequence
    _tao_sequence.length (_tao_seq_len);
    // If length is 0 we return true.
    if (0 >= _tao_seq_len)
      return 1;
    // Add a check to the length of the sequence
    // to make sure it does not exceed the length
    // of the stream. (See bug 58.)
    if (_tao_seq_len > strm.length())
      return 0;
    // retrieve all the elements
    CORBA::Boolean _tao_marshal_flag = 1;
    for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++)
    {
      _tao_marshal_flag = (strm >> _tao_sequence[i].out ());
    }
    return _tao_marshal_flag;
  }
  return 0; // error
}
