Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7374 in orxonox.OLD for trunk/src/lib/shell/shell_buffer.h


Ignore:
Timestamp:
Apr 26, 2006, 3:28:55 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: added new Files shell_completion_plugin for the new Plugin Structure.
Also created the first namespace: OrxShell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_buffer.h

    r7329 r7374  
    1414#define      SHELL_BUFFER_SIZE       16384         //!< The Size of the input-buffers (should be large enough to carry any kind of input)
    1515
    16 // FORWARD DECLARATION
    17 class Shell;
     16namespace OrxShell
     17{
     18  // FORWARD DECLARATION
     19  class Shell;
    1820
    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  {
    2224
    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 */
     30inline static bool isInstanciated() { return (ShellBuffer::singletonRef == NULL)?false:true; };
    2531
    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);
    3234
    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; };
    3545
    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;
    4847
    4948  private:
     
    6362
    6463    static SDL_mutex*        bufferMutex;                        //!< Only one thread may write into the ShellBuffer at a time.
    65 };
     64  };
     65
     66}
    6667
    6768#endif /* _SHELL_BUFFER_H */
Note: See TracChangeset for help on using the changeset viewer.