|
EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
|
Base class for transformers (rotors and reflectors). This class provides the interface for transforming positions and initializing transformation lookup tables (LUT). More...
#include <Transformer.hpp>
Inheritance diagram for Transformer:Public Member Functions | |
| Transformer () | |
| Constructor for the Transformer class. Initializes the transformer type to NotDefined. | |
| virtual | ~Transformer ()=default |
| virtual AlphabetIndex | transform (AlphabetIndex position, bool reverse=false) const =0 |
| virtual AlphabetIndex | transformForward (AlphabetIndex position) const =0 |
| Transforms the given position forward. | |
| virtual AlphabetIndex | transformReverse (AlphabetIndex position) const =0 |
| Transforms the given position in reverse. | |
| virtual int | rotate ()=0 |
| virtual void | setPosition (int) |
| virtual int | getPosition () const |
| int | sizeOfLookupTable () const |
| Calculates the size of the transformation lookup table (LUT). | |
| TransformerType | getType () const |
| Returns the type of the transformer. | |
Protected Member Functions | |
| void | setTransformValue (int row, int col, AlphabetIndex value) |
| Sets a value in the transformation lookup table. | |
| AlphabetIndex | getTransformValue (int row, int col) const |
| Gets a value from the transformation lookup table. | |
| void | fillTransformRow (int row, AlphabetIndex value) |
| Fills a row of the transformation lookup table with a specific value. | |
| void | copyTransformRow (int row, const std::array< AlphabetIndex, TRANSFORMER_SIZE > &values) |
| Copies a whole array into a row of the transformation lookup table. | |
| 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 algorithms like std::find. | |
Protected Attributes | |
| TransformerType | type |
Private Attributes | |
| std::array< std::array< AlphabetIndex, TRANSFORMER_SIZE >, 2 > | lookupTable |
Base class for transformers (rotors and reflectors). This class provides the interface for transforming positions and initializing transformation lookup tables (LUT).
Definition at line 24 of file Transformer.hpp.
| Transformer::Transformer | ( | ) |
Constructor for the Transformer class. Initializes the transformer type to NotDefined.
Definition at line 12 of file Transformer.cpp.
|
virtualdefault |
|
protected |
Copies a whole array into a row of the transformation lookup table.
| row | The row index to copy into. |
| values | The array of values to copy. |
Definition at line 38 of file Transformer.cpp.
References lookupTable.
Referenced by Reflector::Reflector(), Reflector::Reflector(), Rotor::Rotor(), and Rotor::Rotor().
Here is the caller graph for this function:
|
protected |
Fills a row of the transformation lookup table with a specific value.
| row | The row index to fill. |
| value | The value to fill the row with. |
Definition at line 33 of file Transformer.cpp.
References lookupTable.
Referenced by Reflector::Reflector(), and Reflector::Reflector().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in Rotor.
Definition at line 106 of file Transformer.hpp.
|
protected |
Gets a read-only reference to a row in the transformation lookup table. Useful for using standard algorithms like std::find.
Gets a read-only reference to a row in the transformation lookup table.
| row | The row index to retrieve. |
Definition at line 45 of file Transformer.cpp.
References lookupTable.
Referenced by Rotor::initReverseLookupTable().
Here is the caller graph for this function:
|
protected |
Gets a value from the transformation lookup table.
| row | The row index (0 for forward, 1 for reverse). |
| col | The column index (input position 0-25). |
Definition at line 28 of file Transformer.cpp.
References lookupTable.
Referenced by Reflector::transformForward(), Rotor::transformForward(), Reflector::transformReverse(), and Rotor::transformReverse().
Here is the caller graph for this function:| TransformerType Transformer::getType | ( | ) | const |
Returns the type of the transformer.
Definition at line 18 of file Transformer.cpp.
References type.
|
inlinevirtual |
Reimplemented in Rotor.
Definition at line 105 of file Transformer.hpp.
|
protected |
Sets a value in the transformation lookup table.
| row | The row index (0 for forward, 1 for reverse). |
| col | The column index (input position 0-25). |
| value | The value to set (output position). |
Definition at line 23 of file Transformer.cpp.
References lookupTable.
Referenced by Rotor::initReverseLookupTable().
Here is the caller graph for this function:| int Transformer::sizeOfLookupTable | ( | ) | const |
Calculates the size of the transformation lookup table (LUT).
Definition at line 14 of file Transformer.cpp.
References lookupTable.
|
pure virtual |
|
pure virtual |
Transforms the given position forward.
| position | The current position (0 to TRANSFORMER_SIZE - 1). |
This method defines the primary signal path from right to left through the transformer.
|
pure virtual |
Transforms the given position in reverse.
| position | The current position (0 to TRANSFORMER_SIZE - 1). |
This method defines the return signal path from left to right through the transformer.
|
private |
Definition at line 26 of file Transformer.hpp.
Referenced by copyTransformRow(), fillTransformRow(), getTransformRow(), getTransformValue(), setTransformValue(), and sizeOfLookupTable().
|
protected |
Definition at line 29 of file Transformer.hpp.
Referenced by Reflector::Reflector(), Reflector::Reflector(), Rotor::Rotor(), Rotor::Rotor(), Transformer(), and getType().