7std::string GTranslationTable::formTTKey(
const std::vector<int> &identity)
const {
10 if (identity.empty()) {
11 log->warning(
"Empty identity vector provided to formTTKey");
16 std::ostringstream oss;
17 for (
size_t i = 0; i < identity.size(); ++i) {
19 if (i != identity.size() - 1)
28 std::string ttKey = formTTKey(identity);
29 const bool inserted = tt.try_emplace(ttKey, gtron).second;
32 log->warning(
"Key <" + ttKey +
"> already present in TT map");
36 log->info(1, inserted ?
"Added" :
"Preserved",
" GElectronic with identity <", ttKey,
"> in TT map");
40 for (
auto &thisItem: tt) {
48 std::string ttKey = formTTKey(identity);
49 auto search = tt.find(ttKey);
51 if (search == tt.end()) {
55 log->debug(
NORMAL,
"Retrieved Electronic using key <", ttKey,
"> in TT map: ", search->second);
56 return search->second;
std::shared_ptr< GLogger > log
const GElectronic & getElectronics(const std::vector< int > &identity) const
Retrieves the electronics configuration associated with a given identity vector.
void addGElectronicWithIdentity(const std::vector< int > &identity, const GElectronic >ron)
Registers an electronics configuration for a given identity vector.
Conventions (primarily exit/error codes) for the Translation Table module.
constexpr int EC__TTNOTFOUNDINTT
Error code used when a translation table entry is not found for a given key.