34 struct tlm_phase_registry
36 typedef unsigned int key_type;
38 static tlm_phase_registry &
41 static tlm_phase_registry inst;
46 register_phase(std::type_index
type, std::string
name)
48 type_map::const_iterator it =
ids_.find(
type);
52 "unexpected empty tlm_phase name" );
56 if (it ==
ids_.end()) {
58 type_map::value_type
v(
type,
static_cast<key_type
>(names_.size()));
59 names_.push_back(name_table::value_type(
name.data(),
name.size()));
64 if (names_[it->second] !=
name) {
66 "tlm_phase registration failed: duplicate type info" );
73 get_name(key_type
id)
const
76 return names_[
id].c_str();
80 typedef std::map<std::type_index, key_type> type_map;
86 tlm_phase_registry() : names_(
END_RESP + 1)
102 m_id(tlm_phase_registry::instance().register_phase(
type,
name))
108 return tlm_phase_registry::instance().get_name(
m_id);