// -*- C++ -*-
//
// PolicyC.cpp,v 1.66 2002/02/08 01:07:34 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 "PolicyC.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 */

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

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

static const CORBA::Long _oc_CORBA_PolicyErrorCode[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  38,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x434f5242), 
  ACE_NTOHL (0x412f506f), 
  ACE_NTOHL (0x6c696379), 
  ACE_NTOHL (0x4572726f), 
  ACE_NTOHL (0x72436f64), 
  ACE_NTOHL (0x653a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CORBA/PolicyErrorCode:1.0
  16,
  ACE_NTOHL (0x506f6c69), 
  ACE_NTOHL (0x63794572), 
  ACE_NTOHL (0x726f7243), 
  ACE_NTOHL (0x6f646500),  // name = PolicyErrorCode
  CORBA::tk_short,

};

static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyErrorCode (
    CORBA::tk_alias,
    sizeof (_oc_CORBA_PolicyErrorCode),
    (char *) &_oc_CORBA_PolicyErrorCode,
    0,
    sizeof (CORBA::PolicyErrorCode)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_PolicyErrorCode, &_tc_TAO_tc_CORBA_PolicyErrorCode)
TAO_NAMESPACE_END

TAO_NAMESPACE_TYPE (const CORBA::Short)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::Short, BAD_POLICY, 0)
TAO_NAMESPACE_END
TAO_NAMESPACE_TYPE (const CORBA::Short)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::Short, UNSUPPORTED_POLICY, 1)
TAO_NAMESPACE_END
TAO_NAMESPACE_TYPE (const CORBA::Short)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::Short, BAD_POLICY_TYPE, 2)
TAO_NAMESPACE_END
TAO_NAMESPACE_TYPE (const CORBA::Short)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::Short, BAD_POLICY_VALUE, 3)
TAO_NAMESPACE_END
TAO_NAMESPACE_TYPE (const CORBA::Short)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (const CORBA::Short, UNSUPPORTED_POLICY_VALUE, 4)
TAO_NAMESPACE_END
// Default constructor.
CORBA::PolicyError::PolicyError (void)
  : CORBA_UserException ("IDL:omg.org/CORBA/PolicyError:1.0")
{
}

// Destructor - all members are of self managing types.
CORBA::PolicyError::~PolicyError (void)
{
}

// Copy constructor.
CORBA::PolicyError::PolicyError (const ::CORBA::PolicyError &_tao_excp)
  : CORBA_UserException (_tao_excp._id ())
{
  this->reason = _tao_excp.reason;
}

// Assignment operator.
CORBA::PolicyError&
CORBA::PolicyError::operator= (const ::CORBA::PolicyError &_tao_excp)
{
  this->CORBA_UserException::operator= (_tao_excp);
  this->reason = _tao_excp.reason;
  return *this;
}

void CORBA::PolicyError::_tao_any_destructor (void *_tao_void_pointer)
{
  PolicyError *tmp = ACE_static_cast (PolicyError*, _tao_void_pointer);
  delete tmp;
}

CORBA::PolicyError *
CORBA::PolicyError::_downcast (CORBA::Exception *exc)
{
  if (!ACE_OS::strcmp ("IDL:omg.org/CORBA/PolicyError:1.0", exc->_id ()))
    {
      return ACE_dynamic_cast (PolicyError *, exc);
    }
  else
    {
      return 0;
    }
}

CORBA::Exception *CORBA::PolicyError::_alloc (void)
{
  CORBA::Exception *retval = 0;
  ACE_NEW_RETURN (retval, ::CORBA::PolicyError, 0);
  return retval;
}

CORBA::Exception *
CORBA::PolicyError::_tao_duplicate (void) const
{
  CORBA::Exception *result;
  ACE_NEW_RETURN (
      result,
      CORBA::PolicyError (*this),
      0
    );
  return result;
}

void CORBA::PolicyError::_raise ()
{
  TAO_RAISE (*this);
}

void CORBA::PolicyError::_tao_encode (
    TAO_OutputCDR &cdr
    ACE_ENV_ARG_DECL
  ) const
{
  if (cdr << *this)
    {
      return;
    }
  
  ACE_THROW (CORBA::MARSHAL ());
}

void CORBA::PolicyError::_tao_decode (
    TAO_InputCDR &cdr
    ACE_ENV_ARG_DECL
  )
{
  if (cdr >> *this)
    {
      return;
    }
  
  ACE_THROW (CORBA::MARSHAL ());
}

CORBA::PolicyError::PolicyError (
    CORBA::PolicyErrorCode _tao_reason
  )
  : CORBA_UserException ("IDL:omg.org/CORBA/PolicyError:1.0")
{
  this->reason = _tao_reason;
}

static const CORBA::Long _oc_CORBA_PolicyError[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  34,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x434f5242), 
  ACE_NTOHL (0x412f506f), 
  ACE_NTOHL (0x6c696379), 
  ACE_NTOHL (0x4572726f), 
  ACE_NTOHL (0x723a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CORBA/PolicyError:1.0
  12,
  ACE_NTOHL (0x506f6c69), 
  ACE_NTOHL (0x63794572), 
  ACE_NTOHL (0x726f7200),  // name = PolicyError
  1, // member count
  7,
  ACE_NTOHL (0x72656173), 
  ACE_NTOHL (0x6f6e0000),  // name = reason
  CORBA::tk_alias, // typecode kind for typedefs
  72, // encapsulation length
    TAO_ENCAP_BYTE_ORDER, // byte order
    38,
    ACE_NTOHL (0x49444c3a), 
    ACE_NTOHL (0x6f6d672e), 
    ACE_NTOHL (0x6f72672f), 
    ACE_NTOHL (0x434f5242), 
    ACE_NTOHL (0x412f506f), 
    ACE_NTOHL (0x6c696379), 
    ACE_NTOHL (0x4572726f), 
    ACE_NTOHL (0x72436f64), 
    ACE_NTOHL (0x653a312e), 
    ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CORBA/PolicyErrorCode:1.0
    16,
    ACE_NTOHL (0x506f6c69), 
    ACE_NTOHL (0x63794572), 
    ACE_NTOHL (0x726f7243), 
    ACE_NTOHL (0x6f646500),  // name = PolicyErrorCode
    CORBA::tk_short,


};

static CORBA::TypeCode _tc_TAO_tc_CORBA_PolicyError (
    CORBA::tk_except,
    sizeof (_oc_CORBA_PolicyError),
    (char *) &_oc_CORBA_PolicyError,
    0,
    sizeof (CORBA::PolicyError)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_PolicyError, &_tc_TAO_tc_CORBA_PolicyError)
TAO_NAMESPACE_END


// TAO extension - the virtual _type method.
CORBA::TypeCode_ptr CORBA::PolicyError::_type (void) const
{
  return ::CORBA::_tc_PolicyError;
}


#if !defined (TAO_USE_SEQUENCE_TEMPLATES)

#if !defined (__TAO_UNBOUNDED_SEQUENCE_CORBA_INVALIDPOLICIES__TAO_SEQ_USHORT_CS_)
#define __TAO_UNBOUNDED_SEQUENCE_CORBA_INVALIDPOLICIES__TAO_SEQ_USHORT_CS_

void
CORBA::InvalidPolicies::_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::_allocate_buffer (CORBA::ULong length)
{
  CORBA::UShort* tmp = 0;
  tmp = _TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::allocbuf (length);
  
  if (this->buffer_ != 0)
  {
    CORBA::UShort *old = ACE_reinterpret_cast (CORBA::UShort *,this->buffer_);
    
    for (CORBA::ULong i = 0; i < this->length_; ++i)
      tmp[i] = old[i];
    
    if (this->release_)
      _TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::freebuf (old);
    
  }
  this->buffer_ = tmp;
}

void
CORBA::InvalidPolicies::_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::_deallocate_buffer (void)
{
  if (this->buffer_ == 0 || this->release_ == 0)
    return;
  
  CORBA::UShort *tmp = ACE_reinterpret_cast (CORBA::UShort *,this->buffer_);
  
  _TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::freebuf (tmp);
  this->buffer_ = 0;
} 

CORBA::InvalidPolicies::_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort::~_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort (void) // Dtor.
{
  this->_deallocate_buffer ();
}


#endif /* end #if !defined */


#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ 

#if !defined (_CORBA_INVALIDPOLICIES__TAO_SEQ_USHORT_CS_)
#define _CORBA_INVALIDPOLICIES__TAO_SEQ_USHORT_CS_

// *************************************************************
// CORBA::InvalidPolicies::_tao_seq_UShort
// *************************************************************

CORBA::InvalidPolicies::_tao_seq_UShort::_tao_seq_UShort (void)
{}
CORBA::InvalidPolicies::_tao_seq_UShort::_tao_seq_UShort (CORBA::ULong max) // uses max size
  : 
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Sequence<CORBA::UShort>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ 
 (max)
{}
CORBA::InvalidPolicies::_tao_seq_UShort::_tao_seq_UShort (CORBA::ULong max, CORBA::ULong length, CORBA::UShort *buffer, CORBA::Boolean release)
  : 
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Sequence<CORBA::UShort>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ 
 (max, length, buffer, release)
{}
CORBA::InvalidPolicies::_tao_seq_UShort::_tao_seq_UShort (const _tao_seq_UShort &seq) // copy ctor
  : 
#if !defined (TAO_USE_SEQUENCE_TEMPLATES)
_TAO_Unbounded_Sequence_CORBA_InvalidPolicies__tao_seq_UShort
#else /* TAO_USE_SEQUENCE_TEMPLATES */
TAO_Unbounded_Sequence<CORBA::UShort>
#endif /* !TAO_USE_SEQUENCE_TEMPLATES */ 
 (seq)
{}
CORBA::InvalidPolicies::_tao_seq_UShort::~_tao_seq_UShort (void) // dtor
{}
void CORBA::InvalidPolicies::_tao_seq_UShort::_tao_any_destructor (void *_tao_void_pointer)
{
  _tao_seq_UShort *tmp = ACE_static_cast (_tao_seq_UShort*, _tao_void_pointer);
  delete tmp;
}


#endif /* end #if !defined */

// Default constructor.
CORBA::InvalidPolicies::InvalidPolicies (void)
  : CORBA_UserException ("IDL:omg.org/CORBA/InvalidPolicies:1.0")
{
}

