1/***************************************************************************** 2 3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 4 more contributor license agreements. See the NOTICE file distributed 5 with this work for additional information regarding copyright ownership. 6 Accellera licenses this file to you under the Apache License, Version 2.0 7 (the "License"); you may not use this file except in compliance with the 8 License. You may obtain a copy of the License at --- 7 unchanged lines hidden (view full) --- 16 permissions and limitations under the License. 17 18 *****************************************************************************/ 19 20#include <cstring> 21#include <map> 22#include <systemc> 23#include <tlm> |
24#include <typeindex> |
25 26using sc_core::sc_string_view; |
27 28namespace tlm 29{ 30 31namespace 32{ 33 34struct tlm_phase_registry 35{ 36 typedef unsigned int key_type; 37 38 static tlm_phase_registry & 39 instance() 40 { 41 static tlm_phase_registry inst; 42 return inst; 43 } 44 45 unsigned int |
46 register_phase(std::type_index type, sc_string_view name) |
47 { 48 type_map::const_iterator it = ids_.find(type); 49 50 if (name.empty()) { 51 SC_REPORT_FATAL( sc_core::SC_ID_INTERNAL_ERROR_, 52 "unexpected empty tlm_phase name" ); 53 return UNINITIALIZED_PHASE; 54 } --- 17 unchanged lines hidden (view full) --- 72 const char * 73 get_name(key_type id) const 74 { 75 sc_assert(id < names_.size()); 76 return names_[id].c_str(); 77 } 78 79 private: |
80 typedef std::map<std::type_index, key_type> type_map; |
81 typedef std::vector<std::string> name_table; 82 83 type_map ids_; 84 name_table names_; 85 86 tlm_phase_registry() : names_(END_RESP + 1) 87 { 88 names_[UNINITIALIZED_PHASE] = "UNINITIALIZED_PHASE"; --- 23 unchanged lines hidden --- |