#include "front.h"
#include <omniORB2/proxyCall.h>

static const char* _0RL_library_version = omniORB_2_7;


size_t
Place::NP_alignedSize(size_t _initialoffset) const
{
  CORBA::ULong _msgsize = _initialoffset;
  _msgsize += 1;
  _msgsize = omni::align_to(_msgsize,omni::ALIGN_4);
  _msgsize += 4;
  return _msgsize;
}

void
Place::operator>>= (NetBufferedStream &_n) const
{
  row >>= _n;
  seat >>= _n;
}

void
Place::operator<<= (NetBufferedStream &_n)
{
  row <<= _n;
  seat <<= _n;
}

void
Place::operator>>= (MemBufferedStream &_n) const
{
  row >>= _n;
  seat >>= _n;
}

void
Place::operator<<= (MemBufferedStream &_n)
{
  row <<= _n;
  seat <<= _n;
}

// Proxy call descriptor class. Mangled signature:
//  _cstring
class _0RL_pc_1437189665f819aa_00000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_00000000(const char* _op, size_t _op_len) :
    OmniProxyCallDesc(_op, _op_len)  {}

  virtual void unmarshalReturnedValues(GIOP_C&);
  inline char* result() { return pd_result; }

private:
  char* pd_result;
};

void _0RL_pc_1437189665f819aa_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;
  }
}

// Proxy call descriptor class. Mangled signature:
//  void_i_cstring
class _0RL_pc_1437189665f819aa_10000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_10000000(const char* _op, size_t _op_len, const char* arg) :
    OmniProxyCallDesc(_op, _op_len),
    _value(arg)  {}

  virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
  virtual void marshalArguments(GIOP_C&);

private:
  const char* _value;
};

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

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

char* _proxy_FrontOffice::name()
{
  _0RL_pc_1437189665f819aa_00000000 _call_desc("_get_name", 10);

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


// Proxy call descriptor class. Mangled signature:
//  _cunsigned_plong
class _0RL_pc_1437189665f819aa_20000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_20000000(const char* _op, size_t _op_len) :
    OmniProxyCallDesc(_op, _op_len)  {}

  virtual void unmarshalReturnedValues(GIOP_C&);
  inline CORBA::ULong result() { return pd_result; }

private:
  CORBA::ULong pd_result;
};

void _0RL_pc_1437189665f819aa_20000000::unmarshalReturnedValues(GIOP_C& giop_client)
{
  pd_result <<= giop_client;
}

// Proxy call descriptor class. Mangled signature:
//  void_i_cunsigned_plong
class _0RL_pc_1437189665f819aa_30000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_30000000(const char* _op, size_t _op_len, CORBA::ULong arg) :
    OmniProxyCallDesc(_op, _op_len),
    _value(arg)  {}

  virtual CORBA::ULong alignedSize(CORBA::ULong size_in);
  virtual void marshalArguments(GIOP_C&);

private:
  CORBA::ULong _value;
};

CORBA::ULong _0RL_pc_1437189665f819aa_30000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize = omni::align_to(msgsize,omni::ALIGN_4);
  msgsize += 4;
  return msgsize;
}

void _0RL_pc_1437189665f819aa_30000000::marshalArguments(GIOP_C& giop_client)
{
  _value >>= giop_client;
}

CORBA::ULong _proxy_FrontOffice::numberOfSeats()
{
  _0RL_pc_1437189665f819aa_20000000 _call_desc("_get_numberOfSeats", 19);

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


// Proxy call descriptor class. Mangled signature:
//  _cfloat_i_cPlace
class _0RL_pc_1437189665f819aa_40000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_40000000(const char* _op, size_t _op_len, const Place& _a_chosenPlace) :
    OmniProxyCallDesc(_op, _op_len),
    arg_chosenPlace(_a_chosenPlace)  {}

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

private:
  const Place& arg_chosenPlace;
  Price pd_result;
};

CORBA::ULong _0RL_pc_1437189665f819aa_40000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize = arg_chosenPlace.NP_alignedSize(msgsize);
  return msgsize;
}