// Destructor - all members are of self managing types.
CORBA::InvalidPolicies::~InvalidPolicies (void)
{
}

// Copy constructor.
CORBA::InvalidPolicies::InvalidPolicies (const ::CORBA::InvalidPolicies &_tao_excp)
  : CORBA_UserException (_tao_excp._id ())
{
  this->indices = _tao_excp.indices;
}

// Assignment operator.
CORBA::InvalidPolicies&
CORBA::InvalidPolicies::operator= (const ::CORBA::InvalidPolicies &_tao_excp)
{
  this->CORBA_UserException::operator= (_tao_excp);
  this->indices = _tao_excp.indices;
  return *this;
}

void CORBA::InvalidPolicies::_tao_any_destructor (void *_tao_void_pointer)
{
  InvalidPolicies *tmp = ACE_static_cast (InvalidPolicies*, _tao_void_pointer);
  delete tmp;
}

CORBA::InvalidPolicies *
CORBA::InvalidPolicies::_downcast (CORBA::Exception *exc)
{
  if (!ACE_OS::strcmp ("IDL:omg.org/CORBA/InvalidPolicies:1.0", exc->_id ()))
    {
      return ACE_dynamic_cast (InvalidPolicies *, exc);
    }
  else
    {
      return 0;
    }
}

CORBA::Exception *CORBA::InvalidPolicies::_alloc (void)
{
  CORBA::Exception *retval = 0;
  ACE_NEW_RETURN (retval, ::CORBA::InvalidPolicies, 0);
  return retval;
}

CORBA::Exception *
CORBA::InvalidPolicies::_tao_duplicate (void) const
{
  CORBA::Exception *result;
  ACE_NEW_RETURN (
      result,
      CORBA::InvalidPolicies (*this),
      0
    );
  return result;
}

void CORBA::InvalidPolicies::_raise ()
{
  TAO_RAISE (*this);
}

void CORBA::InvalidPolicies::_tao_encode (
    TAO_OutputCDR &cdr
    ACE_ENV_ARG_DECL
  ) const
{
  if (cdr << *this)
    {
      return;
    }
  
  ACE_THROW (CORBA::MARSHAL ());
}

void CORBA::InvalidPolicies::_tao_decode (
    TAO_InputCDR &cdr
    ACE_ENV_ARG_DECL
  )
{
  if (cdr >> *this)
    {
      return;
    }
  
  ACE_THROW (CORBA::MARSHAL ());
}

CORBA::InvalidPolicies::InvalidPolicies (
    const CORBA::InvalidPolicies::_tao_seq_UShort & _tao_indices
  )
  : CORBA_UserException ("IDL:omg.org/CORBA/InvalidPolicies:1.0")
{
  this->indices = _tao_indices;
}

static const CORBA::Long _oc_CORBA_InvalidPolicies[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  38,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x434f5242), 
  ACE_NTOHL (0x412f496e), 
  ACE_NTOHL (0x76616c69), 
  ACE_NTOHL (0x64506f6c), 
  ACE_NTOHL (0x69636965), 
  ACE_NTOHL (0x733a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CORBA/InvalidPolicies:1.0
  16,
  ACE_NTOHL (0x496e7661), 
  ACE_NTOHL (0x6c696450), 
  ACE_NTOHL (0x6f6c6963), 
  ACE_NTOHL (0x69657300),  // name = InvalidPolicies
  1, // member count
  8,
  ACE_NTOHL (0x696e6469), 
  ACE_NTOHL (0x63657300),  // name = indices
  CORBA::tk_sequence, // typecode kind
  12, // encapsulation length
    TAO_ENCAP_BYTE_ORDER, // byte order
    CORBA::tk_ushort,

    0U,

};

static CORBA::TypeCode _tc_TAO_tc_CORBA_InvalidPolicies (
    CORBA::tk_except,
    sizeof (_oc_CORBA_InvalidPolicies),
    (char *) &_oc_CORBA_InvalidPolicies,
    0,
    sizeof (CORBA::InvalidPolicies)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_InvalidPolicies, &_tc_TAO_tc_CORBA_InvalidPolicies)
TAO_NAMESPACE_END


// TAO extension - the virtual _type method.
CORBA::TypeCode_ptr CORBA::InvalidPolicies::_type (void) const
{
  return ::CORBA::_tc_InvalidPolicies;
}

int CORBA::Policy::_tao_class_id = 0;

CORBA::Policy_ptr
tao_CORBA_Policy_duplicate (
    CORBA::Policy_ptr p
  )
{
  return CORBA::Policy::_duplicate (p);
}

void
tao_CORBA_Policy_release (
    CORBA::Policy_ptr p
  )
{
  CORBA::release (p);
}

CORBA::Policy_ptr
tao_CORBA_Policy_nil (
    void
  )
{
  return CORBA::Policy::_nil ();
}

CORBA::Policy_ptr
tao_CORBA_Policy_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return CORBA::Policy::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::Policy_var::Policy_var (void) // default constructor
  : ptr_ (Policy::_nil ())
{}

::CORBA::Policy_ptr
CORBA::Policy_var::ptr (void) const
{
  return this->ptr_;
}

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

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

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

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

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

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

::CORBA::Policy_ptr
CORBA::Policy_var::operator-> (void) const
{
  return this->ptr_;
}

