Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 16, 2008, 3:46:25 AM (17 years ago)
Author:
landauf
Message:

added comments to all my classes in util

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/OutputBuffer.h

    r1747 r1791  
    2727 */
    2828
     29/**
     30    @file OutputBuffer.h
     31    @brief Declaration of the OutputBuffer class.
     32
     33    The OutputBuffer acts almost like std::ostream. You can put text and other values to the
     34    OutputBuffer by using the << operator. The OutputBuffer stores the text and calls registerd
     35    listeners if new text gets assigned.
     36    The listeners are then able to retrieve the text line by line.
     37
     38    It's important to know that getLine actually removes the line from the OutputBuffer, so it's
     39    better to only have one "active" listener.
     40*/
     41
    2942#ifndef _OutputBuffer_H__
    3043#define _OutputBuffer_H__
     
    3851namespace orxonox
    3952{
     53    /**
     54        @brief A pure virtual baseclass for classes that want to register as listener to an OutputBuffer.
     55
     56        This class is pure virtual, so an inheriting class has to implement the function on it's own.
     57        The function get's called, if an instance of the inheriting class registers as a listener at
     58        an OutputBuffer and this buffer changes.
     59    */
    4060    class _UtilExport OutputBufferListener
    4161    {
     
    4969    };
    5070
     71    /**
     72        @brief The OutputBuffer acts almost like std::ostream and stores the assigned text.
     73
     74        If text gets assigned by using the << operator or another function, the OutputBuffer
     75        calls it's listeners, allowing them to retrieve the text line by line.
     76
     77        It's important to know that getLine actually removes the line from the OutputBuffer, so it's
     78        better to only have one "active" listener.
     79    */
    5180    class _UtilExport OutputBuffer
    5281    {
     
    5584            ~OutputBuffer() {}
    5685
     86            /**
     87                @brief Puts some object/value to the OutputBuffer. The text gets assigned and the OutputBuffer calls it's listeners.
     88                @param object The object/value to assign
     89            */
    5790            template <class T>
    5891            inline OutputBuffer& operator<<(T object)
     
    6396            }
    6497
     98            /**
     99                @brief Reads the stored text of the other OutputBuffer and calls the listeners.
     100                @param object The other OutputBuffer
     101            */
    65102            template <const OutputBuffer&>
    66103            inline OutputBuffer& operator<<(const OutputBuffer& object)
     
    75112            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
    76113
     114            /**
     115                @brief Does the same like operator<<: Assigns the object to the stream and calls the listeners.
     116                @param object The object/value
     117            */
    77118            template <class T>
    78119            inline void add(T object)
     
    82123            }
    83124
     125            /**
     126                @brief Assigns an object/value and adds std::endl.
     127                @param object The object/value
     128            */
    84129            template <class T>
    85130            inline void addLine(T object)
     
    89134            }
    90135
     136            /**
     137                @brief Puts std::endl to the stream and calls the listeners.
     138            */
    91139            inline void newline()
    92140            {
     
    95143            }
    96144
     145            /**
     146                @brief Flushes the stored text (~empties the OutputBuffer).
     147            */
    97148            inline void flush()
    98149            {
     
    105156            void unregisterListener(OutputBufferListener* listener);
    106157
     158            /**
     159                @brief Returns the internal stringstream object.
     160            */
    107161            inline std::stringstream& getStream()
    108                 { return this->stream_; }
     162            {
     163                return this->stream_;
     164            }
    109165
    110166        private:
    111167            void callListeners();
    112168
    113             std::stringstream stream_;
    114             std::list<OutputBufferListener*> listeners_;
     169            std::stringstream stream_;                   //! The stringstream that stores the assigned text
     170            std::list<OutputBufferListener*> listeners_; //! A list of all listeners
    115171    };
    116172}
Note: See TracChangeset for help on using the changeset viewer.