// -*- C++ -*-
//
// $Id$

// ****  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/
// and
//       Institute for Software Integrated Systems
//       Vanderbilt University
//       Nashville, TN
//       USA
//       http://www.isis.vanderbilt.edu/
//
// Information about TAO is available at:
//     http://www.cs.wustl.edu/~schmidt/TAO.html

// TAO_IDL - Generated from
// be/be_codegen.cpp:303


#include "CosConcurrencyControlC.h"
#include "tao/CDR.h"
#include "tao/Exception_Data.h"
#include "tao/Invocation_Adapter.h"
#include "tao/Object_T.h"
#include "tao/Typecode.h"
#include "tao/Any_Impl_T.h"
#include "tao/Any_Dual_Impl_T.h"
#include "tao/Any_Basic_Impl_T.h"
#include "tao/Basic_Arguments.h"
#include "tao/Object_Argument_T.h"
#include "tao/Special_Basic_Arguments.h"
#include "ace/OS_NS_string.h"

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

#if !defined (__ACE_INLINE__)
#include "CosConcurrencyControlC.inl"
#endif /* !defined __ACE_INLINE__ */

// TAO_IDL - Generated from
// be/be_visitor_arg_traits.cpp:64

// Arg traits specializations.
namespace TAO
{
  
  // TAO_IDL - Generated from
  // be/be_visitor_arg_traits.cpp:537

#if !defined (_COSCONCURRENCYCONTROL_LOCK_MODE__ARG_TRAITS_CS_)
#define _COSCONCURRENCYCONTROL_LOCK_MODE__ARG_TRAITS_CS_
  
  ACE_TEMPLATE_SPECIALIZATION
  class TAO_Concurrency_Export Arg_Traits<CosConcurrencyControl::lock_mode>
    : public
        Basic_Arg_Traits_T<
            CosConcurrencyControl::lock_mode
          >
  {
  };

#endif /* end #if !defined */

#if !defined (_COSCONCURRENCYCONTROL_LOCKSET__ARG_TRAITS_CS_)
#define _COSCONCURRENCYCONTROL_LOCKSET__ARG_TRAITS_CS_
  
  ACE_TEMPLATE_SPECIALIZATION
  class TAO_Concurrency_Export Arg_Traits<CosConcurrencyControl::LockSet>
    : public
        Object_Arg_Traits_T<
            CosConcurrencyControl::LockSet_ptr,
            CosConcurrencyControl::LockSet_var,
            CosConcurrencyControl::LockSet_out,
            TAO::Objref_Traits<CosConcurrencyControl::LockSet>
          >
  {
  };

#endif /* end #if !defined */
}


// TAO_IDL - Generated from
// be/be_visitor_typecode/typecode_defn.cpp:290

static const CORBA::Long _oc_CosConcurrencyControl_lock_mode[] =
{
  TAO_ENCAP_BYTE_ORDER, // byte order
  48,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x436f7343), 
  ACE_NTOHL (0x6f6e6375), 
  ACE_NTOHL (0x7272656e), 
  ACE_NTOHL (0x6379436f), 
  ACE_NTOHL (0x6e74726f), 
  ACE_NTOHL (0x6c2f6c6f), 
  ACE_NTOHL (0x636b5f6d), 
  ACE_NTOHL (0x6f64653a), 
  ACE_NTOHL (0x312e3000),  // repository ID = IDL:omg.org/CosConcurrencyControl/lock_mode:1.0
  10,
  ACE_NTOHL (0x6c6f636b), 
  ACE_NTOHL (0x5f6d6f64), 
  ACE_NTOHL (0x65000000),  // name = lock_mode
  5, // member count
  5,
  ACE_NTOHL (0x72656164), 
  ACE_NTOHL (0x0),  // name = read
  6,
  ACE_NTOHL (0x77726974), 
  ACE_NTOHL (0x65000000),  // name = write
  8,
  ACE_NTOHL (0x75706772), 
  ACE_NTOHL (0x61646500),  // name = upgrade
  15,
  ACE_NTOHL (0x696e7465), 
  ACE_NTOHL (0x6e74696f), 
  ACE_NTOHL (0x6e5f7265), 
  ACE_NTOHL (0x61640000),  // name = intention_read
  16,
  ACE_NTOHL (0x696e7465), 
  ACE_NTOHL (0x6e74696f), 
  ACE_NTOHL (0x6e5f7772), 
  ACE_NTOHL (0x69746500),  // name = intention_write
  };

