[omniORB] Fixed structs are returned by value, variable structs by pointer?

Alexander Georgiev alexander.georgiev at gmail.com
Fri Oct 15 10:55:35 BST 2004


Hi,
I noticed that if I have defined in idl a fixed length structure and a
var length structure
and an interface with 2 methods returning instances of these structures:

________________________________________________ idl file
    typedef double DoubleArray[1024];

    // example of a fixed size struct
    struct FixedStruct {
      //  string message;
        long number;
        DoubleArray dblArray;
    };
    // example of a var length struct
    struct VariableStruct {
        long number;
        string message;
        DoubleArray dblArray;
    };

    // dummy interface to return instances of the above structures:
    interface HandShake {
        FixedStruct getFixedStruct();
        VariableStruct getVariableStruct();
    };

___________________________________

the interface methods are mapped differently:

___________________________________ mapped hpp file

  class _objref_HandShake :
    public virtual CORBA::Object, public virtual omniObjRef
  {
  public:

    // here fixed struct returned by value
    FixedStruct getFixedStruct();

    // here a pointer to variable struct is returned???
    VariableStruct* getVariableStruct();

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

  protected:
    virtual ~_objref_HandShake();
    
  private:
    virtual void* _ptrToObjRef(const char*);

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

    friend class HandShake;
  };
___________________________________

Why are not they both returned by value?
is this somehow related with omniORB not supporting value objects?


Kind regards
sasoon



More information about the omniORB-list mailing list