Changeset 7374 in orxonox.OLD for trunk/src/lib/shell/shell_buffer.h
- Timestamp:
- Apr 26, 2006, 3:28:55 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_buffer.h
r7329 r7374 14 14 #define SHELL_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input) 15 15 16 // FORWARD DECLARATION 17 class Shell; 16 namespace OrxShell 17 { 18 // FORWARD DECLARATION 19 class Shell; 18 20 19 #ifndef NULL 20 #define NULL 0 //!< a pointer to NULL 21 #endif 21 //! A class handling output from orxonox via debug.h 22 class ShellBuffer 23 { 22 24 23 //! A class handling output from orxonox via debug.h 24 class ShellBuffer { 25 public: 26 virtual ~ShellBuffer(); 27 /** @returns a Pointer to the only object of this Class */ 28 inline static ShellBuffer* getInstance() { if (!ShellBuffer::singletonRef) ShellBuffer::singletonRef = new ShellBuffer(); return ShellBuffer::singletonRef; }; 29 /** @returns true if this class is instanciated, false otherwise */ 30 inline static bool isInstanciated() { return (ShellBuffer::singletonRef == NULL)?false:true; }; 25 31 26 public: 27 virtual ~ShellBuffer(); 28 /** @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; }; 30 /** @returns true if this class is instanciated, false otherwise */ 31 inline static bool isInstanciated() { return (ShellBuffer::singletonRef == NULL)?false:true; }; 32 void registerShell(Shell* shell); 33 void unregisterShell(Shell* shell); 32 34 33 void registerShell(Shell* shell); 34 void unregisterShell(Shell* shell); 35 // BUFFER // 36 /** @param bufferSize the new Buffer-Size */ 37 void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; 38 void flush(); 39 static bool addBufferLineStatic(const char* line, ...); 40 void addBufferLine(const char* line, va_list arg); 41 /** @returns the List of stings from the Buffer */ 42 const std::list<std::string>& getBuffer() const { return this->buffer; }; 43 /** @returns the Count of lines processed by the Shell. */ 44 inline long getLineCount() const { return this->lineCount; }; 35 45 36 // BUFFER // 37 /** @param bufferSize the new Buffer-Size */ 38 void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; 39 void flush(); 40 static bool addBufferLineStatic(const char* line, ...); 41 void addBufferLine(const char* line, va_list arg); 42 /** @returns the List of stings from the Buffer */ 43 const std::list<std::string>& getBuffer() const { return this->buffer; }; 44 /** @returns the Count of lines processed by the Shell. */ 45 inline long getLineCount() const { return this->lineCount; }; 46 47 void debug() const; 46 void debug() const; 48 47 49 48 private: … … 63 62 64 63 static SDL_mutex* bufferMutex; //!< Only one thread may write into the ShellBuffer at a time. 65 }; 64 }; 65 66 } 66 67 67 68 #endif /* _SHELL_BUFFER_H */
Note: See TracChangeset
for help on using the changeset viewer.