static CORBA::TypeCode _tc_TAO_tc_CosConcurrencyControl_lock_mode (
    CORBA::tk_enum,
    sizeof (_oc_CosConcurrencyControl_lock_mode),
    (char *) &_oc_CosConcurrencyControl_lock_mode,
    0,
    sizeof (CosConcurrencyControl::lock_mode)
  );

namespace CosConcurrencyControl
{
  ::CORBA::TypeCode_ptr _tc_lock_mode =
    &_tc_TAO_tc_CosConcurrencyControl_lock_mode;
}

// TAO_IDL - Generated from 
// be/be_visitor_exception/exception_cs.cpp:63

CosConcurrencyControl::LockNotHeld::LockNotHeld (void)
  : CORBA::UserException (
        "IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0",
        "LockNotHeld"
      )
{
}

CosConcurrencyControl::LockNotHeld::~LockNotHeld (void)
{
}

CosConcurrencyControl::LockNotHeld::LockNotHeld (const ::CosConcurrencyControl::LockNotHeld &_tao_excp)
  : CORBA::UserException (
        _tao_excp._rep_id (),
        _tao_excp._name ()
      )
{
}

CosConcurrencyControl::LockNotHeld&
CosConcurrencyControl::LockNotHeld::operator= (const ::CosConcurrencyControl::LockNotHeld &_tao_excp)
{
  this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp);
  return *this;
}

void CosConcurrencyControl::LockNotHeld::_tao_any_destructor (void *_tao_void_pointer)
{
  LockNotHeld *_tao_tmp_pointer =
    static_cast<LockNotHeld*> (_tao_void_pointer);
  delete _tao_tmp_pointer;
}

CosConcurrencyControl::LockNotHeld *
CosConcurrencyControl::LockNotHeld::_downcast (CORBA::Exception *_tao_excp)
{
  if (!ACE_OS::strcmp ("IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0", _tao_excp->_rep_id ()))
    {
      return dynamic_cast<LockNotHeld *> (_tao_excp);
    }
  else
    {
      return 0;
    }
}

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

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

void CosConcurrencyControl::LockNotHeld::_raise (void) const
{
  TAO_RAISE (*this);
}

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

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

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

// TAO_IDL - Generated from
// be/be_visitor_typecode/typecode_defn.cpp:290

static const CORBA::Long _oc_CosConcurrencyControl_LockNotHeld[] =
{
    TAO_ENCAP_BYTE_ORDER, // byte order
  50,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x436f7343), 
  ACE_NTOHL (0x6f6e6375), 
  ACE_NTOHL (0x7272656e), 
  ACE_NTOHL (0x6379436f), 
  ACE_NTOHL (0x6e74726f), 
  ACE_NTOHL (0x6c2f4c6f), 
  ACE_NTOHL (0x636b4e6f), 
  ACE_NTOHL (0x7448656c), 
  ACE_NTOHL (0x643a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0
    12,
  ACE_NTOHL (0x4c6f636b), 
  ACE_NTOHL (0x4e6f7448), 
  ACE_NTOHL (0x656c6400),  // name = LockNotHeld
  0, // member count
  };

static CORBA::TypeCode _tc_TAO_tc_CosConcurrencyControl_LockNotHeld (
    CORBA::tk_except,
    sizeof (_oc_CosConcurrencyControl_LockNotHeld),
    (char *) &_oc_CosConcurrencyControl_LockNotHeld,
    0,
    sizeof (CosConcurrencyControl::LockNotHeld)
  );

