#ifndef _INPUTOUTPUT_H #define _INPUTOUTPUT_H #define ASYNC 1 #define SYNC 0 #include "ReportCommand.h" using namespace std; //base class for Input/Output commands (WebServer or Stdin) //takes a ReportCommand to pass requests to //and recieves back output commands class InputOutput { protected: ReportCommand *m_rc; int m_mode; public: InputOutput(ReportCommand *_rc): m_rc(_rc) {} //exceptions class InvalidSocket {}; class InvalidRequest {}; virtual int listen(const int _mode = ASYNC) {m_mode = _mode; return 0;} virtual int shutdown() {return 0;} virtual int send(const char *responsepart) const = 0; virtual int sendHandshake(const int hs, const char *param = 0) const {return 0;} }; //standard stdout InputOutput class class STDOut: public InputOutput { bool m_run; public: STDOut(ReportCommand *_rc): InputOutput(_rc) {} int send(const char *responsepart) const {cout << responsepart << "\n"; return 0;} int listen(const int mode = ASYNC); int shutdown(); }; #endif