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.

39 lines
1.7 KiB

​
​
​
6 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __ARGUS_NODE_FACTORY_HEADER__
  2. #define __ARGUS_NODE_FACTORY_HEADER__
  3. #include <vector>
  4. #include <map>
  5. #include "rgooseNode.h"
  6. #include "../components/base/basicThread.h"
  7. typedef std::vector<argusNetNode*> vectorNetNodes;
  8. typedef std::map<uint32_t,argusNetNode*> mapNode2Id;
  9. class argusNodeFactory: public basicThread{
  10. private:
  11. basicLogCollection * m_pLog;
  12. argusDBC * m_pDBC;
  13. uint32_t m_nSiteID;
  14. uint32_t m_nServerID;
  15. vectorNetNodes m_vNetNodes;
  16. mapNode2Id m_mNetNodesIDS;
  17. public:
  18. static argusNodeFactory * getInstance( uint32_t SiteID = 0, uint32_t ServerID = 0 );
  19. virtual ~argusNodeFactory();
  20. argusNetNode * createNode( uint32_t id );
  21. void deleteNode( argusNetNode *ptr );
  22. void deleteNode( uint32_t id );
  23. uint32_t fetchNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA );
  24. argusNetNode * getNode( uint32_t id );
  25. uint32_t getNodesCount( ARGUS_NODE_TYPE type );
  26. bool loadNodes( uint32_t SiteID = 0, uint32_t ServerID = 0 );
  27. bool unloadNodes( void );
  28. bool reloadNodes( uint32_t SiteID = 0, uint32_t ServerID = 0 );
  29. bool reloadNode( uint32_t NodeID );
  30. bool validate( void );
  31. protected:
  32. explicit argusNodeFactory( uint32_t SiteID, uint32_t ServerID );
  33. virtual void m_fThreadProc( void );
  34. private:
  35. static argusNodeFactory * _instance;
  36. };
  37. #endif