[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Another quick CORBA q.
From:       Rik Hemsley <rik () rikkus ! demon ! co ! uk>
Date:       1999-08-03 18:47:16
[Download RAW message or body]

On Tue, 03 Aug 1999, Simon Hausmann wrote:

> Not sure I really understand your problem, but perhaps this helps:
> 
> interface MyObject; (as forward reference)
> interface MyInterface
> {
>   void doSomething( in MyObject obj );
> }
> 
> But perhaps you just want to use the generic Object type:
> interface MyInterface
> {
>   void addObject( in Object foo );
>   Object blah( in string key );
> }

Sorry I should explain better.

I want the CORBA stuff to know nothing about my types. Here's something
more related to the real world:

I have a library which will do _all_ communication with the CORBA server.
Therefore it knows how to create and manipulate the objects that are held
in an AddressBook object.

The class interface should look something like this:

class AddressBook
{
  public:
  QString name();
  void add(Entity * e);
  void remove(QString key);
  Entity * entity(QString key);
  
  private:
  QString name;
};

I have made an idl that has interfaces for Field (an Entity contains a list
of Field), Entity and AddressBook.

This forces me to implement Field and Entity in a way I don't like.

What I'd like to do is to be able to say that I want to be able to pass my
own object, without specifying an interface for it.

This would mean an interface like this:

interface AddressBook
{
  string name();
  void add(in Entity e);
  void remove(in string key);
  Entity * entity(in string key);
};

The only problem with this is that I then have to declare the interface for
Entity, which is fairly large and complex. There's a lot of dlopen() stuff
going on and passing around of pointer-to-function, QByteArray, etc.

This makes it difficult for me, with little CORBA knowledge, to implement.
I'd have to do things like pass char * and int around instead of QByteArray.

Basically, the whole thing gets messy. I've done most of it, but I'd rather
do it the simple way where I'm just passing something like a generic
pointer around and casting it where necessary.

Is this possible or do I have to declare and define the interface for
absolutely every type that I'm using and reimplement everything I've
written just because CORBA can't cope with anything other than some
not-very-useful standard types ?

Cheers,
Rik

-- 
KDE - Colour Outside The Lines - http://www.kde.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic