// -*- 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 "RtecUDPAdminC.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/Basic_Arguments.h"
#include "tao/Fixed_Size_Argument_T.h"
#include "tao/Var_Size_Argument_T.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 "RtecUDPAdminC.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:618

#if !defined (_RTECEVENTCOMM_EVENTHEADER__ARG_TRAITS_CS_)
#define _RTECEVENTCOMM_EVENTHEADER__ARG_TRAITS_CS_
  
  ACE_TEMPLATE_SPECIALIZATION
  class TAO_RTEvent_Export Arg_Traits<RtecEventComm::EventHeader>
    : public
        Fixed_Size_Arg_Traits_T<
            RtecEventComm::EventHeader
          >
  {
  };

#endif /* end #if !defined */
  
  // TAO_IDL - Generated from
  // be/be_visitor_arg_traits.cpp:379

#if !defined (_RTECEVENTCOMM_EVENTSET__ARG_TRAITS_CS_)
#define _RTECEVENTCOMM_EVENTSET__ARG_TRAITS_CS_
  
  ACE_TEMPLATE_SPECIALIZATION
  class TAO_RTEvent_Export Arg_Traits<RtecEventComm::EventSet>
    : public
        Var_Size_Arg_Traits_T<
            RtecEventComm::EventSet,
            RtecEventComm::EventSet_var,
            RtecEventComm::EventSet_out
          >
  {
  };

#endif /* end #if !defined */
  
  // TAO_IDL - Generated from
  // be/be_visitor_arg_traits.cpp:618

#if !defined (_RTECUDPADMIN_UDP_ADDR__ARG_TRAITS_CS_)
#define _RTECUDPADMIN_UDP_ADDR__ARG_TRAITS_CS_
  
  ACE_TEMPLATE_SPECIALIZATION
  class TAO_RTEvent_Export Arg_Traits<RtecUDPAdmin::UDP_Addr>
    : public
        Fixed_Size_Arg_Traits_T<
            RtecUDPAdmin::UDP_Addr
          >
  {
  };

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


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

static const CORBA::Long _oc_RtecUDPAdmin_UDP_Addr[] =
{
    TAO_ENCAP_BYTE_ORDER, // byte order
  30,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x52746563), 
  ACE_NTOHL (0x55445041), 
  ACE_NTOHL (0x646d696e), 
  ACE_NTOHL (0x2f554450), 
  ACE_NTOHL (0x5f416464), 
  ACE_NTOHL (0x723a312e), 
  ACE_NTOHL (0x30000000),  // repository ID = IDL:RtecUDPAdmin/UDP_Addr:1.0
    9,
  ACE_NTOHL (0x5544505f), 
  ACE_NTOHL (0x41646472), 
  ACE_NTOHL (0x0),  // name = UDP_Addr
  2, // member count
    7,
  ACE_NTOHL (0x69706164), 
  ACE_NTOHL (0x64720000),  // name = ipaddr
    CORBA::tk_ulong,

  5,
  ACE_NTOHL (0x706f7274), 
  ACE_NTOHL (0x0),  // name = port
    CORBA::tk_ushort,

};

static CORBA::TypeCode _tc_TAO_tc_RtecUDPAdmin_UDP_Addr (
    CORBA::tk_struct,
    sizeof (_oc_RtecUDPAdmin_UDP_Addr),
    (char *) &_oc_RtecUDPAdmin_UDP_Addr,
    0,
    sizeof (RtecUDPAdmin::UDP_Addr)
  );

namespace RtecUDPAdmin
{
  ::CORBA::TypeCode_ptr _tc_UDP_Addr =
    &_tc_TAO_tc_RtecUDPAdmin_UDP_Addr;
}

// TAO_IDL - Generated from 
// be/be_visitor_structure/structure_cs.cpp:66

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

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

