#ifndef __IM_DATABASEADAPTER_H_INCL__ #define __IM_DATABASEADAPTER_H_INCL__ #include "../../lib/data/mysql/database_class.h" #include "../../lib/components/base/basicSettingsProvider.h" #include "IM_DataStructs.h" /** * TODO: Add class description * * @author Gagua */ class IM_DataBaseAdapter { private: basicLogCollection * m_pLog; config_setting_t * m_pSettings; bool m_bIsConnected; MySQL_Connector * m_pConnectorClass; public: // Method to fetch singleton instance. static IM_DataBaseAdapter* getInstance( config_setting_t * Settings = NULL ); // Destructor virtual ~IM_DataBaseAdapter(); IM_ITEM_DATA * getItemDataById( uint32_t itemID ); IM_ITEM_DATA * getItemDataByMd5( CSTR md5 ); void insertItemROI( uint32_t itemID, uint32_t classID, float weight, uint32_t x, uint32_t y, uint32_t w, uint32_t h ); protected: // Constructor - protected so users cannot call it. explicit IM_DataBaseAdapter( config_setting_t * Settings ); private: // private static member referencing the single instance of the object // TODO: Replace IM_DataBaseAdapter with the type of object you want to // return the single instance of static IM_DataBaseAdapter* _instance; // Copy constructor // Declared but not defined to prevent auto-generated // copy constructor. Refer to "Effective C++" by Meyers IM_DataBaseAdapter(const IM_DataBaseAdapter& src); // Assignment operator // Declared but not defined to prevent auto-generated // assignment operator. Refer to "Effective C++" by Meyers IM_DataBaseAdapter& operator=(const IM_DataBaseAdapter& src); }; #endif // __IM_DATABASEADAPTER_H_INCL__