// This file is generated by omniidl2- omniORB_2_8. Do not edit.
#include "echo.hh"
#include <omniORB2/proxyCall.h>

static const char* _0RL_library_version = omniORB_2_8;


Echo::~Echo () {}

_sk_Echo::~_sk_Echo () {}

_proxy_Echo::~_proxy_Echo () {}

_nil_Echo::~_nil_Echo () {}

Echo_proxyObjectFactory::~Echo_proxyObjectFactory () {}

// Proxy call descriptor class. Mangled signature:
//  _cstring_i_cstring
class _0RL_pc_01531d3e51c81a80_00000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_01531d3e51c81a80_00000000(const char* _op, size_t _op_len, const char* _a_mesg) :
    OmniProxyCallDesc(_op, _op_len),
    arg_mesg(_a_mesg)  {}

  virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
  virtual void marshalArguments(GIOP_C&);
  virtual void unmarshalReturnedValues(GIOP_C&);
  inline char* result() { return pd_result; }

private:
  const char* arg_mesg;
  char* pd_result;
};

CORBA::ULong _0RL_pc_01531d3e51c81a80_00000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize = omni::align_to(msgsize,omni::ALIGN_4);
  msgsize += 4 + (((const char*) arg_mesg)? strlen((const char*) arg_mesg) + 1 : 1);
  return msgsize;
}

void _0RL_pc_01531d3e51c81a80_00000000::marshalArguments(GIOP_C& giop_client)
{
  {
    CORBA::ULong _len = (((const char*) arg_mesg)? strlen((const char*) arg_mesg) + 1 : 1);
    _len >>= giop_client;
    if (_len > 1)
      giop_client.put_char_array((const CORBA::Char *)((const char*) arg_mesg),_len);
    else {
      if ((const char*) arg_mesg == 0 && omniORB::traceLevel > 1)
        _CORBA_null_string_ptr(0);
      CORBA::Char('\0') >>= giop_client;
    }
  }
}

void _0RL_pc_01531d3e51c81a80_00000000::unmarshalReturnedValues(GIOP_C& giop_client)
{
  {
    CORBA::String_member _0RL_str_tmp;
    _0RL_str_tmp <<= giop_client;
    pd_result = _0RL_str_tmp._ptr;
    _0RL_str_tmp._ptr = 0;
  }
}

char*  _proxy_Echo::echoString(const char*  mesg)
{
  _0RL_pc_01531d3e51c81a80_00000000 _call_desc("echoString", 11, mesg);

  OmniProxyCallWrapper::invoke(this, _call_desc);
  return _call_desc.result();
}




CORBA::Boolean
_sk_Echo::dispatch(GIOP_S &_0RL_s,const char *_0RL_op,CORBA::Boolean _0RL_response_expected)
{
  if (strcmp(_0RL_op,"echoString") == 0)
  {
    CORBA::String_var mesg;
    {
      CORBA::String_member _0RL_str_tmp;
      _0RL_str_tmp <<= _0RL_s;
      mesg = _0RL_str_tmp._ptr;
      _0RL_str_tmp._ptr = 0;
    }
    _0RL_s.RequestReceived();
    CORBA::String_var _0RL_result;
    _0RL_result = echoString(mesg);
    size_t _0RL_msgsize = (size_t) GIOP_S::ReplyHeaderSize();
    _0RL_msgsize = omni::align_to(_0RL_msgsize,omni::ALIGN_4);
    _0RL_msgsize += 4 + (((const char*) _0RL_result)? strlen((const char*) _0RL_result) + 1 : 1);
    _0RL_s.InitialiseReply(GIOP::NO_EXCEPTION,(CORBA::ULong)_0RL_msgsize);
    {
      CORBA::ULong _len = (((const char*) _0RL_result)? strlen((const char*) _0RL_result) + 1 : 1);
      _len >>= _0RL_s;
      if (_len > 1)
        _0RL_s.put_char_array((const CORBA::Char *)((const char*) _0RL_result),_len);
      else {
        if ((const char*) _0RL_result == 0 && omniORB::traceLevel > 1)
          _CORBA_null_string_ptr(0);
        CORBA::Char('\0') >>= _0RL_s;
      }
    }
    _0RL_s.ReplyCompleted();
    return 1;
  }
  else {
    return 0;
  }
}

_sk_Echo::_sk_Echo (const omniORB::objectKey& k)
{
  omniRopeAndKey l(0,(CORBA::Octet*)&k,(CORBA::ULong)sizeof(k));
  setRopeAndKey(l,0);
}

omniORB::objectKey
_sk_Echo::_key()
{
  omniRopeAndKey l;
  getRopeAndKey(l);
  return (*((omniORB::objectKey*)l.key()));
}

Echo_ptr
Echo::_duplicate(Echo_ptr obj)
{
  if (CORBA::is_nil(obj))
    return Echo::_nil();
  CORBA::Object::_duplicate(obj);
  return obj;
}

Echo_ptr
Echo::_narrow(CORBA::Object_ptr obj)
{
  if (CORBA::is_nil(obj))
    return Echo::_nil();
  Echo_ptr e = (Echo_ptr) (obj->PR_getobj()->_realNarrow(Echo_IntfRepoID));
  if (e)
    return e;
  else
    return Echo::_nil();
}

void *
Echo::_widenFromTheMostDerivedIntf(const char *repoId,CORBA::Boolean is_cxx_type_id)
{
  if (is_cxx_type_id) return 0;
  if (!repoId)
    return (void *)((CORBA::Object_ptr)this);
  if (strcmp(Echo_IntfRepoID,repoId) == 0)
    return (void *)this;
  else {
    return 0;
  }
}

CORBA::Boolean
Echo::_0RL_is_a(const char *base_repoId) {
  if (strcmp(base_repoId,(const char *)Echo_IntfRepoID)==0)
    return 1;
  else
    return 0;
}

Echo_ptr
Echo_Helper::_nil() {
  return Echo::_nil();
}

CORBA::Boolean
Echo_Helper::is_nil(Echo_ptr p) {
  return CORBA::is_nil(p);
}

void
Echo_Helper::release(Echo_ptr p) {
  CORBA::release(p);
}

void
Echo_Helper::duplicate(Echo_ptr p) {
  CORBA::Object::_duplicate(p);
}

size_t
Echo_Helper::NP_alignedSize(Echo_ptr obj,size_t initialoffset) {
  return Echo::NP_alignedSize(obj,initialoffset);
}

void
Echo_Helper::marshalObjRef(Echo_ptr obj,NetBufferedStream &s) {
  Echo::marshalObjRef(obj,s);
}

Echo_ptr Echo_Helper::unmarshalObjRef(NetBufferedStream &s) {
  return Echo::unmarshalObjRef(s);
}

void
Echo_Helper::marshalObjRef(Echo_ptr obj,MemBufferedStream &s) {
  Echo::marshalObjRef(obj,s);
}

Echo_ptr Echo_Helper::unmarshalObjRef(MemBufferedStream &s) {
  return Echo::unmarshalObjRef(s);
}

const char *
Echo_proxyObjectFactory::irRepoId() const
{
  return (const char *)Echo_IntfRepoID;
}

CORBA::Object_ptr
Echo_proxyObjectFactory::newProxyObject(Rope *r,CORBA::Octet *key,size_t keysize,IOP::TaggedProfileList *profiles,CORBA::Boolean release)
{
  _proxy_Echo *p = new _proxy_Echo(r,key,keysize,profiles,release);
  if (!p) {
    throw CORBA::NO_MEMORY(0,CORBA::COMPLETED_NO);
  }
  return (CORBA::Object_ptr) p;
}

CORBA::Boolean
Echo_proxyObjectFactory::is_a(const char *base_repoId) const
{
  return Echo::_0RL_is_a(base_repoId);

}

Echo_ptr
Echo::_nil() {
  return Echo_proxyObjectFactory::_nil();
}

static const Echo_proxyObjectFactory Echo_proxyObjectFactory;
Echo_ptr Echo_proxyObjectFactory::__nil_Echo = 0;