// Traits specializations for RtecUDPAdmin::AddrServer.

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
RtecUDPAdmin::AddrServer_ptr
TAO::Objref_Traits<RtecUDPAdmin::AddrServer>::tao_duplicate (
    RtecUDPAdmin::AddrServer_ptr p
  )
{
  return RtecUDPAdmin::AddrServer::_duplicate (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
void
TAO::Objref_Traits<RtecUDPAdmin::AddrServer>::tao_release (
    RtecUDPAdmin::AddrServer_ptr p
  )
{
  CORBA::release (p);
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
RtecUDPAdmin::AddrServer_ptr
TAO::Objref_Traits<RtecUDPAdmin::AddrServer>::tao_nil (void)
{
  return RtecUDPAdmin::AddrServer::_nil ();
}

ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION
CORBA::Boolean
TAO::Objref_Traits<RtecUDPAdmin::AddrServer>::tao_marshal (
    RtecUDPAdmin::AddrServer_ptr p,
    TAO_OutputCDR & cdr
  )
{
  return CORBA::Object::marshal (p, cdr);
}

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

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

void RtecUDPAdmin::AddrServer::get_addr (
    const ::RtecEventComm::EventHeader & header,
    ::RtecUDPAdmin::UDP_Addr_out addr
    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_AddrServer_Proxy_Broker_ == 0)
    {
      RtecUDPAdmin_AddrServer_setup_collocation ();
    }
  
  TAO::Arg_Traits< void>::ret_val _tao_retval;
  TAO::Arg_Traits< ::RtecEventComm::EventHeader>::in_arg_val _tao_header (header);
  TAO::Arg_Traits< ::RtecUDPAdmin::UDP_Addr>::out_arg_val _tao_addr (addr);
  
  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_header,
      &_tao_addr
    };
  
  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      3,
      "get_addr",
      8,
      this->the_TAO_AddrServer_Proxy_Broker_
    );
  
  _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}

RtecUDPAdmin::AddrServer::AddrServer (void)
 : the_TAO_AddrServer_Proxy_Broker_ (0)
{
  this->RtecUDPAdmin_AddrServer_setup_collocation ();
}

void
RtecUDPAdmin::AddrServer::RtecUDPAdmin_AddrServer_setup_collocation ()
{
  if (::RtecUDPAdmin__TAO_AddrServer_Proxy_Broker_Factory_function_pointer)
    {
      this->the_TAO_AddrServer_Proxy_Broker_ =
        ::RtecUDPAdmin__TAO_AddrServer_Proxy_Broker_Factory_function_pointer (this);
    }
}

RtecUDPAdmin::AddrServer::~AddrServer (void)
{}

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

