[omniORB] omniORB: Error in network receive...

Damir Mamic damir.mamic at gmail.com
Mon Jul 21 18:45:07 BST 2008


Skipped content of type multipart/alternative-------------- next part --------------
struct DMStruct {

  long l[126899];
  short s[100];

};

struct DMSAny {
	any stru1;
	any a[15];
};

struct DMSmallStruct {
	long l[20];
	short s[20];
};

interface ORBTest {
   any EchoString(in any inStr);
   DMSAny GetDMSAny(in DMSAny daIO);
   DMStruct GetDMStruct(in DMStruct dsIn);
};
-------------- next part --------------
// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit.
#ifndef __ORBTest_hh__
#define __ORBTest_hh__

#ifndef __CORBA_H_EXTERNAL_GUARD__
#include <omniORB4/CORBA.h>
#endif

#ifndef  USE_stub_in_nt_dll
# define USE_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif
#ifndef  USE_core_stub_in_nt_dll
# define USE_core_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif
#ifndef  USE_dyn_stub_in_nt_dll
# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif






#ifdef USE_stub_in_nt_dll
# ifndef USE_core_stub_in_nt_dll
#  define USE_core_stub_in_nt_dll
# endif
# ifndef USE_dyn_stub_in_nt_dll
#  define USE_dyn_stub_in_nt_dll
# endif
#endif

#ifdef _core_attr
# error "A local CPP macro _core_attr has already been defined."
#else
# ifdef  USE_core_stub_in_nt_dll
#  define _core_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _core_attr
# endif
#endif

#ifdef _dyn_attr
# error "A local CPP macro _dyn_attr has already been defined."
#else
# ifdef  USE_dyn_stub_in_nt_dll
#  define _dyn_attr _OMNIORB_NTDLL_IMPORT
# else
#  define _dyn_attr
# endif
#endif





struct DMStruct {
  typedef _CORBA_ConstrType_Fix_Var<DMStruct> _var_type;

  
  typedef ::CORBA::Long _0RL_l[126899];
  typedef ::CORBA::Long _l_slice;

  ::CORBA::Long l[126899];

  typedef ::CORBA::Short _0RL_s[100];
  typedef ::CORBA::Short _s_slice;

  ::CORBA::Short s[100];



  void operator>>= (cdrStream &) const;
  void operator<<= (cdrStream &);
};

typedef DMStruct::_var_type DMStruct_var;

typedef DMStruct& DMStruct_out;

_CORBA_GLOBAL_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DMStruct;

struct DMSAny {
  typedef _CORBA_ConstrType_Variable_Var<DMSAny> _var_type;

  
  ::CORBA::Any stru1;

  typedef ::CORBA::Any _0RL_a[15];
  typedef ::CORBA::Any _a_slice;

  ::CORBA::Any a[15];



  void operator>>= (cdrStream &) const;
  void operator<<= (cdrStream &);
};

typedef DMSAny::_var_type DMSAny_var;

typedef _CORBA_ConstrType_Variable_OUT_arg< DMSAny,DMSAny_var > DMSAny_out;

_CORBA_GLOBAL_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DMSAny;

struct DMSmallStruct {
  typedef _CORBA_ConstrType_Fix_Var<DMSmallStruct> _var_type;

  
  typedef ::CORBA::Long _0RL_l[20];
  typedef ::CORBA::Long _l_slice;

  ::CORBA::Long l[20];

  typedef ::CORBA::Short _0RL_s[20];
  typedef ::CORBA::Short _s_slice;

  ::CORBA::Short s[20];



  void operator>>= (cdrStream &) const;
  void operator<<= (cdrStream &);
};

typedef DMSmallStruct::_var_type DMSmallStruct_var;

typedef DMSmallStruct& DMSmallStruct_out;

_CORBA_GLOBAL_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_DMSmallStruct;

#ifndef __ORBTest__
#define __ORBTest__

class ORBTest;
class _objref_ORBTest;
class _impl_ORBTest;

typedef _objref_ORBTest* ORBTest_ptr;
typedef ORBTest_ptr ORBTestRef;

class ORBTest_Helper {
public:
  typedef ORBTest_ptr _ptr_type;

  static _ptr_type _nil();
  static _CORBA_Boolean is_nil(_ptr_type);
  static void release(_ptr_type);
  static void duplicate(_ptr_type);
  static void marshalObjRef(_ptr_type, cdrStream&);
  static _ptr_type unmarshalObjRef(cdrStream&);
};

typedef _CORBA_ObjRef_Var<_objref_ORBTest, ORBTest_Helper> ORBTest_var;
typedef _CORBA_ObjRef_OUT_arg<_objref_ORBTest,ORBTest_Helper > ORBTest_out;

#endif

// interface ORBTest
class ORBTest {
public:
  // Declarations for this interface type.
  typedef ORBTest_ptr _ptr_type;
  typedef ORBTest_var _var_type;

  static _ptr_type _duplicate(_ptr_type);
  static _ptr_type _narrow(::CORBA::Object_ptr);
  static _ptr_type _unchecked_narrow(::CORBA::Object_ptr);
  
  static _ptr_type _nil();

  static inline void _marshalObjRef(_ptr_type, cdrStream&);

  static inline _ptr_type _unmarshalObjRef(cdrStream& s) {
    omniObjRef* o = omniObjRef::_unMarshal(_PD_repoId,s);
    if (o)
      return (_ptr_type) o->_ptrToObjRef(_PD_repoId);
    else
      return _nil();
  }

  static _core_attr const char* _PD_repoId;

  // Other IDL defined within this scope.
  
};

