// -*- C++ -*-
/**
 * Code generated by the The ACE ORB (TAO) IDL Compiler v2.4.3
 * 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
 * and
 *       Institute for Software Integrated Systems
 *       Vanderbilt University
 *       Nashville, TN
 *       USA
 *       http://www.isis.vanderbilt.edu/
 *
 * Information about TAO is available at:
 *     http://www.dre.vanderbilt.edu/~schmidt/TAO.html
 **/

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


#include "PPPPC.h"
#include "tao/AnyTypeCode/Null_RefCount_Policy.h"
#include "tao/AnyTypeCode/TypeCode_Constants.h"
#include "tao/AnyTypeCode/Alias_TypeCode_Static.h"
#include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
#include "tao/AnyTypeCode/String_TypeCode_Static.h"
#include "tao/CDR.h"
#include "tao/Exception_Data.h"
#include "tao/Invocation_Adapter.h"
#include "tao/Object_T.h"
#include "tao/CDR.h"
#include "tao/AnyTypeCode/Any.h"
#include "tao/AnyTypeCode/Any_Impl_T.h"
#include "ace/OS_NS_string.h"

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

// TAO_IDL - Generated from
// be/be_visitor_interface/interface_cs.cpp:48
TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// Traits specializations for test::PPPP.

test::PPPP_ptr
TAO::Objref_Traits<test::PPPP>::duplicate (
    test::PPPP_ptr p)
{
  return test::PPPP::_duplicate (p);
}

void
TAO::Objref_Traits<test::PPPP>::release (
    test::PPPP_ptr p)
{
  ::CORBA::release (p);
}

test::PPPP_ptr
TAO::Objref_Traits<test::PPPP>::nil (void)
{
  return test::PPPP::_nil ();
}

::CORBA::Boolean
TAO::Objref_Traits<test::PPPP>::marshal (
    const test::PPPP_ptr p,
    TAO_OutputCDR & cdr)
{
  return ::CORBA::Object::marshal (p, cdr);
}

TAO_END_VERSIONED_NAMESPACE_DECL



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

char *
test::PPPP::sayHello (
  void)
{
  if (!this->is_evaluated ())
    {
      ::CORBA::Object::tao_object_initialize (this);
    }
  
  TAO::Arg_Traits< char *>::ret_val _tao_retval;

  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval
    };

  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      1,
      "sayHello",
      8,
      TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY,
      TAO::TAO_TWOWAY_INVOCATION
      ,
      TAO::TAO_SYNCHRONOUS_INVOCATION,
      false
    );

  _tao_call.invoke (0, 0);

  return _tao_retval.retn ();
}

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

char *
test::PPPP::sayHelloWithParameters (
  const char * inString,
  ::CORBA::Double & inoutDouble,
  ::CORBA::Long_out outInt)
{
  if (!this->is_evaluated ())
    {
      ::CORBA::Object::tao_object_initialize (this);
    }
  
  TAO::Arg_Traits< char *>::ret_val _tao_retval;
  TAO::Arg_Traits< char *>::in_arg_val _tao_inString (inString);
  TAO::Arg_Traits< ::CORBA::Double>::inout_arg_val _tao_inoutDouble (inoutDouble);
  TAO::Arg_Traits< ::CORBA::Long>::out_arg_val _tao_outInt (outInt);

  TAO::Argument *_the_tao_operation_signature [] =
    {
      &_tao_retval,
      &_tao_inString,
      &_tao_inoutDouble,
      &_tao_outInt
    };

  TAO::Invocation_Adapter _tao_call (
      this,
      _the_tao_operation_signature,
      4,
      "sayHelloWithParameters",
      22,
      TAO::TAO_CO_NONE | TAO::TAO_CO_THRU_POA_STRATEGY
      
    );

  _tao_call.invoke (0, 0);

  return _tao_retval.retn ();
}

test::PPPP::PPPP (void)
{
}

test::PPPP::~PPPP (void)
{
}

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

test::PPPP_ptr
test::PPPP::_narrow (
    ::CORBA::Object_ptr _tao_objref)
{
  return
    TAO::Narrow_Utils<PPPP>::narrow (
        _tao_objref,
        "IDL:astri/test/PPPP:1.0");
}

test::PPPP_ptr
test::PPPP::_unchecked_narrow (
    ::CORBA::Object_ptr _tao_objref)
{
  return
    TAO::Narrow_Utils<PPPP>::unchecked_narrow (
        _tao_objref);
}

