Changeset 2053


Ignore:
Timestamp:
Sep 6, 2009, 7:55:57 PM (14 years ago)
Author:
Peter
Message:

docs for StreamRedirector?. refs #521

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/StreamRedirect.h

    r2052 r2053  
    3838     \brief Redirect a stream to another stream.
    3939
    40      
     40     This class can be used to redirect a stream so it uses the buffer
     41     of another stream. This another stream is either a stream
     42     provided by the caller or if the caller provide a string the an
     43     internal fstream is created. In the destructor the stream is
     44     restored to use its own buffer. See documentation of CommandLine
     45     for an example of usage.
    4146
    4247     \note It is important that an instance of this class is
     
    5358  public:
    5459    /**
    55        Constructor for ostream
     60       \brief redirect istream to another istream
    5661
    5762       \a is1 is redirected to get its input from the buffer of \a is2
     
    6671   
    6772    /**
    68        Constructor for istream
    69 
    70        If \a active is false, the class does nothing.
    71     */
    72     BasicStreamRedirect(std::basic_istream<charT, traits>& os1,
     73       \brief redirect istream to ifstream.
     74
     75       An ifstream with path \a file is created, and \a is is
     76       redirected to get its input from the buffer of this ifstream.
     77
     78       If \a active is false, the class does nothing.
     79    */
     80    BasicStreamRedirect(std::basic_istream<charT, traits>& is,
    7381                        const std::string& file, bool active=true);
    7482   
    7583    /**
    76        Constructor for ostream
     84       \brief redirect ostream to another ostream
    7785
    7886       \a os1 is redirected to send its output to the buffer of \a os2
     
    8795   
    8896    /**
    89        Constructor for ostream
    90 
    91        If \a active is false, the class does nothing.
    92     */
    93     BasicStreamRedirect(std::basic_ostream<charT, traits>& os1,
     97       \brief redirect ostream to ofstream.
     98
     99       An ofstream with path \a file is created, and \a os is
     100       redirected to send its output to the buffer of this ofstream.
     101
     102       If \a active is false, the class does nothing.
     103    */
     104    BasicStreamRedirect(std::basic_ostream<charT, traits>& os,
    94105                        const std::string& file, bool active=true);
    95106   
     
    101112
    102113       \note It is important that the stream held is not deallocated
    103        before this object is destroyed. 1) The behavior of this
    104        destructor is undefined. 2) The stream destroys the streambuf
    105        in its destructor, so if the stream is destroyed before it is
    106        restored, the streambuf will likely be deallocated twice. In
    107        addition, the original streambuf of the stream will not be
    108        closed and deallocated; hence a memory and resource leak.
     114       before this object is destroyed. There are two reasons for
     115       this: 1) The behavior of this destructor is undefined. 2) The
     116       stream destroys the streambuf in its destructor, so if the
     117       stream is destroyed before it is restored, the streambuf will
     118       likely be deallocated twice. In addition, the original
     119       streambuf of the stream will not be closed and deallocated;
     120       hence a memory and resource leak.
    109121    */
    110122    ~BasicStreamRedirect(void);
Note: See TracChangeset for help on using the changeset viewer.