Re: Beginners CORBA question



On Fri Jun 15, 2001 at 03:55:58PM +0100, Martin Craig wrote:
> Dear All,
> 
> I'm trying to use CORBA to add scripting to my Gnome app. I've
> been through the simple 'hello-world' type examples but I find
> the jump to 'real' docs a bit daunting, so could someone help 
> me with a particular problem:
> 
> Say I want to make a CORBA interface to a function that creates
> a new document in my program, eg
> 
> MyDocument *myprog_document_new(MyProg *myprog);
> 
> MyProg is a struct containing the basic variables/interface
> components of the program.

One way to do it would be to write a CORBA 'DocumentFactory' object, with a
method 'create_new_document', which would return a reference to the
'Document' object. (Thus, you'd need to write a 'Document' and a
'DocumentFactory' CORBA IDL-interface, and their implementation.

interface Document {

/* ... */
};

interface DocumentFactory {
	  
   /* .... */
   Document create_new_document (in MyProg myprog);	  
   /* .... */
}; 

And think hard about who will be responsible for destroying the returned
Document object ref....

I can recommend the book 'Advanced CORBA Programming for C++', btw.

> How does my CORBA implementation function get the myprog pointer 
> without making it global? Or should I just make it global?

No - global won't work, as your corba server doesn't know about the
'global' of your client. 

Cheers,
	Dirk-Jan.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]