[gmpi] Re: low level API - Abstract Factory summary

  • From: "Ron Kuper" <ronkuper@xxxxxxxxxxx>
  • To: <gmpi@xxxxxxxxxxxxx>
  • Date: Tue, 8 Feb 2005 20:25:28 -0500

Hmm, not quite what I had in mind.  What I'm thinking is:

Every DLL has one entry point, the factory.

Every DLL is installed side-by-side with a meta data file.  These all sit in
the same directory.  The meta data file contains a table of CLSIDs and DLL
names.

The host enumerates plugins by enumerating meta data files, and building a
master table of CLSID->DLL.   (Meta data file contains other info too, like
name, vendor, etc, etc.)

To instantiate an object, the host loads the DLL corresponding to the CLSID,
then gets the factory interface for the CLSID, then creates objects.


BTW, this isn't exactly how it would be done in COM.  But it's better in the
sense that no registry is required.

----- Original Message ----- 
From: <jeffmcc@xxxxxxxxxx>
To: <gmpi@xxxxxxxxxxxxx>
Sent: Tuesday, February 08, 2005 8:06 PM
Subject: [gmpi] Re: low level API - Abstract Factory summary


> Rumour has it, when one finally 'gets' COM ...you hear
> angels sing and the sun seems brighter.
>
> I think I'm getting closer.  Summary:
>
> dll has one entry point only, the factory.
>
> First you ask the factory for the 'metadata library'
> interface..
>
> 2nd, you use the library to iterate the list of plugins.
>   The library gives you each plugin's Unique ID, name and
> other metadata about it.
>
> 3rd, you pass a plugin's unique ID to the factory, it passes
> back a GMPI_Plugin (interface).
>
> Quite involved, but also quite future-proof.
>
> Jeff
>
>
>
> >
> > Perhaps a more COM-like way to do this, is everything that
> > comes out of a factory is an interface.
> >
> > /**
> > * Factory in a plugin library for plugins.
> > */
> > class GMPI_IPluginLibrary : public GMPI_IUnknown
> > {
> >  GMPI_Result GMPI_EnumeratePlugins(GMPI_PluginDescriptor
> > *descriptor, int32_t index);
> > };
> >
> > Original Message:
> > -----------------
> > From:  jeffmcc@xxxxxxxxxx
> > Date: Wed, 09 Feb 2005 12:33:33 +1300
> > To: gmpi@xxxxxxxxxxxxx
> > Subject: [gmpi] Re: low level API - Abstract Factory
> > summary
> >
> >
> > > HRESULT CreateFactory( CLSID clsidClass, IFactory**
> >  ppFactory );
> >
> > Hi Ron,
> >  So each plugin has a unique ID code, we pass that to the
> > factory, it returns a GMPI_Plugin interface.  That's
> > good...
> >
> > But we first need the list of available IDs (in that dll).
> > So don't we need a second function too, that given an
> > index, returns the metadata for a plugin in the dll?
> >
> > HRESULT GetGMPI_PluginDescriptor( int index,
> > IGMPI_PluginDescriptor **pd );
> >
> > The metadata interface supplys the plugin's unique ID,
> > it's name etc.
> >
> > Am I on the right track?
> >
> > Jeff
> >
> > PS: mayby replace HRESULT with GMPI_RESULT.
> >
> > >
> > > >>>
> > > I think making it an object is just OO masturbation.  It
> > > feels good, but it doesn't really achieve anything.
> > > <<<
> > >
> > > The reason it seems overengineered is because the factor
> > > interface hasn't been defined properly.  I reall should
> > > be something like this:
> > >
> > > struct IFactory
> > > {
> > >     HRESULT CreateInstance( IUnknown** ppObj ) = 0;
> > > };
> > >
> > > HRESULT CreateFactory( CLSID clsidClass, IFactory**
> > > ppFactory );
> > >
> > > The idea is: a single module can be a factory for a
> > > variety of different classes.  You instantiate new
> > > objects of a class through the factory for the class,
> > > and you get the identify the factory by CLSID (GUID).
> > >
> > >
> > >
> > ----------------------------------------------------------
> > > ------------ Generalized Music Plugin Interface (GMPI)
> > > public discussion list Participation in this list is
> > > contingent upon your abiding by the following rules:
> > > Please stay on topic.  You are responsible for your own
> > > words.  Please respect your fellow subscribers.  Please
> > > do not redistribute anyone else's words without their
> > permission. >
> > > Archive: //www.freelists.org/archives/gmpi
> > > Email gmpi-request@xxxxxxxxxxxxx w/ subject
> > > "unsubscribe" to unsubscribe
> > >
> >
> > ----------------------------------------------------------
> > ------------ Generalized Music Plugin Interface (GMPI)
> > public discussion list Participation in this list is
> > contingent upon your abiding by the following rules:
> > Please stay on topic.  You are responsible for your own
> > words.  Please respect your fellow subscribers.  Please do
> > not redistribute anyone else's words without their
> > permission.
> >
> > Archive: //www.freelists.org/archives/gmpi
> > Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe"
> > to unsubscribe
> >
> >
> > ----------------------------------------------------------
> > ---------- mail2web - Check your email from the web at
> > http://mail2web.com/ .
> >
> >
> >
> > ----------------------------------------------------------
> > ------------ Generalized Music Plugin Interface (GMPI)
> > public discussion list Participation in this list is
> > contingent upon your abiding by the following rules:
> > Please stay on topic.  You are responsible for your own
> > words.  Please respect your fellow subscribers.  Please do
> > not redistribute anyone else's words without their
> > permission.
> >
> > Archive: //www.freelists.org/archives/gmpi
> > Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe"
> > to unsubscribe
> >
>
> ----------------------------------------------------------------------
> Generalized Music Plugin Interface (GMPI) public discussion list
> Participation in this list is contingent upon your abiding by the
> following rules:  Please stay on topic.  You are responsible for your own
> words.  Please respect your fellow subscribers.  Please do not
> redistribute anyone else's words without their permission.
>
> Archive: //www.freelists.org/archives/gmpi
> Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
>


----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: