Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/shell/shell_buffer.h @ 5174

Last change on this file since 5174 was 5174, checked in by bensch, 19 years ago

orxonox/trunk: ShellBuffer is extern to Shell now… (But NOT used in Shell yet)

File size: 2.0 KB
Line 
1/*!
2 * @file shell_buffer.h
3 * @brief The Shell buffer Tasks
4*/
5
6#ifndef _SHELL_BUFFER_H
7#define _SHELL_BUFFER_H
8
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
13// FORWARD DECLARATION
14template<class T> class tList;
15template<class T> class tIterator;
16
17//! A class for ...
18class ShellBuffer {
19
20 public:
21  virtual ~ShellBuffer();
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; };
24
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
35  private:
36    ShellBuffer();
37
38
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
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.
47   bool                     keepBuffer;                         //!< if the keepbuffer contains unfinished lines.
48
49   unsigned long            lineCount;                          //!< how many Lines have been written out so far.
50};
51
52#endif /* _SHELL_BUFFER_H */
Note: See TracBrowser for help on using the repository browser.