cPluginManager.h

00001 #ifndef CPLUGINMANAGER_H_INCLUDED
00002 #define CPLUGINMANAGER_H_INCLUDED
00003 
00004 #include <string>
00005 #include <map>
00006 #include <vector>
00007 
00008 #include "../include/IPluginManager.h"
00009 #include "../include/IAudioPlugin.h"
00010 #include "../Headers/cMutex.h"
00011 
00012 #ifdef CAUDIO_PLATFORM_WIN
00013 #       define WIN32_LEAN_AND_MEAN
00014 #       include <windows.h>
00015 #endif
00016 
00017 #ifdef CAUDIO_PLATFORM_MAC
00018 #       include "macUtils.h"
00019 #   include <dlfcn.h>
00020 #endif
00021 
00022 #ifdef CAUDIO_PLATFORM_LINUX
00023 #       include <dlfcn.h>
00024 #endif
00025 
00026 #ifdef CAUDIO_PLATFORM_WIN
00027 #    define DYNLIB_HANDLE hInstance
00028 #    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
00029 #    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
00030 #    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
00031 #endif
00032 
00033 struct HINSTANCE__;
00034 typedef struct HINSTANCE__* hInstance;
00035 
00036 #ifdef CAUDIO_PLATFORM_LINUX
00037 #    define DYNLIB_HANDLE void*
00038 #    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
00039 #    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
00040 #    define DYNLIB_UNLOAD( a ) dlclose( a )
00041 #endif
00042 
00043 #ifdef CAUDIO_PLATFORM_MAC
00044 #    define DYNLIB_HANDLE void*
00045 #    define DYNLIB_LOAD( a ) mac_loadDylib( a )
00046 #    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
00047 #    define DYNLIB_UNLOAD( a ) dlclose( a )
00048 #endif
00049 
00050 namespace cAudio
00051 {
00052         class cPluginManager : public IPluginManager
00053         {
00054         public:
00055                 cPluginManager();
00056                 ~cPluginManager();
00057 
00058                 static cPluginManager* Instance()
00059                 {
00060                         static cPluginManager theInstance;
00061                         return &theInstance;
00062                 }
00063 
00064                 virtual bool installPlugin(IAudioPlugin* plugin, const char* name);
00065                 virtual bool installPlugin(const char* filename, const char* name);
00066 
00067                 virtual bool checkForPlugin(const char* name);
00068                 virtual IAudioPlugin* getPlugin(const char* name);
00069                 virtual unsigned int getPluginCount();
00070                 std::vector<IAudioPlugin*> getPluginList();
00071 
00072                 virtual void uninstallPlugin(IAudioPlugin* plugin);
00073                 virtual void uninstallPlugin(const char* name);
00074 
00075                 void autoLoadPlugins();
00076         protected:
00077                 std::map<std::string, IAudioPlugin*> RegisteredPlugins;
00078                 std::map<IAudioPlugin*, DYNLIB_HANDLE> DynamicallyLoadedPlugins;
00079         };
00080 };
00081 
00082 #endif 
 All Classes Namespaces Functions Variables Enumerations

Generated on Sat Feb 20 22:55:07 2010 for cAudio by  doxygen 1.6.2