void _0RL_pc_1437189665f819aa_40000000::marshalArguments(GIOP_C& giop_client)
{
  arg_chosenPlace >>= giop_client;
}

void _0RL_pc_1437189665f819aa_40000000::unmarshalReturnedValues(GIOP_C& giop_client)
{
  pd_result <<= giop_client;
}

Price  _proxy_FrontOffice::getPrice(const Place & chosenPlace)
{
  _0RL_pc_1437189665f819aa_40000000 _call_desc("getPrice", 9, chosenPlace);

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



// Proxy call descriptor class. Mangled signature:
//  _cboolean_i_cPlace_i_cstring
class _0RL_pc_1437189665f819aa_50000000
  : public OmniProxyCallDesc
{
public:
  inline _0RL_pc_1437189665f819aa_50000000(const char* _op, size_t _op_len, const Place& _a_chosenPlace, const char* _a_creditCard) :
    OmniProxyCallDesc(_op, _op_len),
    arg_chosenPlace(_a_chosenPlace),
    arg_creditCard(_a_creditCard)  {}

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

private:
  const Place& arg_chosenPlace;
  const char* arg_creditCard;
  CORBA::Boolean pd_result;
};

CORBA::ULong _0RL_pc_1437189665f819aa_50000000::alignedSize(CORBA::ULong msgsize)
{
  msgsize = arg_chosenPlace.NP_alignedSize(msgsize);
  msgsize = omni::align_to(msgsize,omni::ALIGN_4);
  msgsize += 4 + (((const char*) arg_creditCard)? strlen((const char*) arg_creditCard) + 1 : 1);
  return msgsize;
}

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

void _0RL_pc_1437189665f819aa_50000000::unmarshalReturnedValues(GIOP_C& giop_client)
{
  pd_result <<= giop_client;
}

CORBA::Boolean  _proxy_FrontOffice::bookSingleSeat(const Place & chosenPlace, const char*  creditCard)
{
  _0RL_pc_1437189665f819aa_50000000 _call_desc("bookSingleSeat", 15, chosenPlace, creditCard);

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




CORBA::Boolean
_sk_FrontOffice::dispatch(GIOP_S &_0RL_s,const char *_0RL_op,CORBA::Boolean _0RL_response_expected)
{
  if (strcmp(_0RL_op,"_get_name") == 0)
  {
    if (!_0RL_response_expected) {
      throw CORBA::BAD_OPERATION(0,CORBA::COMPLETED_NO);
    }
    _0RL_s.RequestReceived();
    CORBA::String_var _0RL_result = name();
    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 if (strcmp(_0RL_op,"_get_numberOfSeats") == 0)
  {
    if (!_0RL_response_expected) {
      throw CORBA::BAD_OPERATION(0,CORBA::COMPLETED_NO);
    }
    _0RL_s.RequestReceived();
    CORBA::ULong _0RL_result = numberOfSeats();
    size_t _0RL_msgsize = (size_t) GIOP_S::ReplyHeaderSize();
    _0RL_msgsize = omni::align_to(_0RL_msgsize,omni::ALIGN_4);
    _0RL_msgsize += 4;
    _0RL_s.InitialiseReply(GIOP::NO_EXCEPTION,(CORBA::ULong)_0RL_msgsize);
    _0RL_result >>= _0RL_s;
    _0RL_s.ReplyCompleted();
    return 1;
  }
  else if (strcmp(_0RL_op,"getPrice") == 0)
  {
    Place chosenPlace;
    chosenPlace <<= _0RL_s;
    _0RL_s.RequestReceived();
    Price _0RL_result;
    _0RL_result = getPrice(chosenPlace);
    size_t _0RL_msgsize = (size_t) GIOP_S::ReplyHeaderSize();
    _0RL_msgsize = omni::align_to(_0RL_msgsize,omni::ALIGN_4);
    _0RL_msgsize += 4;
    _0RL_s.InitialiseReply(GIOP::NO_EXCEPTION,(CORBA::ULong)_0RL_msgsize);
    _0RL_result >>= _0RL_s;
    _0RL_s.ReplyCompleted();
    return 1;
  }
  else if (strcmp(_0RL_op,"bookSingleSeat") == 0)
  {
    Place chosenPlace;
    chosenPlace <<= _0RL_s;
    CORBA::String_var creditCard;
    {
      CORBA::String_member _0RL_str_tmp;
      _0RL_str_tmp <<= _0RL_s;
      creditCard = _0RL_str_tmp._ptr;
      _0RL_str_tmp._ptr = 0;
    }
    _0RL_s.RequestReceived();
    CORBA::Boolean _0RL_result;
    _0RL_result = bookSingleSeat(chosenPlace, creditCard);
    size_t _0RL_msgsize = (size_t) GIOP_S::ReplyHeaderSize();
    _0RL_msgsize += 1;
    _0RL_s.InitialiseReply(GIOP::NO_EXCEPTION,(CORBA::ULong)_0RL_msgsize);
    _0RL_result >>= _0RL_s;
    _0RL_s.ReplyCompleted();
    return 1;
  }
  else {
    return 0;
  }
}

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

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

FrontOffice_ptr
FrontOffice::_duplicate(FrontOffice_ptr obj)
{
  if (CORBA::is_nil(obj))
    return FrontOffice::_nil();
  CORBA::Object::_duplicate(obj);
  return obj;
}

FrontOffice_ptr
FrontOffice::_narrow(CORBA::Object_ptr obj)
{
  if (CORBA::is_nil(obj))
    return FrontOffice::_nil();
  FrontOffice_ptr e = (FrontOffice_ptr) (obj->PR_getobj()->_realNarrow(FrontOffice_IntfRepoID));
  if (e)
    return e;
  else
    return FrontOffice::_nil();
}

void *
FrontOffice::_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(FrontOffice_IntfRepoID,repoId) == 0)
    return (void *)this;
  else {
    return 0;
  }
}

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

FrontOffice_ptr
FrontOffice_Helper::_nil() {
  return FrontOffice::_nil();
}

CORBA::Boolean
FrontOffice_Helper::is_nil(FrontOffice_ptr p) {
  return CORBA::is_nil(p);
}

void
FrontOffice_Helper::release(FrontOffice_ptr p) {
  CORBA::release(p);
}

void
FrontOffice_Helper::duplicate(FrontOffice_ptr p) {
  CORBA::Object::_duplicate(p);
}

size_t
FrontOffice_Helper::NP_alignedSize(FrontOffice_ptr obj,size_t initialoffset) {
  return FrontOffice::NP_alignedSize(obj,initialoffset);
}

void
FrontOffice_Helper::marshalObjRef(FrontOffice_ptr obj,NetBufferedStream &s) {
  FrontOffice::marshalObjRef(obj,s);
}

FrontOffice_ptr FrontOffice_Helper::unmarshalObjRef(NetBufferedStream &s) {
  return FrontOffice::unmarshalObjRef(s);
}

void
FrontOffice_Helper::marshalObjRef(FrontOffice_ptr obj,MemBufferedStream &s) {
  FrontOffice::marshalObjRef(obj,s);
}

FrontOffice_ptr FrontOffice_Helper::unmarshalObjRef(MemBufferedStream &s) {
  return FrontOffice::unmarshalObjRef(s);
}

const char *
FrontOffice_proxyObjectFactory::irRepoId() const
{
  return (const char *)FrontOffice_IntfRepoID;
}

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

CORBA::Boolean
FrontOffice_proxyObjectFactory::is_a(const char *base_repoId) const
{
  return FrontOffice::_0RL_is_a(base_repoId);

}

FrontOffice_ptr
FrontOffice::_nil() {
  return FrontOffice_proxyObjectFactory::_nil();
}

static const FrontOffice_proxyObjectFactory FrontOffice_proxyObjectFactory;
FrontOffice_ptr FrontOffice_proxyObjectFactory::__nil_FrontOffice = 0;

