123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #pragma once
- #include <map>
- #include <vector>
- #include <string>
- #include "CcosLock.h"
- #include "CcosThread.h"
- #include "LogicClient.h"
- using namespace std;
- class DrvTreeNode {
- //bool Check_AddSubNode(DrvTreeNode &SubNode);
- public:
- DrvTreeNode(void);
- virtual ~DrvTreeNode(void);
- //data definitions
- //bool m_EndNode;
- UINT64 m_ProcId;
- UINT64 m_Address;
- //string *m_NodeName;
- //map<string,DrvTreeNode> *m_SubNodes;
- //functions
- //void InitTreeNode(const char *pNodeName, UINT64 ProcId = 0, UINT64 Address = 0);
- //bool AddSubNode(DrvTreeNode &SubNode);
- //bool DelSubPath(const char *pSubPath);
- //const char* GetNodeName();
- };
- //-------------README-----------
- /*
- 驱动树作为设备的管理员存在.
- 所有针对设备的操作,必须先Lock驱动树,然后进行操作
- 1.插入/删除/检索设备的操作
- 2.插入/删除/检索设备句柄的操作
- 3.插入/删除/检索驱动句柄的操作
- */
- class DrvTree : public CcosLock, public Thread_Base
- {
- LogicClient * m_rootClient;
- map<string, DrvTreeNode> *m_DrvTreeMap;
- map<UINT64,vector<UINT64>> *m_LocalProcIdList;//key = procid,vector = address
- public:
- DrvTree();
- virtual ~DrvTree();
- void Clear();
- bool AddTree(const char *pDevicePath, UINT64 ProcId, UINT64 Address);
- bool DelTree(const char *pDevicePath);
- bool GetTreeNode(const char *pDevicePath, DrvTreeNode &node);
- bool CheckNode(UINT64 ProcId, UINT64 Address);
- void PrintExistTree();
- protected:
- //thread
- virtual bool Exec();
- virtual bool OnStartThread();
- virtual bool OnEndThread();
- };
- extern DrvTree g_DrvTree;
|