systemc: Replace sc_core::sc_type_index with std::type_index.
authorGabe Black <gabeblack@google.com>
Thu, 3 Jan 2019 21:57:27 +0000 (13:57 -0800)
committerGabe Black <gabeblack@google.com>
Wed, 9 Jan 2019 01:35:51 +0000 (01:35 +0000)
The former is either the same as the later, or a custom wrapper if
C++11 isn't supported. Since we generally expect C++11 support, we can
skip the indirection.

Change-Id: I9a45e3854bb7cc56d094e3fe2773fe4b5c94403b
Reviewed-on: https://gem5-review.googlesource.com/c/15297
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>

src/systemc/ext/tlm_core/2/sockets/base_socket_if.hh
src/systemc/ext/tlm_core/2/sockets/initiator_socket.hh
src/systemc/ext/tlm_core/2/sockets/target_socket.hh
src/systemc/tlm_core/2/generic_payload/gp.cc
src/systemc/tlm_core/2/generic_payload/phase.cc
src/systemc/tlm_utils/instance_specific_extensions.cc

index 29f3397b9e8426a2edc1a69dd76b19d541f5cd5e..a494b683fda0db8f17117cd9c8c10be03f3e1ac8 100644 (file)
@@ -21,6 +21,7 @@
 #define __SYSTEMC_EXT_TLM_CORE_2_SOCKETS_BASE_SOCKET_IF_H__
 
 #include <systemc>
+#include <typeindex>
 
 namespace tlm
 {
@@ -45,7 +46,7 @@ class tlm_base_socket_if
     virtual sc_core::sc_export_base &get_export_base() = 0;
     virtual sc_core::sc_export_base const &get_export_base() const = 0;
     virtual unsigned int get_bus_width() const = 0;
-    virtual sc_core::sc_type_index get_protocol_types() const = 0;
+    virtual std::type_index get_protocol_types() const = 0;
     virtual tlm_socket_category get_socket_category() const = 0;
 
   protected:
index 91c147bc9484911b4618eaf0a76cb66f1fc4e6d3..a7c53cc335c8d28fd155c18b3c95b8f8884084a8 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __SYSTEMC_EXT_TLM_CORE_2_SOCKETS_INITIATOR_SOCKET_HH__
 #define __SYSTEMC_EXT_TLM_CORE_2_SOCKETS_INITIATOR_SOCKET_HH__
 
+#include <typeindex>
+
 #include "tlm_core/2/interfaces/fw_bw_ifs.hh"
 #include "tlm_core/2/sockets/base_socket_if.hh"
 
@@ -192,7 +194,7 @@ class tlm_initiator_socket : public tlm_base_initiator_socket<
 
     virtual const char *kind() const { return "tlm_initiator_socket"; }
 
-    virtual sc_core::sc_type_index
+    virtual std::type_index
     get_protocol_types() const
     {
         return typeid(TYPES);
index b412a7d5cd892ef4c2d2034f443ccd65446df9b6..4ca31c9b9a9a4bec9da4a3a532b3a2c8315da0f7 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __SYSTEMC_EXT_TLM_CORE_2_SOCKETS_TARGET_SOCKET_HH__
 #define __SYSTEMC_EXT_TLM_CORE_2_SOCKETS_TARGET_SOCKET_HH__
 
+#include <typeindex>
+
 #include "tlm_core/2/interfaces/fw_bw_ifs.hh"
 #include "tlm_core/2/sockets/base_socket_if.hh"
 
@@ -211,7 +213,7 @@ class tlm_target_socket :
 
     virtual const char* kind() const { return "tlm_target_socket"; }
 
-    virtual sc_core::sc_type_index
+    virtual std::type_index
     get_protocol_types() const
     {
         return typeid(TYPES);
index ff3c92bd9d178542ff9cbe6a1fa7011f6397e63c..b42bdb836ed8990aad3e573f4965e650c04bfb6a 100644 (file)
@@ -21,8 +21,7 @@
 #include <map>
 #include <systemc>
 #include <tlm>
-
-using sc_core::sc_type_index;
+#include <typeindex>
 
 namespace tlm
 {
@@ -39,7 +38,7 @@ namespace
 class tlm_extension_registry
 {
     typedef unsigned int key_type;
-    typedef std::map<sc_core::sc_type_index, key_type> type_map;
+    typedef std::map<std::type_index, key_type> type_map;
   public:
     static tlm_extension_registry &
     instance()
@@ -52,7 +51,7 @@ class tlm_extension_registry
     }
 
     unsigned int
-    register_extension(sc_type_index type)
+    register_extension(std::type_index type)
     {
         type_map::const_iterator it = ids_.find(type);
 
index 2c8b1e1a0818595846c6df854d0974221c107baf..a3fb937491a23c48a98abfd5aa5b7d6e33eb2ed5 100644 (file)
@@ -21,9 +21,9 @@
 #include <map>
 #include <systemc>
 #include <tlm>
+#include <typeindex>
 
 using sc_core::sc_string_view;
-using sc_core::sc_type_index;
 
 namespace tlm
 {
@@ -43,7 +43,7 @@ struct tlm_phase_registry
     }
 
     unsigned int
-    register_phase(sc_type_index type, sc_string_view name)
+    register_phase(std::type_index type, sc_string_view name)
     {
         type_map::const_iterator it = ids_.find(type);
 
@@ -77,7 +77,7 @@ struct tlm_phase_registry
     }
 
   private:
-    typedef std::map<sc_type_index, key_type> type_map;
+    typedef std::map<std::type_index, key_type> type_map;
     typedef std::vector<std::string> name_table;
 
     type_map ids_;
index c0836cd6791308e487b943a57ce6cef581597779..91610dd02ffb8dcbc31959e1890515a483501370 100644 (file)
@@ -23,6 +23,7 @@
 #include <map>
 #include <systemc>
 #include <tlm>
+#include <typeindex>
 
 namespace tlm
 {
@@ -40,7 +41,7 @@ namespace
 class ispex_registry // Copied from tlm_gp.cpp.
 {
     typedef unsigned int key_type;
-    typedef std::map<sc_core::sc_type_index, key_type> type_map;
+    typedef std::map<std::type_index, key_type> type_map;
 
   public:
     static ispex_registry &
@@ -54,7 +55,7 @@ class ispex_registry // Copied from tlm_gp.cpp.
     }
 
     unsigned int
-    register_extension(sc_core::sc_type_index type)
+    register_extension(std::type_index type)
     {
         type_map::const_iterator it = ids_.find(type);