Going back to your original questions, I'll try to comment on some of them
one at a time, starting with ...

On 09/01/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:


- DASObject: I initially created this class to set in place of the Java
Object class. The DAS Java has some functions that takes the Object class
as
arguments and as C++ has nothing like it(as far as I know) I created this
class. I've not assigned any function to this class(an empty class). Maybe
there is another simpler way to substitute the Java Object class, needing
some suggestions here too.


You are right, C++ has nothing like the Java Object class, so C++ has no
common root to its object hierarchies. I think you will find it hard to
create a C++ class that can function like Java Object. For one thing _every_
class that you create will have to inherit from DASObject (or whatever),
furthermore, what do you then do about STL classes like vector and list? You
might need to create your own versions of those, such as DASvector which
will have to inherit from both std::vector and DASObject. So, in my opinion,
the general case is too hard.

A better thing to do is look at exactly what values the Java spec is passing
into those Object parameters and try to create a common root class for just
those values. For example, in SDO we encounter this problem when trying to
deal with the various primitive data types (boolean, short, float, ...). The
Java spec defines some methods that take (or return) an Object type,
intending that type to be a wrapped primitive value (eg Byte for a byte
etc). C++ has no direct equivalent, however we can define an SDOValue class
that looks a bit like

class SDOValue {
 union {
   bool a;
   float f;
   // etc
 } value;
 enum {
   SDObool,
   SDOfloat,
   // etc
 } datatype;
}

and then we can pass instances of SDOValue around within methods that are
interested in any one of the primitive data types.

There's nothing magic about this particular class, it's just an example. The
important point is that in SDO for Java, in many of the places where Object
is used as a type, what is _really_ meant is not "any object at all" but
rather "one of the primitive data types". If you can spot cases similar to
that in DAS then you can create classes to represent the things that are
really being passed instead of trying to recreate a generic Object class.

Please let me know if that doesn't make sense and I'll have another go :-)

Regards,

Geoff.

Reply via email to