namespace CosConcurrencyControl
{
  ::CORBA::TypeCode_ptr _tc_LockNotHeld =
    &_tc_TAO_tc_CosConcurrencyControl_LockNotHeld;
}

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

// Traits specializations for CosConcurrencyControl::LockSet.

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CosConcurrencyControl::LockSet_ptr
TAO::Objref_Traits<CosConcurrencyControl::LockSet>::tao_duplicate (
    CosConcurrencyControl::LockSet_ptr p
  )
{
  return CosConcurrencyControl::LockSet::_duplicate (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
void
TAO::Objref_Traits<CosConcurrencyControl::LockSet>::tao_release (
    CosConcurrencyControl::LockSet_ptr p
  )
{
  CORBA::release (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CosConcurrencyControl::LockSet_ptr
TAO::Objref_Traits<CosConcurrencyControl::LockSet>::tao_nil (void)
{
  return CosConcurrencyControl::LockSet::_nil ();
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CORBA::Boolean
TAO::Objref_Traits<CosConcurrencyControl::LockSet>::tao_marshal (
    CosConcurrencyControl::LockSet_ptr p,
    TAO_OutputCDR & cdr
  )
{
  return CORBA::Object::marshal (p, cdr);
}

// Function pointer for collocation factory initialization.
TAO::Collocation_Proxy_Broker * 
(*CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer) (
    CORBA::Object_ptr obj
  ) = 0;

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

void CosConcurrencyControl::LockSet::lock (
    ::CosConcurrencyControl::lock_mode mode
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSet_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSet_setup_collocation ();
    }
  
  TAO::Arg_Traits< void>::ret_val _tao_retval;
  TAO::Arg_Traits< ::CosConcurrencyControl::lock_mode>::in_arg_val _tao_mode (mode);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_mode
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      2,
      "lock",
      4,
      this->the_TAO_LockSet_Proxy_Broker_
    );
  
  _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

CORBA::Boolean CosConcurrencyControl::LockSet::try_lock (
    ::CosConcurrencyControl::lock_mode mode
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSet_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSet_setup_collocation ();
    }
  
  TAO::Arg_Traits< ACE_InputCDR::to_boolean>::ret_val _tao_retval;
  TAO::Arg_Traits< ::CosConcurrencyControl::lock_mode>::in_arg_val _tao_mode (mode);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_mode
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      2,
      "try_lock",
      8,
      this->the_TAO_LockSet_Proxy_Broker_
    );
  
  _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (_tao_retval.excp ());
  
  return _tao_retval.retn ();
}

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

void CosConcurrencyControl::LockSet::unlock (
    ::CosConcurrencyControl::lock_mode mode
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    ::CosConcurrencyControl::LockNotHeld
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSet_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSet_setup_collocation ();
    }
  
  TAO::Arg_Traits< void>::ret_val _tao_retval;
  TAO::Arg_Traits< ::CosConcurrencyControl::lock_mode>::in_arg_val _tao_mode (mode);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_mode
    };
  
  static TAO::Exception_Data
  _tao_CosConcurrencyControl_LockSet_unlock_exceptiondata [] = 
    {
      {
        "IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0",
        CosConcurrencyControl::LockNotHeld::_alloc,
        CosConcurrencyControl::_tc_LockNotHeld
      }
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      2,
      "unlock",
      6,
      this->the_TAO_LockSet_Proxy_Broker_
    );
  
  _tao_call.invoke (
      _tao_CosConcurrencyControl_LockSet_unlock_exceptiondata,
      1
      ACE_ENV_ARG_PARAMETER
    );
  ACE_CHECK;
}

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

void CosConcurrencyControl::LockSet::change_mode (
    ::CosConcurrencyControl::lock_mode held_mode,
    ::CosConcurrencyControl::lock_mode new_mode
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException,
    ::CosConcurrencyControl::LockNotHeld
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSet_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSet_setup_collocation ();
    }
  
  TAO::Arg_Traits< void>::ret_val _tao_retval;
  TAO::Arg_Traits< ::CosConcurrencyControl::lock_mode>::in_arg_val _tao_held_mode (held_mode);
  TAO::Arg_Traits< ::CosConcurrencyControl::lock_mode>::in_arg_val _tao_new_mode (new_mode);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_held_mode,
      &_tao_new_mode
    };
  
  static TAO::Exception_Data
  _tao_CosConcurrencyControl_LockSet_change_mode_exceptiondata [] = 
    {
      {
        "IDL:omg.org/CosConcurrencyControl/LockNotHeld:1.0",
        CosConcurrencyControl::LockNotHeld::_alloc,
        CosConcurrencyControl::_tc_LockNotHeld
      }
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      3,
      "change_mode",
      11,
      this->the_TAO_LockSet_Proxy_Broker_
    );
  
  _tao_call.invoke (
      _tao_CosConcurrencyControl_LockSet_change_mode_exceptiondata,
      1
      ACE_ENV_ARG_PARAMETER
    );
  ACE_CHECK;
}

CosConcurrencyControl::LockSet::LockSet (void)
 : the_TAO_LockSet_Proxy_Broker_ (0)
{
  this->CosConcurrencyControl_LockSet_setup_collocation ();
}

void
CosConcurrencyControl::LockSet::CosConcurrencyControl_LockSet_setup_collocation ()
{
  if (::CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer)
    {
      this->the_TAO_LockSet_Proxy_Broker_ =
        ::CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer (this);
    }
}

CosConcurrencyControl::LockSet::~LockSet (void)
{}

void 
CosConcurrencyControl::LockSet::_tao_any_destructor (void *_tao_void_pointer)
{
  LockSet *_tao_tmp_pointer =
    static_cast<LockSet *> (_tao_void_pointer);
  CORBA::release (_tao_tmp_pointer);
}