::CORBA::Policy_ptr
CORBA::Policy_var::in (void) const
{
  return this->ptr_;
}

::CORBA::Policy_ptr &
CORBA::Policy_var::inout (void)
{
  return this->ptr_;
}

::CORBA::Policy_ptr &
CORBA::Policy_var::out (void)
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::Policy::_nil ();
  return this->ptr_;
}

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

::CORBA::Policy_ptr
CORBA::Policy_var::tao_duplicate (Policy_ptr p)
{
  return ::CORBA::Policy::_duplicate (p);
}

void
CORBA::Policy_var::tao_release (Policy_ptr p)
{
  CORBA::release (p);
}

::CORBA::Policy_ptr
CORBA::Policy_var::tao_nil (void)
{
  return ::CORBA::Policy::_nil ();
}

::CORBA::Policy_ptr
CORBA::Policy_var::tao_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return ::CORBA::Policy::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::Policy_out::Policy_out (Policy_ptr &p)
  : ptr_ (p)
{
  this->ptr_ = ::CORBA::Policy::_nil ();
}

CORBA::Policy_out::Policy_out (Policy_var &p) // constructor from _var
  : ptr_ (p.out ())
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::Policy::_nil ();
}

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

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

CORBA::Policy_out &
CORBA::Policy_out::operator= (const ::CORBA::Policy_var &p)
{
  this->ptr_ = ::CORBA::Policy::_duplicate (p.ptr ());
  return *this;
}

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

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

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

::CORBA::Policy_ptr
CORBA::Policy_out::operator-> (void)
{
  return this->ptr_;
}


#if (TAO_HAS_INTERCEPTORS == 1)
class TAO_ClientRequestInfo_CORBA_Policy_policy_type_get : public TAO_ClientRequestInfo_i
{
public:
  TAO_ClientRequestInfo_CORBA_Policy_policy_type_get (
      TAO_GIOP_Invocation *_tao_invocation,
      CORBA::Object_ptr _tao_target 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::PolicyType result);

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

  CORBA::PolicyType _result;
};

TAO_ClientRequestInfo_CORBA_Policy_policy_type_get::TAO_ClientRequestInfo_CORBA_Policy_policy_type_get (
    TAO_GIOP_Invocation *_tao_invocation,
    CORBA::Object_ptr _tao_target ACE_ENV_ARG_DECL_NOT_USED    
  )
  : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target)
{}

Dynamic::ParameterList *
TAO_ClientRequestInfo_CORBA_Policy_policy_type_get::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);
  
  return parameter_list;

}

Dynamic::ExceptionList *
TAO_ClientRequestInfo_CORBA_Policy_policy_type_get::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_Policy_policy_type_get::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_Policy_policy_type_get::result (CORBA::PolicyType result)
{
  // update the result 
  this->_result = result;
}

class TAO_ClientRequestInfo_CORBA_Policy_copy : public TAO_ClientRequestInfo_i
{
public:
  TAO_ClientRequestInfo_CORBA_Policy_copy (
      TAO_GIOP_Invocation *_tao_invocation,
      CORBA::Object_ptr _tao_target 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_Policy_copy (const TAO_ClientRequestInfo_CORBA_Policy_copy &);
  void operator= (const TAO_ClientRequestInfo_CORBA_Policy_copy &);

  CORBA::Policy_ptr _result;
};

TAO_ClientRequestInfo_CORBA_Policy_copy::TAO_ClientRequestInfo_CORBA_Policy_copy (
    TAO_GIOP_Invocation *_tao_invocation,
    CORBA::Object_ptr _tao_target ACE_ENV_ARG_DECL_NOT_USED    
  )
  : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target)
{}

Dynamic::ParameterList *
TAO_ClientRequestInfo_CORBA_Policy_copy::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);
  
  return parameter_list;

}

Dynamic::ExceptionList *
TAO_ClientRequestInfo_CORBA_Policy_copy::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_Policy_copy::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_Policy_copy::result (::CORBA::Policy_ptr result)
{
  // update the result 
  this->_result = result;
}

class TAO_ClientRequestInfo_CORBA_Policy_destroy : public TAO_ClientRequestInfo_i
{
public:
  TAO_ClientRequestInfo_CORBA_Policy_destroy (
      TAO_GIOP_Invocation *_tao_invocation,
      CORBA::Object_ptr _tao_target 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_Policy_destroy (const TAO_ClientRequestInfo_CORBA_Policy_destroy &);
  void operator= (const TAO_ClientRequestInfo_CORBA_Policy_destroy &);

  
};

TAO_ClientRequestInfo_CORBA_Policy_destroy::TAO_ClientRequestInfo_CORBA_Policy_destroy (
    TAO_GIOP_Invocation *_tao_invocation,
    CORBA::Object_ptr _tao_target ACE_ENV_ARG_DECL_NOT_USED    
  )
  : TAO_ClientRequestInfo_i (_tao_invocation, _tao_target)
{}

Dynamic::ParameterList *
TAO_ClientRequestInfo_CORBA_Policy_destroy::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);
  
  return parameter_list;

}

Dynamic::ExceptionList *
TAO_ClientRequestInfo_CORBA_Policy_destroy::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_Policy_destroy::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_Policy_Proxy_Impl::_TAO_Policy_Proxy_Impl (void)
{}

CORBA::_TAO_Policy_Remote_Proxy_Impl::_TAO_Policy_Remote_Proxy_Impl (void)
{}

// Remote Implementation of the IDL interface methods

CORBA::PolicyType CORBA::_TAO_Policy_Remote_Proxy_Impl::policy_type (
    CORBA_Object *_collocated_tao_target_
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  
  CORBA::PolicyType _tao_retval = 0;
  
  
  TAO_Stub *istub = _collocated_tao_target_->_stubobj ();
  if (istub == 0)
    ACE_THROW_RETURN (CORBA::INTERNAL (),_tao_retval);

  
  TAO_GIOP_Twoway_Invocation _tao_call (
      istub,
      "_get_policy_type",
      16,
      0,
      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_Policy_policy_type_get _tao_ri (
        &_tao_call,
        _collocated_tao_target_ ACE_ENV_ARG_PARAMETER
      );
            ACE_CHECK_RETURN (_tao_retval);

#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);

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

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

          if (_invoke_status == TAO_INVOKE_EXCEPTION)
            {
              TAO_INTERCEPTOR_THROW_RETURN (
                CORBA::UNKNOWN (TAO_OMG_VMCID | 1, CORBA::COMPLETED_YES),
                _tao_retval
              );
              
            }
          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)
              ))
            {
              TAO_INTERCEPTOR_THROW_RETURN (
                CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_YES),
                _tao_retval
              );
              
            }
          
#if TAO_HAS_INTERCEPTORS == 1
          CORBA::PolicyType _tao_retval_info = _tao_retval;
          _tao_ri.result (_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);

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

    if (_tao_status == PortableInterceptor::LOCATION_FORWARD
        || _tao_status == PortableInterceptor::TRANSPORT_RETRY)
      continue;
    
#endif  /* TAO_HAS_INTERCEPTORS */
    
    break;
  }
return _tao_retval;
}

::CORBA::Policy_ptr CORBA::_TAO_Policy_Remote_Proxy_Impl::copy (
    CORBA_Object *_collocated_tao_target_
    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,
      "copy",
      4,
      0,
      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_Policy_copy _tao_ri (
        &_tao_call,
        _collocated_tao_target_ 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 ());

          _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 ();
}

void CORBA::_TAO_Policy_Remote_Proxy_Impl::destroy (
    CORBA_Object *_collocated_tao_target_
    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,
      "destroy",
      7,
      0,
      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_Policy_destroy _tao_ri (
        &_tao_call,
        _collocated_tao_target_ 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;

          _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_Policy_Proxy_Broker::_TAO_Policy_Proxy_Broker (void)
{
}

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

CORBA::_TAO_Policy_Proxy_Broker * (*CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer) (
    CORBA::Object_ptr obj
  ) = 0;

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

CORBA::_TAO_Policy_Remote_Proxy_Broker::_TAO_Policy_Remote_Proxy_Broker (void)
{
}

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

CORBA::_TAO_Policy_Proxy_Impl&
CORBA::_TAO_Policy_Remote_Proxy_Broker::select_proxy (
  ::CORBA::Policy *
  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::Policy::Policy (int collocated)
{
  this->CORBA_Policy_setup_collocation (collocated);
}

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

void
CORBA::Policy::CORBA_Policy_setup_collocation (int collocated)
{
  if (collocated)
    this->the_TAO_Policy_Proxy_Broker_ =
      ::CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer (this);
  else
    this->the_TAO_Policy_Proxy_Broker_ =
      ::CORBA::_TAO_Policy_Remote_Proxy_Broker::the_TAO_Policy_Remote_Proxy_Broker ();
}

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

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

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

      if (
          !CORBA::is_nil (stub->servant_orb_var ().ptr ()) &&
          stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () &&
          obj->_is_collocated () &&
          CORBA__TAO_Policy_Proxy_Broker_Factory_function_pointer != 0
        )
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::Policy (
                  stub,
                  1,
                  obj->_servant ()
                ),
              Policy::_nil ()
            );
        }
      
      if (CORBA::is_nil (default_proxy))
        {
          ACE_NEW_RETURN (
              default_proxy,
              ::CORBA::Policy (
                  stub,
                  0,
                  obj->_servant ()
                ),
              Policy::_nil ()
            );
        }
      
      return default_proxy;
    }
  else 
    return
      ACE_reinterpret_cast
        (
          Policy_ptr,
            obj->_tao_QueryInterface
              (
                ACE_reinterpret_cast
                  (
                    ptr_arith_t,
                    &Policy::_tao_class_id
                  )
              )
        );
}

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

