]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store.cpp
Code deduplication (plugin creation via template PLUGIN_CREATOR)
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store.cpp
index 2210c9511a4965e4a124a9b217a9bc9d269d3169..19e3efec8941797e64a64f181b607f5bb056f47a 100644 (file)
 
 #include <libpq-fe.h>
 
-#include "postgresql_store.h"
-#include "postgresql_store_utils.h"
 #include "stg/module_settings.h"
+#include "stg/plugin_creator.h"
+#include "postgresql_store_utils.h"
+#include "postgresql_store.h"
 
-class POSTGRESQL_STORE_CREATOR
-{
-public:
-    POSTGRESQL_STORE_CREATOR()
-        : pqStore(new POSTGRESQL_STORE())
-        {
-        };
-    ~POSTGRESQL_STORE_CREATOR()
-        {
-        delete pqStore;
-        };
-    POSTGRESQL_STORE * GetStore() { return pqStore; };
-private:
-    POSTGRESQL_STORE * pqStore;
-} pqStoreeCreator;
+PLUGIN_CREATOR<POSTGRESQL_STORE> pqStoreeCreator;
 
 //-----------------------------------------------------------------------------
 STORE * GetStore()
 {
-return pqStoreeCreator.GetStore();
+return pqStoreeCreator.GetPlugin();
 }
 
 //-----------------------------------------------------------------------------