class _objref_ORBTest :
  public virtual ::CORBA::Object,
  public virtual omniObjRef
{
public:
  ::CORBA::Any* EchoString(const ::CORBA::Any& inStr);
  DMSAny* GetDMSAny(const DMSAny& daIO);
  DMStruct GetDMStruct(const DMStruct& dsIn);

  inline _objref_ORBTest()  { _PR_setobj(0); }  // nil
  _objref_ORBTest(omniIOR*, omniIdentity*);

protected:
  virtual ~_objref_ORBTest();

  
private:
  virtual void* _ptrToObjRef(const char*);

  _objref_ORBTest(const _objref_ORBTest&);
  _objref_ORBTest& operator = (const _objref_ORBTest&);
  // not implemented

  friend class ORBTest;
};

class _pof_ORBTest : public _OMNI_NS(proxyObjectFactory) {
public:
  inline _pof_ORBTest() : _OMNI_NS(proxyObjectFactory)(ORBTest::_PD_repoId) {}
  virtual ~_pof_ORBTest();

  virtual omniObjRef* newObjRef(omniIOR*,omniIdentity*);
  virtual _CORBA_Boolean is_a(const char*) const;
};

class _impl_ORBTest :
  public virtual omniServant
{
public:
  virtual ~_impl_ORBTest();

  virtual ::CORBA::Any* EchoString(const ::CORBA::Any& inStr) = 0;
  virtual DMSAny* GetDMSAny(const DMSAny& daIO) = 0;
  virtual DMStruct GetDMStruct(const DMStruct& dsIn) = 0;
  
public:  // Really protected, workaround for xlC
  virtual _CORBA_Boolean _dispatch(omniCallHandle&);

private:
  virtual void* _ptrToInterface(const char*);
  virtual const char* _mostDerivedRepoId();
  
};


_CORBA_GLOBAL_VAR _dyn_attr const ::CORBA::TypeCode_ptr _tc_ORBTest;



class POA_ORBTest :
  public virtual _impl_ORBTest,
  public virtual ::PortableServer::ServantBase
{
public:
  virtual ~POA_ORBTest();

  inline ::ORBTest_ptr _this() {
    return (::ORBTest_ptr) _do_this(::ORBTest::_PD_repoId);
  }
};







#undef _core_attr
#undef _dyn_attr

extern void operator<<=(::CORBA::Any& _a, const DMStruct& _s);
extern void operator<<=(::CORBA::Any& _a, DMStruct* _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, DMStruct*& _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const DMStruct*& _sp);

extern void operator<<=(::CORBA::Any& _a, const DMSAny& _s);
extern void operator<<=(::CORBA::Any& _a, DMSAny* _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, DMSAny*& _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const DMSAny*& _sp);

extern void operator<<=(::CORBA::Any& _a, const DMSmallStruct& _s);
extern void operator<<=(::CORBA::Any& _a, DMSmallStruct* _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, DMSmallStruct*& _sp);
extern _CORBA_Boolean operator>>=(const ::CORBA::Any& _a, const DMSmallStruct*& _sp);

void operator<<=(::CORBA::Any& _a, ORBTest_ptr _s);
void operator<<=(::CORBA::Any& _a, ORBTest_ptr* _s);
_CORBA_Boolean operator>>=(const ::CORBA::Any& _a, ORBTest_ptr& _s);



inline void
ORBTest::_marshalObjRef(::ORBTest_ptr obj, cdrStream& s) {
  omniObjRef::_marshal(obj->_PR_getobj(),s);
}




#ifdef   USE_stub_in_nt_dll_NOT_DEFINED_ORBTest
# undef  USE_stub_in_nt_dll
# undef  USE_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif
#ifdef   USE_core_stub_in_nt_dll_NOT_DEFINED_ORBTest
# undef  USE_core_stub_in_nt_dll
# undef  USE_core_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif
#ifdef   USE_dyn_stub_in_nt_dll_NOT_DEFINED_ORBTest
# undef  USE_dyn_stub_in_nt_dll
# undef  USE_dyn_stub_in_nt_dll_NOT_DEFINED_ORBTest
#endif

#endif  // __ORBTest_hh__

-------------- next part --------------
// This file is generated by omniidl (C++ backend)- omniORB_4_1. Do not edit.

#include "ORBTest.h"
#include <omniORB4/IOP_S.h>
#include <omniORB4/IOP_C.h>
#include <omniORB4/callDescriptor.h>
#include <omniORB4/callHandle.h>
#include <omniORB4/objTracker.h>


OMNI_USING_NAMESPACE(omni)

static const char* _0RL_library_version = omniORB_4_1;



void
DMStruct::operator>>= (cdrStream &_n) const
{
  if (! _n.marshal_byte_swap()) {
    _n.put_octet_array((_CORBA_Octet*)(l),507596,omni::ALIGN_4);
  }
  else 
  {
    _n.declareArrayLength(omni::ALIGN_4, 507596);
    for (_CORBA_ULong _0i0 = 0; _0i0 < 126899; _0i0++){
      l[_0i0] >>= _n;
    }
  }
  if (! _n.marshal_byte_swap()) {
    _n.put_octet_array((_CORBA_Octet*)(s),200,omni::ALIGN_2);
  }
  else 
  {
    _n.declareArrayLength(omni::ALIGN_2, 200);
    for (_CORBA_ULong _0i0 = 0; _0i0 < 100; _0i0++){
      s[_0i0] >>= _n;
    }
  }

}

void
DMStruct::operator<<= (cdrStream &_n)
{
  _n.unmarshalArrayLong((_CORBA_Long*)(l), 126899);
  _n.unmarshalArrayShort((_CORBA_Short*)(s), 100);

}

void
DMSAny::operator>>= (cdrStream &_n) const
{
  (const ::CORBA::Any&) stru1 >>= _n;
  {
    for (_CORBA_ULong _0i0 = 0; _0i0 < 15; _0i0++){
      (const ::CORBA::Any&) a[_0i0] >>= _n;
    }
  }

}

void
DMSAny::operator<<= (cdrStream &_n)
{
  (::CORBA::Any&)stru1 <<= _n;
  {
    for (_CORBA_ULong _0i0 = 0; _0i0 < 15; _0i0++){
      (::CORBA::Any&)a[_0i0] <<= _n;
    }
  }

}

void
DMSmallStruct::operator>>= (cdrStream &_n) const
{
  if (! _n.marshal_byte_swap()) {
    _n.put_octet_array((_CORBA_Octet*)(l),80,omni::ALIGN_4);
  }
  else 
  {
    _n.declareArrayLength(omni::ALIGN_4, 80);
    for (_CORBA_ULong _0i0 = 0; _0i0 < 20; _0i0++){
      l[_0i0] >>= _n;
    }
  }
  if (! _n.marshal_byte_swap()) {
    _n.put_octet_array((_CORBA_Octet*)(s),40,omni::ALIGN_2);
  }
  else 
  {
    _n.declareArrayLength(omni::ALIGN_2, 40);
    for (_CORBA_ULong _0i0 = 0; _0i0 < 20; _0i0++){
      s[_0i0] >>= _n;
    }
  }

}

void
DMSmallStruct::operator<<= (cdrStream &_n)
{
  _n.unmarshalArrayLong((_CORBA_Long*)(l), 20);
  _n.unmarshalArrayShort((_CORBA_Short*)(s), 20);

}

ORBTest_ptr ORBTest_Helper::_nil() {
  return ::ORBTest::_nil();
}

::CORBA::Boolean ORBTest_Helper::is_nil(::ORBTest_ptr p) {
  return ::CORBA::is_nil(p);

}

void ORBTest_Helper::release(::ORBTest_ptr p) {
  ::CORBA::release(p);
}

void ORBTest_Helper::marshalObjRef(::ORBTest_ptr obj, cdrStream& s) {
  ::ORBTest::_marshalObjRef(obj, s);
}

ORBTest_ptr ORBTest_Helper::unmarshalObjRef(cdrStream& s) {
  return ::ORBTest::_unmarshalObjRef(s);
}

void ORBTest_Helper::duplicate(::ORBTest_ptr obj) {
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);
}

ORBTest_ptr
ORBTest::_duplicate(::ORBTest_ptr obj)
{
  if( obj && !obj->_NP_is_nil() )  omni::duplicateObjRef(obj);
  return obj;
}

ORBTest_ptr
ORBTest::_narrow(::CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil();
  _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId);
  return e ? e : _nil();
}


ORBTest_ptr
ORBTest::_unchecked_narrow(::CORBA::Object_ptr obj)
{
  if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil();
  _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId);
  return e ? e : _nil();
}

ORBTest_ptr
ORBTest::_nil()
{
#ifdef OMNI_UNLOADABLE_STUBS
  static _objref_ORBTest _the_nil_obj;
  return &_the_nil_obj;
#else
  static _objref_ORBTest* _the_nil_ptr = 0;
  if( !_the_nil_ptr ) {
    omni::nilRefLock().lock();
    if( !_the_nil_ptr ) {
      _the_nil_ptr = new _objref_ORBTest;
      registerNilCorbaObject(_the_nil_ptr);
    }
    omni::nilRefLock().unlock();
  }
  return _the_nil_ptr;
#endif
}

const char* ORBTest::_PD_repoId = "IDL:ORBTest:1.0";


_objref_ORBTest::~_objref_ORBTest() {
  
}


_objref_ORBTest::_objref_ORBTest(omniIOR* ior, omniIdentity* id) :
   omniObjRef(::ORBTest::_PD_repoId, ior, id, 1)
   
   
{
  _PR_setobj(this);
}

void*
_objref_ORBTest::_ptrToObjRef(const char* id)
{
  if( id == ::ORBTest::_PD_repoId )
    return (::ORBTest_ptr) this;
  
  if( id == ::CORBA::Object::_PD_repoId )
    return (::CORBA::Object_ptr) this;

  if( omni::strMatch(id, ::ORBTest::_PD_repoId) )
    return (::ORBTest_ptr) this;
  
  if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) )
    return (::CORBA::Object_ptr) this;

  return 0;
}

// Proxy call descriptor class. Mangled signature:
//  _cany_i_cany
class _0RL_cd_807139A061C8111D_00000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_807139A061C8111D_00000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0):
     omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall)
  {
    
  }
  
  void marshalArguments(cdrStream&);
  void unmarshalArguments(cdrStream&);

  void unmarshalReturnedValues(cdrStream&);
  void marshalReturnedValues(cdrStream&);
  
  
  ::CORBA::Any_var arg_0_;
  const ::CORBA::Any* arg_0;
  ::CORBA::Any_var result;
};

void _0RL_cd_807139A061C8111D_00000000::marshalArguments(cdrStream& _n)
{
  (const ::CORBA::Any&) *arg_0 >>= _n;

}

void _0RL_cd_807139A061C8111D_00000000::unmarshalArguments(cdrStream& _n)
{
  arg_0_ = new ::CORBA::Any;
  (::CORBA::Any&)arg_0_ <<= _n;
  arg_0 = &arg_0_.in();

}

