Re: using a factory to control instances

Michael Meeks <[email protected]>
Newsgroups gmane.comp.gnome.components
Organization Ximian.
Message-ID <[email protected]>
Hi Jacob,

On Thu, 2003-04-24 at 05:12, Jacob Perkins wrote:
> I want to use a bonobo factory for creating controls (or any
> BonoboObject). I already have a setup working that was basically copied
> from the sample control in libbonoboui. However, I only want one
> instance of this control. So, given 'moniker', I want to create a new
> BonoboObject if it doesn't exist yet, or return the already created one.
> However, if given 'moniker:new', I want to create a new instance of the
> object. Since there are no guarentees as to which process will request
> the first instance, how do I do this. To make it simple, how would one
> modify the sample control to support this?
> I know this can be done with a static variable or object, but it seems
> that factories should provide a better way to do this.

	So - your factory is likely to be a singleton across processes (
assuming it is an executable and not a shared object ); So I guess you
can aggregate things to the factory (the singleton), and the result of
:new will be what comes out of the factory ;-)

	All method invocations on those objects will be processed in the same
process though - so, it's fairly easy to get it to work.

	What are you trying to achieve though ? 

	Regards,

		Michael.

-- 
 [email protected]  <><, Pseudo Engineer, itinerant idiot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.