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.

54 lines
2.1 KiB

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