void _0RL_cd_807139A061C8111D_00000000::marshalReturnedValues(cdrStream& _n)
{
  (const ::CORBA::Any&) result >>= _n;

}

void _0RL_cd_807139A061C8111D_00000000::unmarshalReturnedValues(cdrStream& _n)
{
  result = new ::CORBA::Any;
  (::CORBA::Any&)result <<= _n;

}

// Local call call-back function.
static void
_0RL_lcfn_807139A061C8111D_10000000(omniCallDescriptor* cd, omniServant* svnt)
{
  _0RL_cd_807139A061C8111D_00000000* tcd = (_0RL_cd_807139A061C8111D_00000000*)cd;
  _impl_ORBTest* impl = (_impl_ORBTest*) svnt->_ptrToInterface(ORBTest::_PD_repoId);
  tcd->result = impl->EchoString(*tcd->arg_0);


}

::CORBA::Any* _objref_ORBTest::EchoString(const ::CORBA::Any& inStr)
{
  _0RL_cd_807139A061C8111D_00000000 _call_desc(_0RL_lcfn_807139A061C8111D_10000000, "EchoString", 11);
  _call_desc.arg_0 = &(::CORBA::Any&) inStr;

  _invoke(_call_desc);
  return _call_desc.result._retn();


}
// Proxy call descriptor class. Mangled signature:
//  _cDMSAny_i_cDMSAny
class _0RL_cd_807139A061C8111D_20000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_807139A061C8111D_20000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0):
     omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall)
  {
    
  }
  
  void marshalArguments(cdrStream&);
  void unmarshalArguments(cdrStream&);

  void unmarshalReturnedValues(cdrStream&);
  void marshalReturnedValues(cdrStream&);
  
  
  DMSAny_var arg_0_;
  const DMSAny* arg_0;
  DMSAny_var result;
};

void _0RL_cd_807139A061C8111D_20000000::marshalArguments(cdrStream& _n)
{
  (const DMSAny&) *arg_0 >>= _n;

}

void _0RL_cd_807139A061C8111D_20000000::unmarshalArguments(cdrStream& _n)
{
  arg_0_ = new DMSAny;
  (DMSAny&)arg_0_ <<= _n;
  arg_0 = &arg_0_.in();

}

void _0RL_cd_807139A061C8111D_20000000::marshalReturnedValues(cdrStream& _n)
{
  (const DMSAny&) result >>= _n;

}

void _0RL_cd_807139A061C8111D_20000000::unmarshalReturnedValues(cdrStream& _n)
{
  result = new DMSAny;
  (DMSAny&)result <<= _n;

}

// Local call call-back function.
static void
_0RL_lcfn_807139A061C8111D_30000000(omniCallDescriptor* cd, omniServant* svnt)
{
  _0RL_cd_807139A061C8111D_20000000* tcd = (_0RL_cd_807139A061C8111D_20000000*)cd;
  _impl_ORBTest* impl = (_impl_ORBTest*) svnt->_ptrToInterface(ORBTest::_PD_repoId);
  tcd->result = impl->GetDMSAny(*tcd->arg_0);


}

DMSAny* _objref_ORBTest::GetDMSAny(const DMSAny& daIO)
{
  _0RL_cd_807139A061C8111D_20000000 _call_desc(_0RL_lcfn_807139A061C8111D_30000000, "GetDMSAny", 10);
  _call_desc.arg_0 = &(DMSAny&) daIO;

  _invoke(_call_desc);
  return _call_desc.result._retn();


}
// Proxy call descriptor class. Mangled signature:
//  _cDMStruct_i_cDMStruct
class _0RL_cd_807139A061C8111D_40000000
  : public omniCallDescriptor
{
public:
  inline _0RL_cd_807139A061C8111D_40000000(LocalCallFn lcfn,const char* op_,size_t oplen,_CORBA_Boolean upcall=0):
     omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall)
  {
    
  }
  
  void marshalArguments(cdrStream&);
  void unmarshalArguments(cdrStream&);

  void unmarshalReturnedValues(cdrStream&);
  void marshalReturnedValues(cdrStream&);
  
  
  DMStruct arg_0_;
  const DMStruct* arg_0;
  DMStruct result;
};

void _0RL_cd_807139A061C8111D_40000000::marshalArguments(cdrStream& _n)
{
  (const DMStruct&) *arg_0 >>= _n;

}

void _0RL_cd_807139A061C8111D_40000000::unmarshalArguments(cdrStream& _n)
{
  (DMStruct&)arg_0_ <<= _n;
  arg_0 = &arg_0_;

}

void _0RL_cd_807139A061C8111D_40000000::marshalReturnedValues(cdrStream& _n)
{
  (const DMStruct&) result >>= _n;

}

void _0RL_cd_807139A061C8111D_40000000::unmarshalReturnedValues(cdrStream& _n)
{
  (DMStruct&)result <<= _n;

}

// Local call call-back function.
static void
_0RL_lcfn_807139A061C8111D_50000000(omniCallDescriptor* cd, omniServant* svnt)
{
  _0RL_cd_807139A061C8111D_40000000* tcd = (_0RL_cd_807139A061C8111D_40000000*)cd;
  _impl_ORBTest* impl = (_impl_ORBTest*) svnt->_ptrToInterface(ORBTest::_PD_repoId);
  tcd->result = impl->GetDMStruct(*tcd->arg_0);


}

DMStruct _objref_ORBTest::GetDMStruct(const DMStruct& dsIn)
{
  _0RL_cd_807139A061C8111D_40000000 _call_desc(_0RL_lcfn_807139A061C8111D_50000000, "GetDMStruct", 12);
  _call_desc.arg_0 = &(DMStruct&) dsIn;

  _invoke(_call_desc);
  return _call_desc.result;


}
_pof_ORBTest::~_pof_ORBTest() {}


