#pragma once #include #include VK_NAMESPACE_BEGIN class GraphModule; class GraphModulesMap { SortedSet gm_set; Map gm_map_by_name; Map gm_map_by_hash; List gm_list; //按创建顺序记录,用于倒序释放 public: bool Add(GraphModule *gm); const bool IsEmpty()const { return gm_set.IsEmpty(); } GraphModule *Get(const AIDName &name) { GraphModule *gm; if(gm_map_by_name.Get(name,gm)) return gm; return nullptr; } template T *Get() { GraphModule *gm; return gm_map_by_hash.Get(GetTypeHash(),gm)?(T *)gm:nullptr; } template const bool IsLoaded()const{return gm_map_by_hash.ContainsKey(T::GetTypeHash());} const bool IsLoaded(const AIDName &name)const{return gm_map_by_name.ContainsKey(name);} bool Release(GraphModule *gm); ///<释放一个模块 void Destory(); ///<销毁所有模块 };//class GraphModulesMap VK_NAMESPACE_END