You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __IM_DATABASEADAPTER_H_INCL__
  2. #define __IM_DATABASEADAPTER_H_INCL__
  3. #include "../../lib/data/mysql/database_class.h"
  4. #include "../../lib/components/base/basicSettingsProvider.h"
  5. #include "IM_DataStructs.h"
  6. /**
  7. * TODO: Add class description
  8. *
  9. * @author Gagua
  10. */
  11. class IM_DataBaseAdapter {
  12. private:
  13. basicLogCollection * m_pLog;
  14. config_setting_t * m_pSettings;
  15. bool m_bIsConnected;
  16. MySQL_Connector * m_pConnectorClass;
  17. public:
  18. // Method to fetch singleton instance.
  19. static IM_DataBaseAdapter* getInstance( config_setting_t * Settings = NULL );
  20. // Destructor
  21. virtual ~IM_DataBaseAdapter();
  22. IM_ITEM_DATA * getItemDataById( uint32_t itemID );
  23. IM_ITEM_DATA * getItemDataByMd5( CSTR md5 );
  24. void insertItemROI( uint32_t itemID, uint32_t classID, float weight, uint32_t x, uint32_t y, uint32_t w, uint32_t h );
  25. protected:
  26. // Constructor - protected so users cannot call it.
  27. explicit IM_DataBaseAdapter( config_setting_t * Settings );
  28. private:
  29. // private static member referencing the single instance of the object
  30. // TODO: Replace IM_DataBaseAdapter with the type of object you want to
  31. // return the single instance of
  32. static IM_DataBaseAdapter* _instance;
  33. // Copy constructor
  34. // Declared but not defined to prevent auto-generated
  35. // copy constructor. Refer to "Effective C++" by Meyers
  36. IM_DataBaseAdapter(const IM_DataBaseAdapter& src);
  37. // Assignment operator
  38. // Declared but not defined to prevent auto-generated
  39. // assignment operator. Refer to "Effective C++" by Meyers
  40. IM_DataBaseAdapter& operator=(const IM_DataBaseAdapter& src);
  41. };
  42. #endif // __IM_DATABASEADAPTER_H_INCL__