RtecUDPAdmin::AddrServer_ptr
RtecUDPAdmin::AddrServer::_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<AddrServer>::narrow (
        _tao_objref,
        "IDL:RtecUDPAdmin/AddrServer:1.0",
        RtecUDPAdmin__TAO_AddrServer_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

RtecUDPAdmin::AddrServer_ptr
RtecUDPAdmin::AddrServer::_unchecked_narrow (
    CORBA::Object_ptr _tao_objref
    ACE_ENV_ARG_DECL
  )
{
  return
    TAO::Narrow_Utils<AddrServer>::unchecked_narrow (
        _tao_objref,
        "IDL:RtecUDPAdmin/AddrServer:1.0",
        RtecUDPAdmin__TAO_AddrServer_Proxy_Broker_Factory_function_pointer
        ACE_ENV_ARG_PARAMETER
      );
}

RtecUDPAdmin::AddrServer_ptr
RtecUDPAdmin::AddrServer::_duplicate (AddrServer_ptr obj)
{
  if (! CORBA::is_nil (obj))
    {
      obj->_add_ref ();
    }
  
  return obj;
}

CORBA::Boolean
RtecUDPAdmin::AddrServer::_is_a (
    const char *value
    ACE_ENV_ARG_DECL
  )
{
  if (
      !ACE_OS::strcmp (
          (char *)value,
          "IDL:RtecUDPAdmin/AddrServer: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* RtecUDPAdmin::AddrServer::_interface_repository_id (void) const
{
  return "IDL:RtecUDPAdmin/AddrServer:1.0";
}

CORBA::Boolean
RtecUDPAdmin::AddrServer::marshal (TAO_OutputCDR &cdr)
{
  return (cdr << this);
}

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

static const CORBA::Long _oc_RtecUDPAdmin_AddrServer[] =
{
    TAO_ENCAP_BYTE_ORDER, // byte order
  32,
  ACE_NTOHL (0x49444c3a), 
  ACE_NTOHL (0x52746563), 
  ACE_NTOHL (0x55445041), 
  ACE_NTOHL (0x646d696e), 
  ACE_NTOHL (0x2f416464), 
  ACE_NTOHL (0x72536572), 
  ACE_NTOHL (0x7665723a), 
  ACE_NTOHL (0x312e3000),  // repository ID = IDL:RtecUDPAdmin/AddrServer:1.0
    11,
  ACE_NTOHL (0x41646472), 
  ACE_NTOHL (0x53657276), 
  ACE_NTOHL (0x65720000),  // name = AddrServer
  };

static CORBA::TypeCode _tc_TAO_tc_RtecUDPAdmin_AddrServer (
    CORBA::tk_objref,
    sizeof (_oc_RtecUDPAdmin_AddrServer),
    (char *) &_oc_RtecUDPAdmin_AddrServer,
    0,
    sizeof (RtecUDPAdmin::AddrServer)
  );

namespace RtecUDPAdmin
{
  ::CORBA::TypeCode_ptr _tc_AddrServer =
    &_tc_TAO_tc_RtecUDPAdmin_AddrServer;
}

// TAO_IDL - Generated from 
// be/be_visitor_structure/any_op_cs.cpp:54

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

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

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

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

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

ACE_TEMPLATE_SPECIALIZATION
CORBA::Boolean
TAO::Any_Impl_T<RtecUDPAdmin::AddrServer>::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,
    RtecUDPAdmin::AddrServer_ptr _tao_elem
  )
{
  RtecUDPAdmin::AddrServer_ptr _tao_objptr =
    RtecUDPAdmin::AddrServer::_duplicate (_tao_elem);
  _tao_any <<= &_tao_objptr;
}

// Non-copying insertion.
void
operator<<= (
    CORBA::Any &_tao_any,
    RtecUDPAdmin::AddrServer_ptr *_tao_elem
  )
{
  TAO::Any_Impl_T<RtecUDPAdmin::AddrServer>::insert (
      _tao_any,
      RtecUDPAdmin::AddrServer::_tao_any_destructor,
      RtecUDPAdmin::_tc_AddrServer,
      *_tao_elem
    );
}

CORBA::Boolean
operator>>= (
    const CORBA::Any &_tao_any,
    RtecUDPAdmin::AddrServer_ptr &_tao_elem
  )
{
  return
    TAO::Any_Impl_T<RtecUDPAdmin::AddrServer>::extract (
        _tao_any,
        RtecUDPAdmin::AddrServer::_tao_any_destructor,
        RtecUDPAdmin::_tc_AddrServer,
        _tao_elem
      );
}

// TAO_IDL - Generated from
// be/be_visitor_structure/cdr_op_cs.cpp:61

CORBA::Boolean operator<< (
    TAO_OutputCDR &strm,
    const RtecUDPAdmin::UDP_Addr &_tao_aggregate
  )
{
  return
    (strm << _tao_aggregate.ipaddr) &&
    (strm << _tao_aggregate.port);
}

CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    RtecUDPAdmin::UDP_Addr &_tao_aggregate
  )
{
  return
    (strm >> _tao_aggregate.ipaddr) &&
    (strm >> _tao_aggregate.port);
}

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

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

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