omniObjRef*
_pof_ORBTest::newObjRef(omniIOR* ior, omniIdentity* id)
{
  return new ::_objref_ORBTest(ior, id);
}


::CORBA::Boolean
_pof_ORBTest::is_a(const char* id) const
{
  if( omni::ptrStrMatch(id, ::ORBTest::_PD_repoId) )
    return 1;
  
  return 0;
}

const _pof_ORBTest _the_pof_ORBTest;

_impl_ORBTest::~_impl_ORBTest() {}


::CORBA::Boolean
_impl_ORBTest::_dispatch(omniCallHandle& _handle)
{
  const char* op = _handle.operation_name();

  if( omni::strMatch(op, "EchoString") ) {

    _0RL_cd_807139A061C8111D_00000000 _call_desc(_0RL_lcfn_807139A061C8111D_10000000, "EchoString", 11, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "GetDMSAny") ) {

    _0RL_cd_807139A061C8111D_20000000 _call_desc(_0RL_lcfn_807139A061C8111D_30000000, "GetDMSAny", 10, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }

  if( omni::strMatch(op, "GetDMStruct") ) {

    _0RL_cd_807139A061C8111D_40000000 _call_desc(_0RL_lcfn_807139A061C8111D_50000000, "GetDMStruct", 12, 1);
    
    _handle.upcall(this,_call_desc);
    return 1;
  }


  return 0;
}

void*
_impl_ORBTest::_ptrToInterface(const char* id)
{
  if( id == ::ORBTest::_PD_repoId )
    return (::_impl_ORBTest*) this;
  
  if( id == ::CORBA::Object::_PD_repoId )
    return (void*) 1;

  if( omni::strMatch(id, ::ORBTest::_PD_repoId) )
    return (::_impl_ORBTest*) this;
  
  if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) )
    return (void*) 1;
  return 0;
}

const char*
_impl_ORBTest::_mostDerivedRepoId()
{
  return ::ORBTest::_PD_repoId;
}

POA_ORBTest::~POA_ORBTest() {}

-------------- next part --------------
// This file is generated by omniidl (C++ backend) - omniORB_4_1. Do not edit.

#include "ORBTest.h"

OMNI_USING_NAMESPACE(omni)

static const char* _0RL_dyn_library_version = omniORB_4_1_dyn;

static ::CORBA::TypeCode::_Tracker _0RL_tcTrack(__FILE__);

static CORBA::PR_structMember _0RL_structmember_DMStruct[] = {
  {"l", CORBA::TypeCode::PR_array_tc(126899, CORBA::TypeCode::PR_long_tc(), &_0RL_tcTrack)},
  {"s", CORBA::TypeCode::PR_array_tc(100, CORBA::TypeCode::PR_short_tc(), &_0RL_tcTrack)}
};

#ifdef _0RL_tc_DMStruct
#  undef _0RL_tc_DMStruct
#endif
static CORBA::TypeCode_ptr _0RL_tc_DMStruct = CORBA::TypeCode::PR_struct_tc("IDL:DMStruct:1.0", "DMStruct", _0RL_structmember_DMStruct, 2, &_0RL_tcTrack);

const CORBA::TypeCode_ptr _tc_DMStruct = _0RL_tc_DMStruct;


static CORBA::PR_structMember _0RL_structmember_DMSAny[] = {
  {"stru1", CORBA::TypeCode::PR_any_tc()},
  {"a", CORBA::TypeCode::PR_array_tc(15, CORBA::TypeCode::PR_any_tc(), &_0RL_tcTrack)}
};

#ifdef _0RL_tc_DMSAny
#  undef _0RL_tc_DMSAny
#endif
static CORBA::TypeCode_ptr _0RL_tc_DMSAny = CORBA::TypeCode::PR_struct_tc("IDL:DMSAny:1.0", "DMSAny", _0RL_structmember_DMSAny, 2, &_0RL_tcTrack);

const CORBA::TypeCode_ptr _tc_DMSAny = _0RL_tc_DMSAny;


static CORBA::PR_structMember _0RL_structmember_DMSmallStruct[] = {
  {"l", CORBA::TypeCode::PR_array_tc(20, CORBA::TypeCode::PR_long_tc(), &_0RL_tcTrack)},
  {"s", CORBA::TypeCode::PR_array_tc(20, CORBA::TypeCode::PR_short_tc(), &_0RL_tcTrack)}
};

#ifdef _0RL_tc_DMSmallStruct
#  undef _0RL_tc_DMSmallStruct
#endif
static CORBA::TypeCode_ptr _0RL_tc_DMSmallStruct = CORBA::TypeCode::PR_struct_tc("IDL:DMSmallStruct:1.0", "DMSmallStruct", _0RL_structmember_DMSmallStruct, 2, &_0RL_tcTrack);

const CORBA::TypeCode_ptr _tc_DMSmallStruct = _0RL_tc_DMSmallStruct;


const CORBA::TypeCode_ptr _tc_ORBTest = CORBA::TypeCode::PR_interface_tc("IDL:ORBTest:1.0", "ORBTest", &_0RL_tcTrack);

static void _0RL_DMStruct_marshal_fn(cdrStream& _s, void* _v)
{
  DMStruct* _p = (DMStruct*)_v;
  *_p >>= _s;
}
static void _0RL_DMStruct_unmarshal_fn(cdrStream& _s, void*& _v)
{
  DMStruct* _p = new DMStruct;
  *_p <<= _s;
  _v = _p;
}
static void _0RL_DMStruct_destructor_fn(void* _v)
{
  DMStruct* _p = (DMStruct*)_v;
  delete _p;
}

