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.

53 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __DEVICE_NODE_FACTORY_HEADER__
  2. #define __DEVICE_NODE_FACTORY_HEADER__
  3. #include "../components/base/basicThread.h"
  4. #include "dataBinder.h"
  5. #include "deviceNode.h"
  6. #define FACTORY_NODE_INIT_PENDING_COUNT 10 // Counts of validation in seconds
  7. class deviceNodeFactory : public basicThread
  8. {
  9. private:
  10. basicLogCollection * m_pLog;
  11. dataBinder * m_pDBC;
  12. vectorDeviceNodes m_vDeviceNodes;
  13. mapDeviceNode2Id m_mDeviceNodesIDS;
  14. DBC_INT_LIST m_nPendingNodes;
  15. uint16_t m_nPendingInitCounter;
  16. public:
  17. static deviceNodeFactory * getInstance();
  18. virtual ~deviceNodeFactory();
  19. deviceNode * createNode(uint32_t id);
  20. void deleteNode(deviceNode * ptr);
  21. void deleteNode(uint32_t id);
  22. uint32_t fetchNodes(ARGUS_NODE_TYPE type, deviceNode **& RA);
  23. deviceNode * getNode(uint32_t id);
  24. uint32_t getNodesCount(ARGUS_NODE_TYPE type);
  25. bool loadNodes();
  26. bool nodesAreLoaded()
  27. {
  28. return m_vDeviceNodes.size() > 0;
  29. }
  30. bool unloadNodes(void);
  31. bool reloadNodes();
  32. bool reloadNode(uint32_t NodeID);
  33. bool validate(void);
  34. protected:
  35. explicit deviceNodeFactory();
  36. virtual void m_fThreadProc(void);
  37. private:
  38. static deviceNodeFactory * _instance;
  39. };
  40. #endif