Last change
on this file since 5174 was
5174,
checked in by bensch, 20 years ago
|
orxonox/trunk: ShellBuffer is extern to Shell now… (But NOT used in Shell yet)
|
File size:
2.0 KB
|
Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[5173] | 2 | * @file shell_buffer.h |
---|
| 3 | * @brief The Shell buffer Tasks |
---|
[3245] | 4 | */ |
---|
[1853] | 5 | |
---|
[5173] | 6 | #ifndef _SHELL_BUFFER_H |
---|
| 7 | #define _SHELL_BUFFER_H |
---|
[1853] | 8 | |
---|
[5173] | 9 | #include <stdarg.h> |
---|
| 10 | |
---|
| 11 | #define SHELL_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input) |
---|
| 12 | |
---|
[4838] | 13 | // FORWARD DECLARATION |
---|
[5173] | 14 | template<class T> class tList; |
---|
| 15 | template<class T> class tIterator; |
---|
[3543] | 16 | |
---|
[3955] | 17 | //! A class for ... |
---|
[5173] | 18 | class ShellBuffer { |
---|
[1853] | 19 | |
---|
[1904] | 20 | public: |
---|
[5173] | 21 | virtual ~ShellBuffer(); |
---|
[5174] | 22 | /** @returns a Pointer to the only object of this Class */ |
---|
| 23 | inline static ShellBuffer* getInstance() { if (!ShellBuffer::singletonRef) ShellBuffer::singletonRef = new ShellBuffer(); return ShellBuffer::singletonRef; }; |
---|
[1853] | 24 | |
---|
[5173] | 25 | // BUFFER // |
---|
| 26 | /** @param bufferSize the new Buffer-Size */ |
---|
| 27 | void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; |
---|
| 28 | void flushBuffers(); |
---|
| 29 | static bool addBufferLineStatic(const char* line, ...); |
---|
| 30 | void addBufferLine(const char* line, va_list arg); |
---|
| 31 | void moveBuffer(unsigned int lineCount); |
---|
| 32 | // void moveBufferTo(unsigned int lineNumber); |
---|
| 33 | const char* getBufferLine(unsigned int lineNumber); |
---|
| 34 | |
---|
[5174] | 35 | private: |
---|
| 36 | ShellBuffer(); |
---|
[5173] | 37 | |
---|
[3245] | 38 | |
---|
[5174] | 39 | private: |
---|
| 40 | static ShellBuffer* singletonRef; //!< The singleton-reference to the only memeber of this class. |
---|
| 41 | unsigned int bufferSize; //!< The Size of the buffer |
---|
| 42 | tList<char>* buffer; //!< A list of stored char-arrays(strings) to store the history |
---|
| 43 | tIterator<char>* bufferIterator; //!< An iterator for the Shells main buffer. |
---|
| 44 | |
---|
[5173] | 45 | char bufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER for fast writing |
---|
| 46 | char keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell. |
---|
[5174] | 47 | bool keepBuffer; //!< if the keepbuffer contains unfinished lines. |
---|
[5173] | 48 | |
---|
[5174] | 49 | unsigned long lineCount; //!< how many Lines have been written out so far. |
---|
[1853] | 50 | }; |
---|
| 51 | |
---|
[5173] | 52 | #endif /* _SHELL_BUFFER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.