TypeId和IidManager关系

IidInformation结构

数据类型 名字
string name
TypeId::hash_t hash
uint16_t parent
string groupName
size_t size
bool hasConstructor
Callback<ObjectBase*> constructor
bool mustHideFromDocumentation
vector<TypeId::AttributeInformation> attributes
vector<TypeId::TraceSourceInformation> traceSources

IidManager中包含的成员

vector<struct IidInformation> m_information;
namemap_t m_namemap;
hashmap_t m_hashmap;

IidManager中存了三张表;

  • m_information 用于建立tid(uint16_t)和每个 IidInformation的映射关系。Vector中下标为i的 IidInformation对应的tid为i+1;
  • m_namemap
    • map<string, uint16_t>
  • m_hashmap
    • map<TypeId::hash_t,uint16_t>
  • m_information中的映射关系造成的影响:
    • LookupInformation (uint16_t uid)函数返回的是&m_information[uid-1]
    • 创建新的IidInformation(假设为newIn)时,先把newIn加入Vector,在令对应的uid为Vetor.size().然后加入map<name, uid>,map<hash, uid>

TypeId

  • 类成员:m_tid.
  • 成员函数的实现 通过调用IidManager的同名实现函数(将m_tid作为实参传入)实现。
原文地址:https://www.cnblogs.com/rainySue/p/TypeId-heIidManager-guan-xi.html