#ifndef DIRECTOR_H #define DIRECTOR_H #include #include #include "session.h" typedef std::function stringFunc; struct OldValues { stringFunc server_line; stringFunc server_prompt; stringFunc client_input; bool to_client; }; class Director; // possibly setup a timer to call Dispatch. class Dispatch { protected: OldValues original; Director &d; public: Dispatch(Director &); virtual void server_line(const std::string &line); virtual void server_prompt(const std::string &prompt); virtual void client_input(const std::string &input); const std::string & get_prompt(void); void to_server(const std::string &send); void to_client(const std::string &send); }; class Director { private: Session &session; public: Director(Session &); void server_line(const std::string &line); void server_prompt(const std::string &prompt); void client_input(const std::string &input); // These would be called by the Dispatch -- // since it has direct access to us. void to_server(const std::string &send); void to_client(const std::string &send); const std::string& get_prompt(void); void set_server_line(stringFunc new_sl); void set_server_prompt(stringFunc new_sp); void set_client_input(stringFunc new_ci); OldValues get_state(void); // save state and reset to blanks/nullptr void restore_state(OldValues); private: stringFunc server_line_; stringFunc server_prompt_; stringFunc client_input_; bool to_client_; // Send server input to the client // bool client_to_server; // WHEN would I ever have the client talking // directly to the server? [NEVER] }; #endif