Synergia AVR 0.1
|
00001 /* 00002 Copyright (c) 2010 Tymon Tobolski 00003 00004 Permission is hereby granted, free of charge, to any person obtaining 00005 a copy of this software and associated documentation files (the 00006 "Software"), to deal in the Software without restriction, including 00007 without limitation the rights to use, copy, modify, merge, publish, 00008 distribute, sublicense, and/or sell copies of the Software, and to 00009 permit persons to whom the Software is furnished to do so, subject to 00010 the following conditions: 00011 00012 The above copyright notice and this permission notice shall be 00013 included in all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00016 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00018 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00019 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00020 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00021 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 #ifndef _BUFFER_H_ 00025 #define _BUFFER_H_ 00026 00027 00034 struct BufferItem { 00035 char character; 00036 BufferItem* next; 00037 }; 00038 00047 class Buffer { 00048 public: 00049 00053 Buffer(); 00054 00060 void push(char c); 00061 00067 void pop(); 00068 00072 void clear(); 00073 00079 bool empty(); 00080 00087 char * front(); 00088 int size(); 00089 00096 unsigned char read(); 00097 00098 // private: 00099 int _size; 00100 BufferItem *_head, *_tail; 00101 }; 00102 00103 #endif