1 /* 2 * cTextViewerDriver_Base.h 3 * Avida 4 * 5 * Copyright 1999-2009 Michigan State University. All rights reserved. 6 * 7 * 8 * This file is part of Avida. 9 * 10 * Avida is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 11 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 12 * 13 * Avida is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License along with Avida. 17 * If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 #ifndef cTextViewerDriver_Base_h 22 #define cTextViewerDriver_Base_h 23 24 #include "avida/core/WorldDriver.h" 25 26 #include <sstream> 27 #include <iostream> 28 29 class cAvidaContext; 30 class cView_Base; 31 class cWorld; 32 33 using namespace Avida; 34 35 36 class cTextViewerDriver_Base : public WorldDriver { 37 protected: 38 cWorld* m_world; 39 cView_Base* m_view; 40 bool m_done; // This is set to true when run should finish. 41 bool m_pause; 42 43 std::stringstream out_stream; 44 std::stringstream err_stream; 45 46 // Protected constructor. 47 cTextViewerDriver_Base(cWorld * world); 48 ~cTextViewerDriver_Base(); 49 50 public: 51 // Override standard output and error. IsInteractive()52 bool IsInteractive() { return true; } 53 void Flush(); 54 55 bool ProcessKeypress(cAvidaContext& ctx, int keypress); 56 57 virtual void Run() = 0; 58 }; 59 60 #endif 61