Better way to make the static functions not accessible with the derived classes

This commit is contained in:
Johannes Feldmann
2018-06-04 15:06:12 +02:00
parent 805033d99b
commit 534f753770
2 changed files with 6 additions and 12 deletions

View File

@@ -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<pair<unsigned, unsigned>>
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<pair<unsigned, unsigned>>
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);

View File

@@ -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<std::string, sc_dt::uint64> masks;
std::map<std::string, unsigned int> 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);