00001 /* 00002 * Copyright (C) 2008 Kamil Dudka <xdudka00@stud.fit.vutbr.cz> 00003 * 00004 * This file is part of rob08 00005 * 00006 * rob08 is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * any later version. 00010 * 00011 * rob08 is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with rob08. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef TERM_H 00021 #define TERM_H 00022 00023 #include "config.h" 00024 00025 #ifndef BUILDING_DOX 00026 # include <signal.h> 00027 # include <string> 00028 #endif 00029 00030 extern volatile sig_atomic_t bSignal; 00031 00035 class IErrorSensitive { 00036 public: 00037 virtual ~IErrorSensitive() { } 00041 virtual bool hasError() const = 0; 00042 }; 00043 00045 class IWriter: public IErrorSensitive { 00046 public: 00047 virtual ~IWriter() { } 00048 virtual bool writeAck() = 0; 00049 virtual bool writeByte(unsigned char data) = 0; 00050 virtual bool writeWord(unsigned int data) = 0; 00051 virtual bool writeText(const std::string &data) = 0; 00052 }; 00053 00054 class ICharReader { 00055 public: 00056 virtual ~ICharReader() { } 00057 virtual bool getChar(char &) = 0; 00058 virtual bool hasInput(int timeout) = 0; 00059 }; 00060 00061 class ITerm: public IWriter, public ICharReader { 00062 }; 00063 00064 class TermFactory { 00065 public: 00066 static ITerm* createTerm(const std::string &); 00067 private: 00068 TermFactory(); 00069 }; 00070 00071 #endif /* TERM_H */
1.5.4