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.

38 lines
1.5 KiB

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