gtranslationTable
Loading...
Searching...
No Matches
tt_example.cc
Go to the documentation of this file.
1// translationTable
2#include "gtranslationTable.h"
4
5// gemc
6#include "glogger.h"
7
8using std::vector;
9
10int main(int argc, char* argv[]) {
11 auto gopts = std::make_shared<GOptions>(argc, argv, gtranslationTable::defineOptions());
12 auto log = std::make_shared<GLogger>(gopts, SFUNCTION_NAME, TRANSLATIONTABLE_LOGGER); // duplicate logger
13
14 vector<int> element1 = {1, 2, 3, 4, 5};
15 vector<int> element2 = {2, 2, 3, 4, 5};
16
17 GElectronic crate1(2, 1, 3, 2);
18 GElectronic crate2(2, 1, 4, 2);
19
20 GTranslationTable translationTable(gopts);
21
22 translationTable.addGElectronicWithIdentity(element1, crate1);
23 translationTable.addGElectronicWithIdentity(element2, crate2);
24
25 GElectronic retrievedElectronic = translationTable.getElectronics(element1);
26
27 log->info(0, "Retrieved electronic: ", retrievedElectronic);
28
29 return EXIT_SUCCESS;
30}
Provides a translation table for GElectronic objects indexed by a vector-based identity.
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.
constexpr const char * TRANSLATIONTABLE_LOGGER
int main(int argc, char *argv[])
Definition tt_example.cc:10