test::PPPP_ptr
test::PPPP::_nil (void)
{
  return 0;
}

test::PPPP_ptr
test::PPPP::_duplicate (PPPP_ptr obj)
{
  if (! ::CORBA::is_nil (obj))
    {
      obj->_add_ref ();
    }
  return obj;
}

void
test::PPPP::_tao_release (PPPP_ptr obj)
{
  ::CORBA::release (obj);
}

::CORBA::Boolean
test::PPPP::_is_a (const char *value)
{
  if (
      ACE_OS::strcmp (
          value,
          "IDL:alma/ACS/ACSComponent:1.0"
        ) == 0 ||
      ACE_OS::strcmp (
          value,
          "IDL:astri/test/PPPP:1.0"
        ) == 0 ||
      ACE_OS::strcmp (
          value,
          "IDL:omg.org/CORBA/Object:1.0"
        ) == 0
    )
    {
      return true; // success using local knowledge
    }
  else
    {
      return this->::CORBA::Object::_is_a (value);
    }
}

const char* test::PPPP::_interface_repository_id (void) const
{
  return "IDL:astri/test/PPPP:1.0";
}

::CORBA::Boolean
test::PPPP::marshal (TAO_OutputCDR &cdr)
{
  return (cdr << this);
}

// TAO_IDL - Generated from
// be/be_visitor_typecode/objref_typecode.cpp:70

static TAO::TypeCode::Objref<char const *,
                             TAO::Null_RefCount_Policy>
  _tao_tc_test_PPPP (
    ::CORBA::tk_objref,
    "IDL:astri/test/PPPP:1.0",
    "PPPP");
  

namespace test
{
  ::CORBA::TypeCode_ptr const _tc_PPPP =
    &_tao_tc_test_PPPP;
}

// TAO_IDL - Generated from
// be/be_visitor_interface/any_op_cs.cpp:38
TAO_BEGIN_VERSIONED_NAMESPACE_DECL



namespace TAO
{
  template<>
  ::CORBA::Boolean
  Any_Impl_T<test::PPPP>::to_object (
      ::CORBA::Object_ptr &_tao_elem) const
  {
    _tao_elem = ::CORBA::Object::_duplicate (this->value_);
    return true;
  }
}
TAO_END_VERSIONED_NAMESPACE_DECL



#if defined (ACE_ANY_OPS_USE_NAMESPACE)

namespace test
{
  

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

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

  ::CORBA::Boolean
  operator>>= (
      const ::CORBA::Any &_tao_any,
      PPPP_ptr &_tao_elem)
  {
    return
      TAO::Any_Impl_T<PPPP>::extract (
          _tao_any,
          PPPP::_tao_any_destructor,
          _tc_PPPP,
          _tao_elem);
  }
}

#else

TAO_BEGIN_VERSIONED_NAMESPACE_DECL



/// Copying insertion.
void
operator<<= (
    ::CORBA::Any &_tao_any,
    test::PPPP_ptr _tao_elem)
{
  test::PPPP_ptr _tao_objptr =
    test::PPPP::_duplicate (_tao_elem);
  _tao_any <<= &_tao_objptr;
}

/// Non-copying insertion.
void
operator<<= (
    ::CORBA::Any &_tao_any,
    test::PPPP_ptr *_tao_elem)
{
  TAO::Any_Impl_T<test::PPPP>::insert (
      _tao_any,
      test::PPPP::_tao_any_destructor,
      test::_tc_PPPP,
      *_tao_elem);
}

::CORBA::Boolean
operator>>= (
    const ::CORBA::Any &_tao_any,
    test::PPPP_ptr &_tao_elem)
{
  return
    TAO::Any_Impl_T<test::PPPP>::extract (
        _tao_any,
        test::PPPP::_tao_any_destructor,
        test::_tc_PPPP,
        _tao_elem);
}

TAO_END_VERSIONED_NAMESPACE_DECL



#endif

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

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

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

::CORBA::Boolean operator>> (
    TAO_InputCDR &strm,
    test::PPPP_ptr &_tao_objref)
{
  ::CORBA::Object_var obj;

  if (!(strm >> obj.inout ()))
    {
      return false;
    }
  
  typedef ::test::PPPP RHS_SCOPED_NAME;

  // Narrow to the right type.
  _tao_objref =
    TAO::Narrow_Utils<RHS_SCOPED_NAME>::unchecked_narrow (obj.in ());
    
  return true;
}

TAO_END_VERSIONED_NAMESPACE_DECL



