From 534f75377076cbecb85db36a0240c41758d11f57 Mon Sep 17 00:00:00 2001 From: Johannes Feldmann Date: Mon, 4 Jun 2018 15:06:12 +0200 Subject: [PATCH] Better way to make the static functions not accessible with the derived classes --- DRAMSys/library/src/common/jsonAddressDecoder.h | 9 +++------ DRAMSys/library/src/common/xmlAddressdecoder.h | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/DRAMSys/library/src/common/jsonAddressDecoder.h b/DRAMSys/library/src/common/jsonAddressDecoder.h index e6838da2..3ab157e1 100644 --- a/DRAMSys/library/src/common/jsonAddressDecoder.h +++ b/DRAMSys/library/src/common/jsonAddressDecoder.h @@ -46,15 +46,13 @@ using std::pair; using std::map; class JSONAddressDecoder - : public AddressDecoder + : private AddressDecoder { // Friendship needed so that the AddressDecoder can access the // constructor of this class to create the object in CreateInstance. friend class AddressDecoder; private: - JSONAddressDecoder(); - vector> m_vXor; // This container stores for each used xor gate a pair which consists of "First/Number of an address bit which corresponds to a bank" // and "Second/Number of an address bit which corresponds to a row" @@ -65,10 +63,9 @@ private: vector> m_vColumnBits; // This container stores for each column bit a pair which consists of "First/Number of the column bit" and "Second/Number of the address bit" - static AddressDecoder &getInstance(); - static void createInstance(Type t); - public: + JSONAddressDecoder(); + virtual void setConfiguration(std::string url); virtual DecodedAddress decodeAddress(sc_dt::uint64 addr); diff --git a/DRAMSys/library/src/common/xmlAddressdecoder.h b/DRAMSys/library/src/common/xmlAddressdecoder.h index 97cbd9eb..063bc25e 100644 --- a/DRAMSys/library/src/common/xmlAddressdecoder.h +++ b/DRAMSys/library/src/common/xmlAddressdecoder.h @@ -45,24 +45,21 @@ #include "AddressDecoder.h" class xmlAddressDecoder - : public AddressDecoder + : private AddressDecoder { // Friendship needed so that the AddressDecoder can access the // constructor of this class to create the object in CreateInstance. friend class AddressDecoder; private: - xmlAddressDecoder(); - std::map masks; std::map shifts; tinyxml2::XMLElement *addressmapping; - static AddressDecoder &getInstance(); - static void createInstance(Type t); - public: + xmlAddressDecoder(); + virtual DecodedAddress decodeAddress(sc_dt::uint64 addr); virtual sc_dt::uint64 encodeAddress(DecodedAddress n);