gp.cc (13516:315f10e2567b) | gp.cc (13523:de27641700bb) |
---|---|
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> // std::memcpy et.al. 21#include <map> 22#include <systemc> 23#include <tlm> | 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> // std::memcpy et.al. 21#include <map> 22#include <systemc> 23#include <tlm> |
24#include <typeindex> |
|
24 | 25 |
25using sc_core::sc_type_index; 26 | |
27namespace tlm 28{ 29 30template class tlm_array<tlm_extension_base *>; 31 32//--------------------------------------------------------------------------- 33// Classes for the extension mechanism 34//--------------------------------------------------------------------------- 35 36namespace 37{ 38 39class tlm_extension_registry 40{ 41 typedef unsigned int key_type; | 26namespace tlm 27{ 28 29template class tlm_array<tlm_extension_base *>; 30 31//--------------------------------------------------------------------------- 32// Classes for the extension mechanism 33//--------------------------------------------------------------------------- 34 35namespace 36{ 37 38class tlm_extension_registry 39{ 40 typedef unsigned int key_type; |
42 typedef std::map<sc_core::sc_type_index, key_type> type_map; | 41 typedef std::map<std::type_index, key_type> type_map; |
43 public: 44 static tlm_extension_registry & 45 instance() 46 { 47 if (!instance_) { 48 // Don't cleanup registry. 49 instance_ = new tlm_extension_registry(); 50 } 51 return *instance_; 52 } 53 54 unsigned int | 42 public: 43 static tlm_extension_registry & 44 instance() 45 { 46 if (!instance_) { 47 // Don't cleanup registry. 48 instance_ = new tlm_extension_registry(); 49 } 50 return *instance_; 51 } 52 53 unsigned int |
55 register_extension(sc_type_index type) | 54 register_extension(std::type_index type) |
56 { 57 type_map::const_iterator it = ids_.find(type); 58 59 if (it == ids_.end()) { 60 // New extension - generate/store ID. 61 type_map::value_type v(type, static_cast<key_type>(ids_.size())); 62 ids_.insert(v); 63 return v.second; --- 292 unchanged lines hidden --- | 55 { 56 type_map::const_iterator it = ids_.find(type); 57 58 if (it == ids_.end()) { 59 // New extension - generate/store ID. 60 type_map::value_type v(type, static_cast<key_type>(ids_.size())); 61 ids_.insert(v); 62 return v.second; --- 292 unchanged lines hidden --- |