gtranslationTable
gtranslationTable.h
Go to the documentation of this file.
1 #pragma once
2 
3 // gemc
4 #include "gelectronic.h"
5 #include "glogger.h"
6 
7 // c++
8 #include <string>
9 #include <unordered_map>
10 #include <vector>
11 
19 
20 public:
25  GTranslationTable(std::shared_ptr<GLogger> logger) : log(logger) {
26  log->debug(CONSTRUCTOR, "GTranslationTable");
27  }
28 
30  log->debug(DESTRUCTOR, "GTranslationTable");
31  }
32 
41  void addGElectronicWithIdentity(const std::vector<int>& identity, const GElectronic& gtron);
42 
51  GElectronic getElectronics(const std::vector<int>& identity) const;
52 
53 private:
54  // the map uses a string formed by the vector<int> identity as its key
55  std::unordered_map<std::string, GElectronic> tt;
56 
65  std::string formTTKey(const std::vector<int>& identity) const;
66 
68  std::shared_ptr<GLogger> log;
69 
70 };
71 
72 
Provides a translation table for GElectronic objects indexed by a vector-based identity.
GTranslationTable(std::shared_ptr< GLogger > logger)
Constructor.
GElectronic getElectronics(const std::vector< int > &identity) const
Retrieves the GElectronic configuration for the provided identity.
void addGElectronicWithIdentity(const std::vector< int > &identity, const GElectronic &gtron)
Adds a GElectronic configuration with the provided identity.