CosConcurrencyControl::LockSet_ptr
CosConcurrencyControl::LockSet::_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<LockSet>::narrow (
        _tao_objref,
        "IDL:omg.org/CosConcurrencyControl/LockSet:1.0",
        CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

CosConcurrencyControl::LockSet_ptr
CosConcurrencyControl::LockSet::_unchecked_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<LockSet>::unchecked_narrow (
        _tao_objref,
        "IDL:omg.org/CosConcurrencyControl/LockSet:1.0",
        CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

CosConcurrencyControl::LockSet_ptr
CosConcurrencyControl::LockSet::_duplicate (LockSet_ptr obj)
{
  if (! CORBA::is_nil (obj))
    {
      obj->_add_ref ();
    }
  
  return obj;
}

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

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

CORBA::Boolean
CosConcurrencyControl::LockSet::marshal (TAO_OutputCDR &cdr)
{
  return (cdr << this);
}

// TAO_IDL - Generated from
// be/be_visitor_typecode/typecode_defn.cpp:290

static const CORBA::Long _oc_CosConcurrencyControl_LockSet[] =
{
    TAO_ENCAP_BYTE_ORDER, // byte order
  46,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x436f7343), 
  ACE_NTOHL (0x6f6e6375), 
  ACE_NTOHL (0x7272656e), 
  ACE_NTOHL (0x6379436f), 
  ACE_NTOHL (0x6e74726f), 
  ACE_NTOHL (0x6c2f4c6f), 
  ACE_NTOHL (0x636b5365), 
  ACE_NTOHL (0x743a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:omg.org/CosConcurrencyControl/LockSet:1.0
    8,
  ACE_NTOHL (0x4c6f636b), 
  ACE_NTOHL (0x53657400),  // name = LockSet
  };

static CORBA::TypeCode _tc_TAO_tc_CosConcurrencyControl_LockSet (
    CORBA::tk_objref,
    sizeof (_oc_CosConcurrencyControl_LockSet),
    (char *) &_oc_CosConcurrencyControl_LockSet,
    0,
    sizeof (CosConcurrencyControl::LockSet)
  );

namespace CosConcurrencyControl
{
  ::CORBA::TypeCode_ptr _tc_LockSet =
    &_tc_TAO_tc_CosConcurrencyControl_LockSet;
}

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

// Traits specializations for CosConcurrencyControl::LockSetFactory.

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CosConcurrencyControl::LockSetFactory_ptr
TAO::Objref_Traits<CosConcurrencyControl::LockSetFactory>::tao_duplicate (
    CosConcurrencyControl::LockSetFactory_ptr p
  )
{
  return CosConcurrencyControl::LockSetFactory::_duplicate (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
void
TAO::Objref_Traits<CosConcurrencyControl::LockSetFactory>::tao_release (
    CosConcurrencyControl::LockSetFactory_ptr p
  )
{
  CORBA::release (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CosConcurrencyControl::LockSetFactory_ptr
TAO::Objref_Traits<CosConcurrencyControl::LockSetFactory>::tao_nil (void)
{
  return CosConcurrencyControl::LockSetFactory::_nil ();
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CORBA::Boolean
TAO::Objref_Traits<CosConcurrencyControl::LockSetFactory>::tao_marshal (
    CosConcurrencyControl::LockSetFactory_ptr p,
    TAO_OutputCDR & cdr
  )
{
  return CORBA::Object::marshal (p, cdr);
}

// Function pointer for collocation factory initialization.
TAO::Collocation_Proxy_Broker * 
(*CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer) (
    CORBA::Object_ptr obj
  ) = 0;

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

::CosConcurrencyControl::LockSet_ptr CosConcurrencyControl::LockSetFactory::create (
    ACE_ENV_SINGLE_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSetFactory_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSetFactory_setup_collocation ();
    }
  
  TAO::Arg_Traits< ::CosConcurrencyControl::LockSet>::ret_val _tao_retval;
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      1,
      "create",
      6,
      this->the_TAO_LockSetFactory_Proxy_Broker_
    );
  
  _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (_tao_retval.excp ());
  
  return _tao_retval.retn ();
}

// TAO_IDL - Generated from
// be/be_visitor_operation/operation_cs.cpp:78

::CosConcurrencyControl::LockSet_ptr CosConcurrencyControl::LockSetFactory::create_related (
    ::CosConcurrencyControl::LockSet_ptr which
    ACE_ENV_ARG_DECL
  )
  ACE_THROW_SPEC ((
    CORBA::SystemException
  ))
{
  if (!this->is_evaluated ())
    {
      ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);
    }
  
  if (this->the_TAO_LockSetFactory_Proxy_Broker_ == 0)
    {
      CosConcurrencyControl_LockSetFactory_setup_collocation ();
    }
  
  TAO::Arg_Traits< ::CosConcurrencyControl::LockSet>::ret_val _tao_retval;
  TAO::Arg_Traits< ::CosConcurrencyControl::LockSet>::in_arg_val _tao_which (which);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_which
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      2,
      "create_related",
      14,
      this->the_TAO_LockSetFactory_Proxy_Broker_
    );
  
  _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK_RETURN (_tao_retval.excp ());
  
  return _tao_retval.retn ();
}

CosConcurrencyControl::LockSetFactory::LockSetFactory (void)
 : the_TAO_LockSetFactory_Proxy_Broker_ (0)
{
  this->CosConcurrencyControl_LockSetFactory_setup_collocation ();
}

void
CosConcurrencyControl::LockSetFactory::CosConcurrencyControl_LockSetFactory_setup_collocation ()
{
  if (::CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer)
    {
      this->the_TAO_LockSetFactory_Proxy_Broker_ =
        ::CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer (this);
    }
}

CosConcurrencyControl::LockSetFactory::~LockSetFactory (void)
{}

void 
CosConcurrencyControl::LockSetFactory::_tao_any_destructor (void *_tao_void_pointer)
{
  LockSetFactory *_tao_tmp_pointer =
    static_cast<LockSetFactory *> (_tao_void_pointer);
  CORBA::release (_tao_tmp_pointer);
}

CosConcurrencyControl::LockSetFactory_ptr
CosConcurrencyControl::LockSetFactory::_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<LockSetFactory>::narrow (
        _tao_objref,
        "IDL:omg.org/CosConcurrencyControl/LockSetFactory:1.0",
        CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

CosConcurrencyControl::LockSetFactory_ptr
CosConcurrencyControl::LockSetFactory::_unchecked_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<LockSetFactory>::unchecked_narrow (
        _tao_objref,
        "IDL:omg.org/CosConcurrencyControl/LockSetFactory:1.0",
        CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

CosConcurrencyControl::LockSetFactory_ptr
CosConcurrencyControl::LockSetFactory::_duplicate (LockSetFactory_ptr obj)
{
  if (! CORBA::is_nil (obj))
    {
      obj->_add_ref ();
    }
  
  return obj;
}

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

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

CORBA::Boolean
CosConcurrencyControl::LockSetFactory::marshal (TAO_OutputCDR &cdr)
{
  return (cdr << this);
}

// TAO_IDL - Generated from
// be/be_visitor_typecode/typecode_defn.cpp:290

static const CORBA::Long _oc_CosConcurrencyControl_LockSetFactory[] =
{
    TAO_ENCAP_BYTE_ORDER, // byte order
  53,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x6f6d672e), 
  ACE_NTOHL (0x6f72672f), 
  ACE_NTOHL (0x436f7343), 
  ACE_NTOHL (0x6f6e6375), 
  ACE_NTOHL (0x7272656e), 
  ACE_NTOHL (0x6379436f), 
  ACE_NTOHL (0x6e74726f), 
  ACE_NTOHL (0x6c2f4c6f), 
  ACE_NTOHL (0x636b5365), 
  ACE_NTOHL (0x74466163), 
  ACE_NTOHL (0x746f7279), 
  ACE_NTOHL (0x3a312e30), 
  ACE_NTOHL (0x0),  // repository ID = IDL:omg.org/CosConcurrencyControl/LockSetFactory:1.0
    15,
  ACE_NTOHL (0x4c6f636b), 
  ACE_NTOHL (0x53657446), 
  ACE_NTOHL (0x6163746f), 
  ACE_NTOHL (0x72790000),  // name = LockSetFactory
  };

static CORBA::TypeCode _tc_TAO_tc_CosConcurrencyControl_LockSetFactory (
    CORBA::tk_objref,
    sizeof (_oc_CosConcurrencyControl_LockSetFactory),
    (char *) &_oc_CosConcurrencyControl_LockSetFactory,
    0,
    sizeof (CosConcurrencyControl::LockSetFactory)
  );

namespace CosConcurrencyControl
{
  ::CORBA::TypeCode_ptr _tc_LockSetFactory =
    &_tc_TAO_tc_CosConcurrencyControl_LockSetFactory;
}

// TAO_IDL - Generated from
// be/be_visitor_enum/any_op_cs.cpp:52

void operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::lock_mode _tao_elem
  )
{
  TAO::Any_Basic_Impl_T<CosConcurrencyControl::lock_mode>::insert (
      _tao_any,
      CosConcurrencyControl::_tc_lock_mode,
      _tao_elem
    );
}

CORBA::Boolean operator>>= (
    const CORBA::Any &_tao_any,
    CosConcurrencyControl::lock_mode &_tao_elem
  )
{
  return
    TAO::Any_Basic_Impl_T<CosConcurrencyControl::lock_mode>::extract (
        _tao_any,
        CosConcurrencyControl::_tc_lock_mode,
        _tao_elem 
      );
}

// TAO_IDL - Generated from 
// be/be_visitor_exception/any_op_cs.cpp:50

ACE_TEMPLATE_SPECIALIZATION
CORBA::Boolean
TAO::Any_Dual_Impl_T<CosConcurrencyControl::LockNotHeld>::demarshal_value (
    TAO_InputCDR & cdr
  )
{
  CORBA::String_var id;
  
  if ((cdr >> id.out ()) == 0)
    {
      return 0;
    }
  
  ACE_TRY_NEW_ENV
    {
      this->value_->_tao_decode (cdr ACE_ENV_ARG_PARAMETER);
      ACE_TRY_CHECK;
    }
  ACE_CATCHANY
    {
      return 0;
    }
  ACE_ENDTRY;
  
  return 1;
}

// Copying insertion.
void operator<<= (
    CORBA::Any &_tao_any,
    const CosConcurrencyControl::LockNotHeld &_tao_elem
  )
{
  TAO::Any_Dual_Impl_T<CosConcurrencyControl::LockNotHeld>::insert_copy (
      _tao_any,
      CosConcurrencyControl::LockNotHeld::_tao_any_destructor,
      CosConcurrencyControl::_tc_LockNotHeld,
      _tao_elem
    );
}

// Non-copying insertion.
void operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::LockNotHeld *_tao_elem
  )
{
  TAO::Any_Dual_Impl_T<CosConcurrencyControl::LockNotHeld>::insert (
      _tao_any,
      CosConcurrencyControl::LockNotHeld::_tao_any_destructor,
      CosConcurrencyControl::_tc_LockNotHeld,
      _tao_elem
    );
}

// Extraction to non-const pointer (deprecated).
CORBA::Boolean operator>>= (
    const CORBA::Any &_tao_any,
    CosConcurrencyControl::LockNotHeld *&_tao_elem
  )
{
  return _tao_any >>= const_cast<
      const CosConcurrencyControl::LockNotHeld *&> (
      _tao_elem
    );
}

// Extraction to const pointer.
CORBA::Boolean operator>>= (
    const CORBA::Any &_tao_any,
    const CosConcurrencyControl::LockNotHeld *&_tao_elem
  )
{
  return
    TAO::Any_Dual_Impl_T<CosConcurrencyControl::LockNotHeld>::extract (
        _tao_any,
        CosConcurrencyControl::LockNotHeld::_tao_any_destructor,
        CosConcurrencyControl::_tc_LockNotHeld,
        _tao_elem
      );
}

// TAO_IDL - Generated from
// be/be_visitor_interface/any_op_cs.cpp:50

ACE_TEMPLATE_SPECIALIZATION
CORBA::Boolean
TAO::Any_Impl_T<CosConcurrencyControl::LockSet>::to_object (
    CORBA::Object_ptr &_tao_elem
  ) const
{
  _tao_elem = CORBA::Object::_duplicate (this->value_);
  return 1;
}

// Copying insertion.
void
operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSet_ptr _tao_elem
  )
{
  CosConcurrencyControl::LockSet_ptr _tao_objptr =
    CosConcurrencyControl::LockSet::_duplicate (_tao_elem);
  _tao_any <<= &_tao_objptr;
}

// Non-copying insertion.
void
operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSet_ptr *_tao_elem
  )
{
  TAO::Any_Impl_T<CosConcurrencyControl::LockSet>::insert (
      _tao_any,
      CosConcurrencyControl::LockSet::_tao_any_destructor,
      CosConcurrencyControl::_tc_LockSet,
      *_tao_elem
    );
}

CORBA::Boolean
operator>>= (
    const CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSet_ptr &_tao_elem
  )
{
  return
    TAO::Any_Impl_T<CosConcurrencyControl::LockSet>::extract (
        _tao_any,
        CosConcurrencyControl::LockSet::_tao_any_destructor,
        CosConcurrencyControl::_tc_LockSet,
        _tao_elem
      );
}

// TAO_IDL - Generated from
// be/be_visitor_interface/any_op_cs.cpp:50

ACE_TEMPLATE_SPECIALIZATION
CORBA::Boolean
TAO::Any_Impl_T<CosConcurrencyControl::LockSetFactory>::to_object (
    CORBA::Object_ptr &_tao_elem
  ) const
{
  _tao_elem = CORBA::Object::_duplicate (this->value_);
  return 1;
}

// Copying insertion.
void
operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSetFactory_ptr _tao_elem
  )
{
  CosConcurrencyControl::LockSetFactory_ptr _tao_objptr =
    CosConcurrencyControl::LockSetFactory::_duplicate (_tao_elem);
  _tao_any <<= &_tao_objptr;
}

// Non-copying insertion.
void
operator<<= (
    CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSetFactory_ptr *_tao_elem
  )
{
  TAO::Any_Impl_T<CosConcurrencyControl::LockSetFactory>::insert (
      _tao_any,
      CosConcurrencyControl::LockSetFactory::_tao_any_destructor,
      CosConcurrencyControl::_tc_LockSetFactory,
      *_tao_elem
    );
}

CORBA::Boolean
operator>>= (
    const CORBA::Any &_tao_any,
    CosConcurrencyControl::LockSetFactory_ptr &_tao_elem
  )
{
  return
    TAO::Any_Impl_T<CosConcurrencyControl::LockSetFactory>::extract (
        _tao_any,
        CosConcurrencyControl::LockSetFactory::_tao_any_destructor,
        CosConcurrencyControl::_tc_LockSetFactory,
        _tao_elem
      );
}

// TAO_IDL - Generated from
// be/be_visitor_enum/cdr_op_cs.cpp:51

CORBA::Boolean operator<< (TAO_OutputCDR &strm, const CosConcurrencyControl::lock_mode &_tao_enumval)
{
  CORBA::ULong _tao_temp = _tao_enumval;
  return strm << _tao_temp;
}

CORBA::Boolean operator>> (TAO_InputCDR &strm, CosConcurrencyControl::lock_mode &_tao_enumval)
{
  CORBA::ULong _tao_temp = 0;
  CORBA::Boolean _tao_result = strm >> _tao_temp;
  
  if (_tao_result == 1)
    {
      _tao_enumval = static_cast<CosConcurrencyControl::lock_mode> (_tao_temp);
    }
  
  return _tao_result;
}

// TAO_IDL - Generated from
// be/be_visitor_exception/cdr_op_cs.cpp:60

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const CosConcurrencyControl::LockNotHeld &_tao_aggregate
  )
{
  // First marshal the repository ID.
  if (strm << _tao_aggregate._rep_id ())
    {
      return 1;
    }
  else
    {
      return 0;
    }
}