void operator<<=(::CORBA::Any& _a, const DMStruct& _s)
{
  DMStruct* _p = new DMStruct(_s);
  _a.PR_insert(_0RL_tc_DMStruct,
               _0RL_DMStruct_marshal_fn,
               _0RL_DMStruct_destructor_fn,
               _p);
}
void operator<<=(::CORBA::Any& _a, DMStruct* _sp)
{
  _a.PR_insert(_0RL_tc_DMStruct,
               _0RL_DMStruct_marshal_fn,
               _0RL_DMStruct_destructor_fn,
               _sp);
}

::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, DMStruct*& _sp)
{
  return _a >>= (const DMStruct*&) _sp;
}
::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, const DMStruct*& _sp)
{
  void* _v;
  if (_a.PR_extract(_0RL_tc_DMStruct,
                    _0RL_DMStruct_unmarshal_fn,
                    _0RL_DMStruct_marshal_fn,
                    _0RL_DMStruct_destructor_fn,
                    _v)) {
    _sp = (const DMStruct*)_v;
    return 1;
  }
  return 0;
}

static void _0RL_DMSAny_marshal_fn(cdrStream& _s, void* _v)
{
  DMSAny* _p = (DMSAny*)_v;
  *_p >>= _s;
}
static void _0RL_DMSAny_unmarshal_fn(cdrStream& _s, void*& _v)
{
  DMSAny* _p = new DMSAny;
  *_p <<= _s;
  _v = _p;
}
static void _0RL_DMSAny_destructor_fn(void* _v)
{
  DMSAny* _p = (DMSAny*)_v;
  delete _p;
}

void operator<<=(::CORBA::Any& _a, const DMSAny& _s)
{
  DMSAny* _p = new DMSAny(_s);
  _a.PR_insert(_0RL_tc_DMSAny,
               _0RL_DMSAny_marshal_fn,
               _0RL_DMSAny_destructor_fn,
               _p);
}
void operator<<=(::CORBA::Any& _a, DMSAny* _sp)
{
  _a.PR_insert(_0RL_tc_DMSAny,
               _0RL_DMSAny_marshal_fn,
               _0RL_DMSAny_destructor_fn,
               _sp);
}

::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, DMSAny*& _sp)
{
  return _a >>= (const DMSAny*&) _sp;
}
::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, const DMSAny*& _sp)
{
  void* _v;
  if (_a.PR_extract(_0RL_tc_DMSAny,
                    _0RL_DMSAny_unmarshal_fn,
                    _0RL_DMSAny_marshal_fn,
                    _0RL_DMSAny_destructor_fn,
                    _v)) {
    _sp = (const DMSAny*)_v;
    return 1;
  }
  return 0;
}

static void _0RL_DMSmallStruct_marshal_fn(cdrStream& _s, void* _v)
{
  DMSmallStruct* _p = (DMSmallStruct*)_v;
  *_p >>= _s;
}
static void _0RL_DMSmallStruct_unmarshal_fn(cdrStream& _s, void*& _v)
{
  DMSmallStruct* _p = new DMSmallStruct;
  *_p <<= _s;
  _v = _p;
}
static void _0RL_DMSmallStruct_destructor_fn(void* _v)
{
  DMSmallStruct* _p = (DMSmallStruct*)_v;
  delete _p;
}

void operator<<=(::CORBA::Any& _a, const DMSmallStruct& _s)
{
  DMSmallStruct* _p = new DMSmallStruct(_s);
  _a.PR_insert(_0RL_tc_DMSmallStruct,
               _0RL_DMSmallStruct_marshal_fn,
               _0RL_DMSmallStruct_destructor_fn,
               _p);
}
void operator<<=(::CORBA::Any& _a, DMSmallStruct* _sp)
{
  _a.PR_insert(_0RL_tc_DMSmallStruct,
               _0RL_DMSmallStruct_marshal_fn,
               _0RL_DMSmallStruct_destructor_fn,
               _sp);
}

::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, DMSmallStruct*& _sp)
{
  return _a >>= (const DMSmallStruct*&) _sp;
}
::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, const DMSmallStruct*& _sp)
{
  void* _v;
  if (_a.PR_extract(_0RL_tc_DMSmallStruct,
                    _0RL_DMSmallStruct_unmarshal_fn,
                    _0RL_DMSmallStruct_marshal_fn,
                    _0RL_DMSmallStruct_destructor_fn,
                    _v)) {
    _sp = (const DMSmallStruct*)_v;
    return 1;
  }
  return 0;
}

static void _0RL_ORBTest_marshal_fn(cdrStream& _s, void* _v)
{
  omniObjRef* _o = (omniObjRef*)_v;
  omniObjRef::_marshal(_o, _s);
}
static void _0RL_ORBTest_unmarshal_fn(cdrStream& _s, void*& _v)
{
  omniObjRef* _o = omniObjRef::_unMarshal(ORBTest::_PD_repoId, _s);
  _v = _o;
}
static void _0RL_ORBTest_destructor_fn(void* _v)
{
  omniObjRef* _o = (omniObjRef*)_v;
  if (_o)
    omni::releaseObjRef(_o);
}

void operator<<=(::CORBA::Any& _a, ORBTest_ptr _o)
{
  ORBTest_ptr _no = ORBTest::_duplicate(_o);
  _a.PR_insert(_tc_ORBTest,
               _0RL_ORBTest_marshal_fn,
               _0RL_ORBTest_destructor_fn,
               _no->_PR_getobj());
}
void operator<<=(::CORBA::Any& _a, ORBTest_ptr* _op)
{
  _a.PR_insert(_tc_ORBTest,
               _0RL_ORBTest_marshal_fn,
               _0RL_ORBTest_destructor_fn,
               (*_op)->_PR_getobj());
  *_op = ORBTest::_nil();
}

::CORBA::Boolean operator>>=(const ::CORBA::Any& _a, ORBTest_ptr& _o)
{
  void* _v;
  if (_a.PR_extract(_tc_ORBTest,
                    _0RL_ORBTest_unmarshal_fn,
                    _0RL_ORBTest_marshal_fn,
                    _0RL_ORBTest_destructor_fn,
                    _v)) {
    omniObjRef* _r = (omniObjRef*)_v;
    if (_r)
      _o = (ORBTest_ptr)_r->_ptrToObjRef(ORBTest::_PD_repoId);
    else
      _o = ORBTest::_nil();
    return 1;
  }
  return 0;
}

-------------- next part --------------
// eg2_impl.cc - This is the source code of example 2 used in Chapter 2
//               "The Basics" of the omniORB user guide.
//
//               This is the object implementation.
//
// Usage: eg2_impl
//
//        On startup, the object reference is printed to cerr as a
//        stringified IOR. This string should be used as the argument to 
//        eg2_clt.
//

#include <iostream>
#include <stdio.h>
#include "ORBTest.h"

using namespace std;

class ORBTest_i : public POA_ORBTest,
	       public PortableServer::RefCountServantBase
{
public:
  inline ORBTest_i() {}
  virtual ~ORBTest_i() {}
//  virtual char* echoString(const char* mesg);
  virtual CORBA::Any* EchoString(const CORBA::Any & inStr);
  virtual DMSAny* GetDMSAny(const DMSAny& daIO);
  //virtual DMStruct GetDMStruct(const DMStruct& dsIn) {};
  virtual DMStruct GetDMStruct(const DMStruct& dsIn);
};


CORBA::Any* ORBTest_i::EchoString(const CORBA::Any & inStr)
{
	//long l;
	//DMStruct *l = new DMStruct;
	//inStr >>= l;
  CORBA::Any * ret = new CORBA::Any(inStr);
	//*ret <<= l;
  return ret;
}

DMSAny* ORBTest_i::GetDMSAny(const DMSAny& daIO)
{
	DMSAny * ret = new DMSAny;
//	*ret = daIO;
	
	DMSmallStruct * dEstruct = new DMSmallStruct;
	for (CORBA::Long i=0; i<20; i++) { dEstruct->l[i] = long(12345678); }
	for (CORBA::Long i=0; i<20; i++) { dEstruct->s[i] = short(1234); }

	CORBA::Any aTmp;
	aTmp <<= dEstruct;
	for (CORBA::Long i=0; i<15; i++) { ret->a[i] = aTmp; }
	
	return ret;
}

DMStruct ORBTest_i::GetDMStruct(const DMStruct& dsIn){	//just for debug, not valid

	DMStruct * ret = new DMStruct;

	return *ret;
	
}

//////////////////////////////////////////////////////////////////////

int main(int argc, char** argv)
{
  try {
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);

    ORBTest_i* myecho = new ORBTest_i();
      
    PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);

    // Obtain a reference to the object, and print it out as a
    // stringified IOR.
    obj = myecho->_this();
    CORBA::String_var sior(orb->object_to_string(obj));
    cerr << "'" << (char*)sior << "'" << endl;

    myecho->_remove_ref();

    PortableServer::POAManager_var pman = poa->the_POAManager();
    pman->activate();

    orb->run();
  }
  catch(CORBA::COMM_FAILURE& ex) {
    cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
         << "object." << endl;
  }
  catch(CORBA::SystemException&) {
    cerr << "Caught CORBA::SystemException." << endl;
  }
  catch(CORBA::Exception&) {
    cerr << "Caught CORBA::Exception." << endl;
  }
  catch(omniORB::fatalException& fe) {
    cerr << "Caught omniORB::fatalException:" << endl;
    cerr << "  file: " << fe.file() << endl;
    cerr << "  line: " << fe.line() << endl;
    cerr << "  mesg: " << fe.errmsg() << endl;
  }
  catch(...) {
    cerr << "Caught unknown exception." << endl;
  }

  return 0;

	
/*
  try {
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);

    ORBTest_i* myorb = new ORBTest_i();
      
    PortableServer::ObjectId_var myechoid = poa->activate_object(myorb);

    // Obtain a reference to the object, and print it out as a
    // stringified IOR.
    obj = myorb->_this();
    CORBA::String_var sior(orb->object_to_string(obj));
    cerr << "'" << (char*)sior << "'" << endl;

    myorb->_remove_ref();

    PortableServer::POAManager_var pman = poa->the_POAManager();
    pman->activate();

    orb->run();
  }
  catch(CORBA::SystemException&) {
    cerr << "Caught CORBA::SystemException." << endl;
  }
  catch(CORBA::Exception&) {
    cerr << "Caught CORBA::Exception." << endl;
  }
  catch(omniORB::fatalException& fe) {
    cerr << "Caught omniORB::fatalException:" << endl;
    cerr << "  file: " << fe.file() << endl;
    cerr << "  line: " << fe.line() << endl;
    cerr << "  mesg: " << fe.errmsg() << endl;
  }
  catch(...) {
    cerr << "Caught unknown exception." << endl;
  }

  return 0;
*/
}
-------------- next part --------------
// eg2_clt.cc - This is the source code of example 2 used in Chapter 2
//              "The Basics" of the omniORB user guide.
//
//              This is the client. The object reference is given as a
//              stringified IOR on the command line.
//
// Usage: eg2_clt <object reference>
//

