[omniORB] Struct initialisation question

Armin Gerritsen a.a.gerritsen@phys.uu.nl
Tue, 21 Mar 2000 14:04:16 +0100


Hello,

It might be a beginners question, but I'm afraid I'm simply looking over the
problem.

I'm used to intialise structs in members like this:

mystruct *result  = NULL ;
result  = new mystruct(1) ;
result->length(1) ;

Works fine.
But now I have in IDL:

 struct OmConStruct
 {
  OmResultType Result    ;
  string       strResult ;
  string       IOR       ;
 } ;

and a function like:

boolean MyFunc( out OmConStruct     ConnectionResult )  raises( Error ) ;

which is transformed on SUN with omniORB 2.80 in:

 struct OmConStruct {
    typedef _CORBA_ConstrType_Variable_Var<OmConStruct> _var_type;
    OmResultType Result;
    CORBA::String_member strResult;
    CORBA::String_member IOR;

    size_t NP_alignedSize(size_t initialoffset) const;
    void operator>>= (NetBufferedStream &) const;
    void operator<<= (NetBufferedStream &);
    void operator>>= (MemBufferedStream &) const;
    void operator<<= (MemBufferedStream &);
  };

and my implementation becomes:

CORBA::Boolean MyObject::MyFunc(  ObjectManager::OmConStruct *&conres)
 {
 ...

Now I want to intialise it:

conres = new ObjectManager::OmConStruct(1) ;
conres->length(1) ;

which gives me:

"omserver.cc", line 58: Error: Could not find a match for
ObjectManager::OmConStruct::OmConStruct(int).
"omserver.cc", line 59: Error: length is not a member of
ObjectManager::OmConStruct.
2 Error(s) detected.
make: *** [omserver.o] Error 2

How should I then intialise the object corectly?
And is this related to the NP_alignedSize member?

Best regards,

Armin Gerritsen