Hallo,
I´m using a client-server model based on Mico and I defined an idl
interface like this:

interface ifRec
{
        long Register( in string name, in string ns );
        void WriteData( in long id, in any data );
        void SetEnv( in string Key, in string Value );
        void Rec();
        void Break();
        void Resume();
        void Replay( in double speed );
        void Stop();
        long Load( in string filename );
};

The WriteData function uses the parameter "data" of type Any, which
represents a structure (struct) containing other structures inside, and I
get a run-time error whenever a client calls this function. The client has
been compiled with Qt and uses the QApplication function. I discovered
that the run-time error it´s based on the problem that the object of type
Any is codified in the wrong way from Mico during the serialization
process only when the QApplication function is used in the client code and
also when the tree´s depth of the structures codified in the Any object is
too big, otherwise no run-time error comes up and the octet sequence that
represents the object, made by the Mico serialization process, has the
correct length. I also discovered that the difference between the octet
sequence with and without using QApplication is fixed and always 268 bytes
(more bytes without QApplication) and it does not depend on the complexity
of the structure that the Any object represents. I discovered this last
detail simulating a serialization process of the Any object using the
available Mico internal codec. I tried to compile the system with the two
Mico versions 2.3.11 and 2.3.13, both versions compiled specifying also the
--with-qt=<qt-path> directive for the configure script, but I have same
problems.

Here is also the Mico codec I used to simulate the serialization process:

void operator>> ( const Any& anyobject, OctetSeq& dataseq)
{
        // Codec
        ORB_var orb;
        Object_var obj;
        IOP::CodecFactory_var cf;
        IOP::Encoding enc2;
        IOP::Codec_ptr codec_ptr;

        // Generate codec based on CodecFactory
        int argc = 1;
        char* argv[1];
        argv[0] = "anyserial";
        orb = ORB_init( argc, argv, "mico-local-orb" );
        obj = orb->resolve_initial_references("CodecFactory");
        cf = IOP::CodecFactory::_narrow(obj);
        enc2.format = IOP::ENCODING_CDR_ENCAPS;
        enc2.major_version = 1;
        enc2.minor_version = 2;
        codec_ptr = cf->create_codec(enc2);

        // Encode anyobject and generate a new octet sequence
        OctetSeq_var newdataseq_ptr = codec_ptr->encode(anyobject);
        int length = newdataseq_ptr->length();

        // Copy generated octet sequence into dataseq
        dataseq.length(length);

        for (int i=0; i<length; i++)
                dataseq[i] = (*newdataseq_ptr)[i];
}

Any and OctetSeq types are exactly CORBA::Any and CORBA::OctetSeq types
defined in MICO.

Could please anyone help to understand why Mico has this strange behavior
and eventually to find a solution?

Many Thanks in advance,
Pasquale Zarcone

Because the mail did not come trough with my colleges account I post
this message on his behalf

Andreas
_______________________________________________
Mico-devel mailing list
Mico-devel@mico.org
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to