Changeset 9861 in orxonox.OLD for branches/new_class_id/src/lib/util/debug_buffer.h
- Timestamp:
- Oct 1, 2006, 1:37:36 PM (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/debug_buffer.h
r9859 r9861 1 1 /*! 2 * @file shell_buffer.h3 * @brief The Shellbuffer Tasks2 * @file debug_buffer.h 3 * @brief The Debug buffer Tasks 4 4 * @see debug.h 5 5 */ 6 6 7 #ifndef _ SHELL_BUFFER_H8 #define _ SHELL_BUFFER_H7 #ifndef _DEBUG_BUFFER_H 8 #define _DEBUG_BUFFER_H 9 9 10 10 #include <string> 11 11 #include <list> 12 #include <stdarg.h>13 12 14 #define SHELL_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input)13 #define DEBUG_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input) 15 14 16 namespace OrxShell17 {18 15 //! A class handling output from orxonox via debug.h 19 16 /** 20 * the ShellBuffer redirects output from PRINTF(x) to the Shelland STDOUT21 * the ShellBuffer is a front-filling queue of limited length, that has the17 * the DebugBuffer redirects output from PRINTF(x) to the Debug and STDOUT 18 * the DebugBuffer is a front-filling queue of limited length, that has the 22 19 * youngest added Entry at the beginning, and the oldest at the end. 23 20 */ 24 class ShellBuffer21 class DebugBuffer 25 22 { 26 23 public: 27 virtual ~ ShellBuffer();24 virtual ~DebugBuffer(); 28 25 /** @returns a Pointer to the only object of this Class */ 29 inline static ShellBuffer* getInstance() { if (!ShellBuffer::singletonRef) ShellBuffer::singletonRef = new ShellBuffer(); return ShellBuffer::singletonRef; };26 inline static DebugBuffer* getInstance() { if (!DebugBuffer::singletonRef) DebugBuffer::singletonRef = new DebugBuffer(); return DebugBuffer::singletonRef; }; 30 27 /** @returns true if this class is instanciated, false otherwise */ 31 inline static bool isInstanciated() { return ( ShellBuffer::singletonRef == NULL)?false:true; };28 inline static bool isInstanciated() { return (DebugBuffer::singletonRef == NULL)?false:true; }; 32 29 33 30 static void addBufferLineStatic(const char* line, ...); … … 41 38 /** @returns the List of stings from the Buffer */ 42 39 const std::list<std::string>& getBuffer() const { return this->buffer; }; 43 /** @returns the Count of lines processed by the Shell. */40 /** @returns the Count of lines processed by the Debug. */ 44 41 inline unsigned long getLineCount() const { return this->lineCount; }; 45 42 /** @returns the Current Buffer Size. */ … … 49 46 50 47 private: 51 ShellBuffer();48 DebugBuffer(); 52 49 53 50 private: 54 static ShellBuffer* singletonRef; //!< The singleton-reference to the only memeber of this class.55 unsigned int maxBufferSize; 51 static DebugBuffer* singletonRef; //!< The singleton-reference to the only memeber of this class. 52 unsigned int maxBufferSize; //!< The Size of the buffer 56 53 57 std::string keepBuffer; //!< a BUFFER to have multi-non-newLine commands be copied into the shell.54 std::string keepBuffer; //!< a BUFFER to have multi-non-newLine commands be copied into the debug. 58 55 59 56 unsigned long lineCount; //!< how many Lines have been written out so far. 60 57 61 58 // The Beginning of buffer (buffer.front()) is the last added line. 62 static char bufferArray[ SHELL_BUFFER_SIZE]; //!< a BUFFER for fast writing59 static char bufferArray[DEBUG_BUFFER_SIZE]; //!< a BUFFER for fast writing 63 60 static std::list<std::string> buffer; //!< A list of stored char-arrays(strings) to store the history 64 61 }; 65 62 66 } 67 68 #endif /* _SHELL_BUFFER_H */ 63 #endif /* _DEBUG_BUFFER_H */
Note: See TracChangeset
for help on using the changeset viewer.