instance_specific_extensions.cc (13514:75569a60a0be) instance_specific_extensions.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

--- 9 unchanged lines hidden (view full) ---

18 *****************************************************************************/
19
20#include <tlm_utils/instance_specific_extensions_int.h>
21
22#include <iostream>
23#include <map>
24#include <systemc>
25#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

--- 9 unchanged lines hidden (view full) ---

18 *****************************************************************************/
19
20#include <tlm_utils/instance_specific_extensions_int.h>
21
22#include <iostream>
23#include <map>
24#include <systemc>
25#include <tlm>
26#include <typeindex>
26
27namespace tlm
28{
29
30template class tlm_array<tlm_utils::ispex_base *>;
31
32} // namespace tlm
33
34namespace tlm_utils
35{
36
37namespace
38{
39
40class ispex_registry // Copied from tlm_gp.cpp.
41{
42 typedef unsigned int key_type;
27
28namespace tlm
29{
30
31template class tlm_array<tlm_utils::ispex_base *>;
32
33} // namespace tlm
34
35namespace tlm_utils
36{
37
38namespace
39{
40
41class ispex_registry // Copied from tlm_gp.cpp.
42{
43 typedef unsigned int key_type;
43 typedef std::map<sc_core::sc_type_index, key_type> type_map;
44 typedef std::map<std::type_index, key_type> type_map;
44
45 public:
46 static ispex_registry &
47 instance()
48 {
49 if (!instance_) {
50 // Don't cleanup registry.
51 instance_ = new ispex_registry();
52 }
53 return *instance_;
54 }
55
56 unsigned int
45
46 public:
47 static ispex_registry &
48 instance()
49 {
50 if (!instance_) {
51 // Don't cleanup registry.
52 instance_ = new ispex_registry();
53 }
54 return *instance_;
55 }
56
57 unsigned int
57 register_extension(sc_core::sc_type_index type)
58 register_extension(std::type_index type)
58 {
59 type_map::const_iterator it = ids_.find(type);
60
61 if (it == ids_.end()) {
62 // New extension - generate/store ID.
63 type_map::value_type v(type, static_cast<key_type>(ids_.size()));
64 ids_.insert(v);
65 return v.second;

--- 201 unchanged lines hidden ---
59 {
60 type_map::const_iterator it = ids_.find(type);
61
62 if (it == ids_.end()) {
63 // New extension - generate/store ID.
64 type_map::value_type v(type, static_cast<key_type>(ids_.size()));
65 ids_.insert(v);
66 return v.second;

--- 201 unchanged lines hidden ---