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> |
25 |
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; |
41 typedef std::map<std::type_index, key_type> type_map; |
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 |
54 register_extension(std::type_index type) |
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 --- |