[gmpi] Re: Prototype Plugin Code

  • From: Jeff McClintock <jeffmcc@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Tue, 15 Feb 2005 16:05:35 +1300

After staring at that, I had to simplify it further ( a compulsion of mine ).
CreateInstance() function now simply returns a pointer to the plugin. It's still checked for errors, except by the factory.


----------header-----------------
#include "plugin.h"

class Prototype_Plugin : public GMPI_Plugin
{
public:
        /* create function */
        static GMPI_Plugin * GMPI_STDCALL CreateInstance(void);

        /* test function */
        virtual GMPI_RESULT GMPI_STDCALL Placeholder1( int32_t);
};


----------------cpp-------------- #include "test_plugin.h" #include "factory.h"

/* Plugin unique ID */
/* IID vs URI undecided. For now using GUID */

static const GMPI_GUID IID_GMPI_Prototype_DSP =
{ 0x5cc85cad, 0xdc0c, 0x42c2, { 0x80, 0xfd, 0xdc, 0x3a, 0xdb, 0xc7, 0x6, 0x41 } };


/* register plugin ID and creation function with factory */
namespace
{
GMPI_RESULT r = Factory()->RegisterPlugin( &IID_GMPI_Prototype_DSP, Prototype_Plugin::CreateInstance );
}


/* instantiate a new plugin. Return NULL for failure */
GMPI_Plugin *Prototype_Plugin::CreateInstance(void)
{
    return new Prototype_Plugin();
}

GMPI_RESULT Prototype_Plugin::Placeholder1( int32_t)
{
        return GMPI_SUCCESS;
}




---------------------------------------------------------------------- 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: