|
EnigmaMachineCore 0.1.0
A modular Enigma Machine simulation in C++20
|
Class representing a reflector in the Enigma machine. This class inherits from the Transformer class and implements the functionality for transforming positions based on the reflector's transformation lookup table (LUT). Reflectors do not rotate, so the rotate function always returns 0. More...
#include <Reflector.hpp>
Inheritance diagram for Reflector:
Collaboration diagram for Reflector:Public Member Functions | |
| Reflector (const ReflectorConfig &config) | |
| Constructor for the Reflector class. Initializes the reflector with a configuration. Sets the type of the transformer to Reflector. | |
| Reflector (ReflectorConfig &&config) | |
| ~Reflector () override=default | |
| AlphabetIndex | transform (AlphabetIndex position, bool reverse=false) const override |
| Transforms the given position using the reflector's transformation lookup table (LUT). | |
| AlphabetIndex | transformForward (AlphabetIndex position) const override |
| Transforms the given position forward. | |
| AlphabetIndex | transformReverse (AlphabetIndex position) const override |
| Transforms the given position in reverse. | |
| int | rotate () override |
| Reflector does not rotate. | |
Public Member Functions inherited from Transformer | |
| Transformer () | |
| Constructor for the Transformer class. Initializes the transformer type to NotDefined. | |
| virtual | ~Transformer ()=default |
| 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. | |
Additional Inherited Members | |
Protected Member Functions inherited from Transformer | |
| 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 inherited from Transformer | |
| TransformerType | type |
Class representing a reflector in the Enigma machine. This class inherits from the Transformer class and implements the functionality for transforming positions based on the reflector's transformation lookup table (LUT). Reflectors do not rotate, so the rotate function always returns 0.
Definition at line 17 of file Reflector.hpp.
|
explicit |
Constructor for the Reflector class. Initializes the reflector with a configuration. Sets the type of the transformer to Reflector.
| config | The ReflectorConfig structure containing the wiring map. |
Definition at line 11 of file Reflector.cpp.
References Transformer::copyTransformRow(), Transformer::fillTransformRow(), Reflector, Transformer::type, and ReflectorConfig::wiring.
Here is the call graph for this function:
|
explicit |
Definition at line 23 of file Reflector.cpp.
References Transformer::copyTransformRow(), Transformer::fillTransformRow(), Reflector, and Transformer::type.
Here is the call graph for this function:
|
overridedefault |
|
inlineoverridevirtual |
Reflector does not rotate.
Implements Transformer.
Definition at line 62 of file Reflector.hpp.
|
overridevirtual |
Transforms the given position using the reflector's transformation lookup table (LUT).
| position | The input position to be transformed. |
| reverse | It should not be set to true. |
This method is const-qualified, ensuring that the signal transformation does not modify the internal state of the reflector.
Performs the signal reflection.
Implements Transformer.
Definition at line 36 of file Reflector.cpp.
References transformForward(), and transformReverse().
Here is the call graph for this function:
|
overridevirtual |
Transforms the given position forward.
| position | The current position (0 to TRANSFORMER_SIZE - 1). |
Implements the signal reflection at the end of the rotor sequence.
Reflects the input signal back towards the rotors.
Implements Transformer.
Definition at line 44 of file Reflector.cpp.
References Transformer::getTransformValue().
Referenced by transform().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Transforms the given position in reverse.
| position | The current position (0 to TRANSFORMER_SIZE - 1). |
Returns -1 for Reflector reverse transformations.
Implements Transformer.
Definition at line 50 of file Reflector.cpp.
References Transformer::getTransformValue().
Referenced by transform().
Here is the call graph for this function:
Here is the caller graph for this function: