[omniORB] omniORB sequence implementation

Thomas Amsler tpamsler@ucdavis.edu
Thu, 10 May 2001 16:35:24 -0700


I have a question about the omniORB idl to C++ mapping for sequences.
For example I have the following definition in a file called
ClassServer.idl:


module RCT {


    interface ClassServer {

        typedef sequence<Class> ClassSeq;

        ClassSeq getClassesForUser(in string user);
    };
};

Then one of the generated stub file, ClassServer.hh, contains a lot of "inline" methods for ClassSeq.

eg.

inline ClassSeq() {}

inline ClassSeq(const ClassSeq& s) ... { }

What is the functionality of these inline defined functions?  I read in Vinoski's CORBA book that each sequence is implemented in a class. So I have the following:

#ifndef __CLASSSEQ_H__
#define __CLASSSEQ_H__

#include <iostream.h>
#include <omniORB3/CORBA.h>
#include "Const.h"

class ClassSeq {

private:
    // This holds the length of the class sequence
    CORBA::ULong _length_of_seq;

    // This holds the max length of the class sequence
    CORBA::ULong _max_length_of_seq;

    // This is the array holding all the classes
    Class_i* _class_seq;

public:
    // Constructors
    ClassSeq();

    ClassSeq(CORBA::ULong max);

    ClassSeq(CORBA::ULong max,
                  CORBA::ULong len,
                  Class** data,
                  CORBA::Boolean release = 0);

    ClassSeq(const ClassSeq &);

    // Destructor
    ~ClassSeq();

    ClassSeq& operator=(const ClassSeq &);

    const Class* operator[](CORBA::ULong idx) const;

    CORBA::ULong length() const;

    void length(CORBA::ULong newlen);

    CORBA::ULong maximum() const;

    CORBA::Boolean release() const;

    void replace(CORBA::ULong max,
                 CORBA::ULong length,
                 Class** data,
                 CORBA::Boolean release = 0);

    const Class** get_buffer() const;

    Class** get_buffer(CORBA::Boolean orphan = 0);

    static Class** allocbuf(CORBA::ULong newlen);

    static void freebuf(Class** data);
};

#endif

I am not sure what these inline implementations have to do with my implementation of the sequence. Does the example in Vinoski's book for unbounded sequences represent the general API for sequences?

Thank you very much.

--
Thomas Amsler
tpamsler@ucdavis.edu
amsler@cs.ucdavis.edu
http://einstein.dyndns.org

"Imagination is more important than knowledge."
        --Albert Einstein