#include <iostream>
#include "ORBTest.h"


//#include "sys/time.h"
#include "time.h"

using namespace std;

//////////////////////////////////////////////////////////////////////

// This function acts as a client to the object.

static void hello(ORBTest_ptr e)
{
	int min, sec, msec;

	#ifdef __WIN32__
 	 SYSTEMTIME time;
	#endif
	#ifdef __unix__
	 struct timeval tv;
	 struct timezone tz;
	#endif

  if( CORBA::is_nil(e) ) {
    cerr << "hello: The object reference is nil!\n" << endl;
    return;
  }

  CORBA::String_var src = (const char*) "Hello!";
  CORBA::String_var sDest; 
  CORBA::Any aSrc;


//  aSrc <<= long(55);
  // String literals are (char*) rather than (const char*) on some
  // old compilers.  Thus it is essential to cast to (const char*)
  // here to ensure that the string is copied, so that the
  // CORBA::String_var does not attempt to 'delete' the string
  // literal.

		DMStruct *dEstruct = new DMStruct;
		const DMStruct * dOut;
		for (CORBA::Long i=0; i<126899; i++) { dEstruct->l[i] = long(12345678); }
		for (CORBA::Long i=0; i<1; i++) { dEstruct->s[i] = short(1234); }
				
		aSrc <<= dEstruct;

	// Write current time
	//gettimeofday(&tv, &tz);
	//cout << "sec: " << tv.tv_sec << "    usec:" << tv.tv_usec << endl;
	
	#ifdef __WIN32__
    GetSystemTime(&time);
    min = time.wMinute;
    sec = time.wSecond;
    msec = time.wMilliseconds;
	#endif
	#ifdef __unix__
	gettimeofday(&tv, &tz);
	min = (tv.tv_sec / 60) % 60;
	sec = tv.tv_sec % 60;
	msec = tv.tv_usec / 1000;
	#endif

	cerr<<"min: "<<min<<" sec: "<<sec<<" msec: "<<msec<<endl;

	cout <<"One struct test" << endl;
//	for (int i=0; i<200; i++)		
//	{		


			CORBA::Any * dest = e->EchoString( aSrc );
			*dest >>= dOut;
			
//	}

	// Write current time
	//gettimeofday(&tv, &tz);
	//cout << "sec: " << tv.tv_sec << "    usec:" << tv.tv_usec << endl;

	#ifdef __WIN32__
    GetSystemTime(&time);
    min = time.wMinute;
    sec = time.wSecond;
    msec = time.wMilliseconds;
	#endif
	#ifdef __unix__
	gettimeofday(&tv, &tz);
	min = (tv.tv_sec / 60) % 60;
	sec = tv.tv_sec % 60;
	msec = tv.tv_usec / 1000;
	#endif

	cerr<<"min: "<<min<<" sec: "<<sec<<" msec: "<<msec<<endl;

	cout << "small Any struct test" << endl;
//	for (long i=0; i<2000; i++)	
//	{

		DMSAny * tata = new DMSAny;
		DMSmallStruct * dSmall = new DMSmallStruct;

		dSmall->l[0] = 2;

		aSrc <<= dSmall;

		tata->stru1 = aSrc;
		for (int i=0; i<15; i++) tata->a[i] = aSrc;

		const DMSAny * daOut = new DMSAny;
		daOut = e->GetDMSAny( *tata );
		
//	}

	// Write current time
	//gettimeofday(&tv, &tz);
	//cout << "sec: " << tv.tv_sec << "    usec:" << tv.tv_usec << endl;

	#ifdef __WIN32__
    GetSystemTime(&time);
    min = time.wMinute;
    sec = time.wSecond;
    msec = time.wMilliseconds;
	#endif
	#ifdef __unix__
	gettimeofday(&tv, &tz);
	min = (tv.tv_sec / 60) % 60;
	sec = tv.tv_sec % 60;
	msec = tv.tv_usec / 1000;
	#endif

	cerr<<"min: "<<min<<" sec: "<<sec<<" msec: "<<msec<<endl;

}

//////////////////////////////////////////////////////////////////////

int main(int argc, char** argv)
{


  try {
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

    if( argc != 2 ) {
      cerr << "usage:  OT_klijent1 <object reference>" << endl;
      return 1;
    }


    CORBA::Object_var obj = orb->string_to_object(argv[1]);
    ORBTest_var echoref = ORBTest::_narrow(obj);
    if( CORBA::is_nil(echoref) ) {
      cerr << "Can't narrow reference to type Echo (or it was nil)." << endl;
      return 1;
    }
//    for (CORBA::ULong count=0; count<10; count++) 
      hello(echoref);

    orb->destroy();
  }
  catch(CORBA::COMM_FAILURE& ex) {
    cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
         << "object." << endl;
  }
  catch(CORBA::SystemException&) {
    cerr << "Caught a CORBA::SystemException." << endl;
  }
  catch(CORBA::Exception&) {
    cerr << "Caught CORBA::Exception." << endl;
  }
  catch(omniORB::fatalException& fe) {
    cerr << "Caught omniORB::fatalException:" << endl;
    cerr << "  file: " << fe.file() << endl;
    cerr << "  line: " << fe.line() << endl;
    cerr << "  mesg: " << fe.errmsg() << endl;
  }
  catch(...) {
    cerr << "Caught unknown exception." << endl;
  }
  return 0;
}


More information about the omniORB-list mailing list