#pragma once #include #include #include #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 *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 *m_DrvTreeMap; map> *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;