// Enigma.h #ifndef ENIGMA_CLASS #define ENIGMA_CLASS #include #include "Coder.h" class Enigma{ Coder wheel[5]; // The five wheels to choose from Coder * first; // First wheel in machine (could be 1,2,3,4,5) Coder * second; // Second wheel Coder * third; // Third wheel int offset; // number of cogs by which wheel has rotated char command; // 'e' for encipher or 'd' for decipher std::vector message; // message to be enciphered/deciphered int cog1; // amount 1st wheel turns int cog2; // amount 2nd wheel turns int cog3; // amount 3rd wheel turns public: // Default Constructor sets wheel #s and offsets to 0 Enigma(); // Copy Constructor Enigma(const Enigma & other); // accessor for command // returns either 'e' or 'd' char getCommand(); // mutator for command void setCommand(char); // strips caps, white space and // punctuation from message // converts all alphabetics to lowercase void stripMessage(); // Creates the wheels (Coder objects) given the five inputs void initializeWheels(); // Prints the plaintext letters and cipher letters // of each wheel as a check void printWheels(); // reads and sets command void readAndSetCommand(); // Reads in which wheels are designated for use void readAndSetWheelNumbers(); // Reads in the position at which the wheels are originally set void readAndSetWheelCogs(); // Reads in the three characters that will be deleted // (could be spaces) void readAndSetEraseChar(); // Reads in the message to be translated void readAndSetMessage(); // Enciphers the message through the three wheels designated // calls encipherSpin() void encipher(); // Deciphers the message back through all three wheels // calls decipherSpin() void decipher(); // Changes the message to the message input void setMessage(std::vector messageIn); std::vector getMessage(); // prints message for input checking void printMessage() const; // Sets a pointer such as *first to point to a designated // wheel such as one void setWheelNumber(Coder *&, int num); // enciphers with the wheels spinning // calls augmentOffset() and traverseOffset() void encipherSpin(Coder *); // deciphers with the wheels spinning (backwards) void decipherSpin(Coder *); // increases offset by c each time // the wheel spins (called by encipherSpin) void augmentOffset(int c); // moves offset amount down the list for enciphering void traverseOffset( Node*& curr ); // moves offset amount down the list for deciphering void traverseOffsetBackwards( Node*& curr ); private: // initializes the data members of this class void init(); // deep copy used in copy constructor and assignment operator void copy(const Enigma & data); // YOU MAY INCLUDE OTHER PRIVATE FUNCTIONS HERE // YOU MAY USE HELPER FUNCTIONS FOR RECURSION }; #endif // ENIGMA_CLASS