EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
Loading...
Searching...
No Matches
Transformer.cpp
Go to the documentation of this file.
1
6#include "Transformer.hpp"
7
8#include <iostream>
9#include <stdexcept>
10#include <string>
11
13
15 return static_cast<int>(lookupTable.size()) * static_cast<int>(lookupTable[0].size());
16}
17
19
23void Transformer::setTransformValue(int row, int col, AlphabetIndex value) { lookupTable.at(row).at(col) = value; }
24
28AlphabetIndex Transformer::getTransformValue(int row, int col) const { return lookupTable.at(row).at(col); }
29
33void Transformer::fillTransformRow(int row, AlphabetIndex value) { lookupTable.at(row).fill(value); }
34
38void Transformer::copyTransformRow(int row, const std::array<AlphabetIndex, TRANSFORMER_SIZE>& values) {
39 lookupTable.at(row) = values;
40}
41
45const std::array<AlphabetIndex, TRANSFORMER_SIZE>& Transformer::getTransformRow(int row) const {
46 return lookupTable.at(row);
47}
Header file for the Transformer class.
TransformerType
Enum representing the type of transformer.
TransformerType getType() const
Returns the type of the transformer.
void setTransformValue(int row, int col, AlphabetIndex value)
Sets a value in the transformation lookup table.
Transformer()
Constructor for the Transformer class. Initializes the transformer type to NotDefined.
std::array< std::array< AlphabetIndex, TRANSFORMER_SIZE >, 2 > lookupTable
TransformerType type
const std::array< AlphabetIndex, TRANSFORMER_SIZE > & getTransformRow(int row) const
Gets a read-only reference to a row in the transformation lookup table. Useful for using standard alg...
AlphabetIndex getTransformValue(int row, int col) const
Gets a value from the transformation lookup table.
void copyTransformRow(int row, const std::array< AlphabetIndex, TRANSFORMER_SIZE > &values)
Copies a whole array into a row of the transformation lookup table.
int sizeOfLookupTable() const
Calculates the size of the transformation lookup table (LUT).
void fillTransformRow(int row, AlphabetIndex value)
Fills a row of the transformation lookup table with a specific value.