CORBA::Boolean CORBA::Policy::_is_a (const CORBA::Char *value ACE_ENV_ARG_DECL)
{
  if (
    (!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::Policy::_tao_QueryInterface (ptr_arith_t type)
{
  void *retv = 0;
  if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, Policy)::_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::Policy::_interface_repository_id (void) const
{
  return "IDL:omg.org/CORBA/Policy:1.0";
}

// ****************************************************************
CORBA::Boolean
CORBA::Policy::_tao_encode (TAO_OutputCDR &)
{
  return 0;
}

CORBA::Boolean
CORBA::Policy::_tao_decode (TAO_InputCDR &)
{
  return 0;
}

TAO_Cached_Policy_Type
CORBA::Policy::_tao_cached_type (void) const
{
  return TAO_CACHED_POLICY_UNCACHED;
}

TAO_Policy_Scope
CORBA::Policy::_tao_scope (void) const
{
  return TAO_POLICY_DEFAULT_SCOPE;
}
// ****************************************************************

CORBA::PolicyType CORBA::Policy::policy_type (
    
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  _TAO_Policy_Proxy_Impl &proxy = 
    this->the_TAO_Policy_Proxy_Broker_->select_proxy (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);
  
  return proxy.policy_type (
      this ACE_ENV_ARG_PARAMETER
    );
}

::CORBA::Policy_ptr CORBA::Policy::copy (
    
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  _TAO_Policy_Proxy_Impl &proxy = 
    this->the_TAO_Policy_Proxy_Broker_->select_proxy (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (0);
  
  return proxy.copy (
      this ACE_ENV_ARG_PARAMETER
    );
}

void CORBA::Policy::destroy (
    
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  _TAO_Policy_Proxy_Impl &proxy = 
    this->the_TAO_Policy_Proxy_Broker_->select_proxy (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
  
  proxy.destroy (
      this ACE_ENV_ARG_PARAMETER
    );
}

static const CORBA::Long _oc_CORBA_Policy[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  29,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x434f5242), 
  ACE_NTOHL (0x412f506f), 
  ACE_NTOHL (0x6c696379), 
  ACE_NTOHL (0x3a312e30), 
  ACE_NTOHL (0x0),  // repository ID = IDL:omg.org/CORBA/Policy:1.0
  7,
  ACE_NTOHL (0x506f6c69), 
  ACE_NTOHL (0x63790000),  // name = Policy
};

static CORBA::TypeCode _tc_TAO_tc_CORBA_Policy (
    CORBA::tk_objref,
    sizeof (_oc_CORBA_Policy),
    (char *) &_oc_CORBA_Policy,
    0,
    sizeof (CORBA::Policy)
  );

TAO_NAMESPACE_TYPE (CORBA::TypeCode_ptr)
TAO_NAMESPACE_BEGIN (CORBA)
TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_Policy, &_tc_TAO_tc_CORBA_Policy)
TAO_NAMESPACE_END

int CORBA::PolicyManager::_tao_class_id = 0;

CORBA::PolicyManager_ptr
tao_CORBA_PolicyManager_duplicate (
    CORBA::PolicyManager_ptr p
  )
{
  return CORBA::PolicyManager::_duplicate (p);
}

void
tao_CORBA_PolicyManager_release (
    CORBA::PolicyManager_ptr p
  )
{
  CORBA::release (p);
}

CORBA::PolicyManager_ptr
tao_CORBA_PolicyManager_nil (
    void
  )
{
  return CORBA::PolicyManager::_nil ();
}

CORBA::PolicyManager_ptr
tao_CORBA_PolicyManager_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return CORBA::PolicyManager::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::PolicyManager_var::PolicyManager_var (void) // default constructor
  : ptr_ (PolicyManager::_nil ())
{}

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::ptr (void) const
{
  return this->ptr_;
}

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

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

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

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

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

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

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::operator-> (void) const
{
  return this->ptr_;
}

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::in (void) const
{
  return this->ptr_;
}

::CORBA::PolicyManager_ptr &
CORBA::PolicyManager_var::inout (void)
{
  return this->ptr_;
}

::CORBA::PolicyManager_ptr &
CORBA::PolicyManager_var::out (void)
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::PolicyManager::_nil ();
  return this->ptr_;
}

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

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::tao_duplicate (PolicyManager_ptr p)
{
  return ::CORBA::PolicyManager::_duplicate (p);
}

void
CORBA::PolicyManager_var::tao_release (PolicyManager_ptr p)
{
  CORBA::release (p);
}

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::tao_nil (void)
{
  return ::CORBA::PolicyManager::_nil ();
}

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_var::tao_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return ::CORBA::PolicyManager::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::PolicyManager_out::PolicyManager_out (PolicyManager_ptr &p)
  : ptr_ (p)
{
  this->ptr_ = ::CORBA::PolicyManager::_nil ();
}

CORBA::PolicyManager_out::PolicyManager_out (PolicyManager_var &p) // constructor from _var
  : ptr_ (p.out ())
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::PolicyManager::_nil ();
}

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

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

CORBA::PolicyManager_out &
CORBA::PolicyManager_out::operator= (const ::CORBA::PolicyManager_var &p)
{
  this->ptr_ = ::CORBA::PolicyManager::_duplicate (p.ptr ());
  return *this;
}

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

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

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

::CORBA::PolicyManager_ptr
CORBA::PolicyManager_out::operator-> (void)
{
  return this->ptr_;
}


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

CORBA::PolicyManager::PolicyManager (void)
{}

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

CORBA::PolicyManager_ptr CORBA::PolicyManager::_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL
  )
{
  return PolicyManager::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);
}