CORBA::Boolean operator>> (
    TAO_InputCDR &,
    CosConcurrencyControl::LockNotHeld&
  )
{
  return 1;
}

// TAO_IDL - Generated from
// be/be_visitor_interface/cdr_op_cs.cpp:63

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

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CosConcurrencyControl::LockSet_ptr &_tao_objref
  )
{
  CORBA::Object_var obj;
  
  if ((strm >> obj.inout ()) == 0)
    {
      return 0;
    }
  
  typedef ::CosConcurrencyControl::LockSet RHS_SCOPED_NAME;
  
  // Narrow to the right type.
  _tao_objref =
    TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
        obj.in (),
        CosConcurrencyControl__TAO_LockSet_Proxy_Broker_Factory_function_pointer
      );
    
  return 1;
}

// TAO_IDL - Generated from
// be/be_visitor_interface/cdr_op_cs.cpp:63

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

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    CosConcurrencyControl::LockSetFactory_ptr &_tao_objref
  )
{
  CORBA::Object_var obj;
  
  if ((strm >> obj.inout ()) == 0)
    {
      return 0;
    }
  
  typedef ::CosConcurrencyControl::LockSetFactory RHS_SCOPED_NAME;
  
  // Narrow to the right type.
  _tao_objref =
    TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (
        obj.in (),
        CosConcurrencyControl__TAO_LockSetFactory_Proxy_Broker_Factory_function_pointer
      );
    
  return 1;
}