CORBA::PolicyManager_ptr 
CORBA::PolicyManager::_unchecked_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL_NOT_USED
  )
{
  if (CORBA::is_nil (obj))
    return PolicyManager::_nil ();
  return
      ACE_reinterpret_cast
        (
          PolicyManager_ptr,
            obj->_tao_QueryInterface
              (
                ACE_reinterpret_cast
                  (
                    ptr_arith_t,
                    &PolicyManager::_tao_class_id
                  )
              )
        );
}

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

void *CORBA::PolicyManager::_tao_QueryInterface (ptr_arith_t type)
{
  void *retv = 0;
  if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, PolicyManager)::_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::PolicyManager::_interface_repository_id (void) const
{
  return "IDL:omg.org/CORBA/PolicyManager:1.0";
}

int CORBA::PolicyCurrent::_tao_class_id = 0;

CORBA::PolicyCurrent_ptr
tao_CORBA_PolicyCurrent_duplicate (
    CORBA::PolicyCurrent_ptr p
  )
{
  return CORBA::PolicyCurrent::_duplicate (p);
}

void
tao_CORBA_PolicyCurrent_release (
    CORBA::PolicyCurrent_ptr p
  )
{
  CORBA::release (p);
}

CORBA::PolicyCurrent_ptr
tao_CORBA_PolicyCurrent_nil (
    void
  )
{
  return CORBA::PolicyCurrent::_nil ();
}

CORBA::PolicyCurrent_ptr
tao_CORBA_PolicyCurrent_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return CORBA::PolicyCurrent::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::PolicyCurrent_var::PolicyCurrent_var (void) // default constructor
  : ptr_ (PolicyCurrent::_nil ())
{}

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::ptr (void) const
{
  return this->ptr_;
}

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

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

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

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

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

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

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::operator-> (void) const
{
  return this->ptr_;
}

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::in (void) const
{
  return this->ptr_;
}

::CORBA::PolicyCurrent_ptr &
CORBA::PolicyCurrent_var::inout (void)
{
  return this->ptr_;
}

::CORBA::PolicyCurrent_ptr &
CORBA::PolicyCurrent_var::out (void)
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::PolicyCurrent::_nil ();
  return this->ptr_;
}

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

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::tao_duplicate (PolicyCurrent_ptr p)
{
  return ::CORBA::PolicyCurrent::_duplicate (p);
}

void
CORBA::PolicyCurrent_var::tao_release (PolicyCurrent_ptr p)
{
  CORBA::release (p);
}

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::tao_nil (void)
{
  return ::CORBA::PolicyCurrent::_nil ();
}

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_var::tao_narrow (
    CORBA::Object *p
    ACE_ENV_ARG_DECL
  )
{
  return ::CORBA::PolicyCurrent::_narrow (p ACE_ENV_ARG_PARAMETER);
}

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

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

CORBA::PolicyCurrent_out::PolicyCurrent_out (PolicyCurrent_ptr &p)
  : ptr_ (p)
{
  this->ptr_ = ::CORBA::PolicyCurrent::_nil ();
}

CORBA::PolicyCurrent_out::PolicyCurrent_out (PolicyCurrent_var &p) // constructor from _var
  : ptr_ (p.out ())
{
  CORBA::release (this->ptr_);
  this->ptr_ = ::CORBA::PolicyCurrent::_nil ();
}

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

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

CORBA::PolicyCurrent_out &
CORBA::PolicyCurrent_out::operator= (const ::CORBA::PolicyCurrent_var &p)
{
  this->ptr_ = ::CORBA::PolicyCurrent::_duplicate (p.ptr ());
  return *this;
}

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

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

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

::CORBA::PolicyCurrent_ptr
CORBA::PolicyCurrent_out::operator-> (void)
{
  return this->ptr_;
}


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

CORBA::PolicyCurrent::PolicyCurrent (void)
{}

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

CORBA::PolicyCurrent_ptr CORBA::PolicyCurrent::_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL
  )
{
  return PolicyCurrent::_unchecked_narrow (obj ACE_ENV_ARG_PARAMETER);
}

CORBA::PolicyCurrent_ptr 
CORBA::PolicyCurrent::_unchecked_narrow (
    CORBA::Object_ptr obj
    ACE_ENV_ARG_DECL_NOT_USED
  )
{
  if (CORBA::is_nil (obj))
    return PolicyCurrent::_nil ();
  return
      ACE_reinterpret_cast
        (
          PolicyCurrent_ptr,
            obj->_tao_QueryInterface
              (
                ACE_reinterpret_cast
                  (
                    ptr_arith_t,
                    &PolicyCurrent::_tao_class_id
                  )
              )
        );
}

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

void *CORBA::PolicyCurrent::_tao_QueryInterface (ptr_arith_t type)
{
  void *retv = 0;
  if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, PolicyCurrent)::_tao_class_id))
    retv = ACE_reinterpret_cast (void*, this);
  else if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &ACE_NESTED_CLASS (::CORBA, PolicyManager)::_tao_class_id))
    retv = ACE_reinterpret_cast
      (
        void *,
        ACE_static_cast
          (
            CORBA::PolicyManager_ptr,
            this
          )
      );
  else if (type == ACE_reinterpret_cast
    (ptr_arith_t,
      &::CORBA::Current::_tao_class_id))
    retv = ACE_reinterpret_cast
      (
        void *,
        ACE_static_cast
          (
            CORBA::Current_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::PolicyCurrent::_interface_repository_id (void) const
{
  return "IDL:omg.org/CORBA/PolicyCurrent:1.0";
}

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

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

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

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::PolicyError *&_tao_elem)
{
  _tao_elem = 0;
  ACE_TRY_NEW_ENV
  {
    CORBA::TypeCode_var type = _tao_any.type ();
    
    CORBA::Boolean result = type->equivalent (CORBA::_tc_PolicyError ACE_ENV_ARG_PARAMETER);
    ACE_TRY_CHECK;
    
    if (!result)
      return 0; // not equivalent
    
    if (_tao_any.any_owns_data ())
    {
      _tao_elem = (CORBA::PolicyError *)_tao_any.value ();
      return 1;
    }
    else
    {
      CORBA::PolicyError *tmp;
      ACE_NEW_RETURN (tmp, CORBA::PolicyError, 0);
      TAO_InputCDR stream (
          _tao_any._tao_get_cdr (),
          _tao_any._tao_byte_order ()
        );
      CORBA::String_var interface_repository_id;
      if (!(stream >> interface_repository_id.out ()))
        return 0;
      if (ACE_OS::strcmp (
          interface_repository_id.in (),
          "IDL:omg.org/CORBA/PolicyError:1.0"))
        return 0;
      if (stream >> *tmp)
      {
        ((CORBA::Any *)&_tao_any)->_tao_replace (
            CORBA::_tc_PolicyError,
            1,
            tmp,
            CORBA::PolicyError::_tao_any_destructor
          );
        _tao_elem = tmp;
        return 1;
      }
      else
      {
        delete tmp;
      }
    }
  }
  ACE_CATCHANY
  {
  }
  ACE_ENDTRY;
  return 0;
}

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

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

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

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::InvalidPolicies *&_tao_elem)
{
  _tao_elem = 0;
  ACE_TRY_NEW_ENV
  {
    CORBA::TypeCode_var type = _tao_any.type ();
    
    CORBA::Boolean result = type->equivalent (CORBA::_tc_InvalidPolicies ACE_ENV_ARG_PARAMETER);
    ACE_TRY_CHECK;
    
    if (!result)
      return 0; // not equivalent
    
    if (_tao_any.any_owns_data ())
    {
      _tao_elem = (CORBA::InvalidPolicies *)_tao_any.value ();
      return 1;
    }
    else
    {
      CORBA::InvalidPolicies *tmp;
      ACE_NEW_RETURN (tmp, CORBA::InvalidPolicies, 0);
      TAO_InputCDR stream (
          _tao_any._tao_get_cdr (),
          _tao_any._tao_byte_order ()
        );
      CORBA::String_var interface_repository_id;
      if (!(stream >> interface_repository_id.out ()))
        return 0;
      if (ACE_OS::strcmp (
          interface_repository_id.in (),
          "IDL:omg.org/CORBA/InvalidPolicies:1.0"))
        return 0;
      if (stream >> *tmp)
      {
        ((CORBA::Any *)&_tao_any)->_tao_replace (
            CORBA::_tc_InvalidPolicies,
            1,
            tmp,
            CORBA::InvalidPolicies::_tao_any_destructor
          );
        _tao_elem = tmp;
        return 1;
      }
      else
      {
        delete tmp;
      }
    }
  }
  ACE_CATCHANY
  {
  }
  ACE_ENDTRY;
  return 0;
}

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

CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Policy_ptr &_tao_elem)
{
  ACE_TRY_NEW_ENV
  {
    _tao_elem = CORBA::Policy::_nil ();
    CORBA::TypeCode_var type = _tao_any.type ();
    
    CORBA::Boolean result = type->equivalent (CORBA::_tc_Policy 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_Policy,
          1,
          _tao_elem,
          CORBA::Policy::_tao_any_destructor
        );
      return 1;
    }
  }
  ACE_CATCHANY
  {
    _tao_elem = CORBA::Policy::_nil ();
    return 0;
  }
  ACE_ENDTRY;
  _tao_elem = CORBA::Policy::_nil ();
  return 0;
}

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

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

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


#if !defined _TAO_CDR_OP_CORBA_InvalidPolicies__tao_seq_UShort_CPP_
#define _TAO_CDR_OP_CORBA_InvalidPolicies__tao_seq_UShort_CPP_

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const CORBA::InvalidPolicies::_tao_seq_UShort &_tao_sequence
  )
{
  if (strm << _tao_sequence.length ())
  {
    // encode all elements
    return strm.write_ushort_array (_tao_sequence.get_buffer (), _tao_sequence.length ());
  }
  return 0; // error
}

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CORBA::InvalidPolicies::_tao_seq_UShort &_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
    return strm.read_ushort_array (_tao_sequence.get_buffer (), _tao_sequence.length ());
  }
  return 0; // error
}

#endif /* _TAO_CDR_OP_CORBA_InvalidPolicies__tao_seq_UShort_CPP_ */

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

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CORBA::Policy_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::Policy::_unchecked_narrow (
          obj.in ()
          ACE_ENV_ARG_PARAMETER
        );
    ACE_TRY_CHECK;
    return 1;
  }
  ACE_CATCHANY
  {
    // do nothing
  }
  ACE_ENDTRY;
  return 0;
}

