deal2lkit: A ToolKit library for Deal.II
OverWriteStream< Stream > Class Template Reference

This class uses n_lines lines of stream_out to show the output. More...

#include <utilities.h>

Public Member Functions

 OverWriteStream (unsigned int n_lines=1, Stream &stream_out=std::cout, unsigned int width=60)
 
 ~OverWriteStream ()
 Flush output at the end so that we don't make a mess with the console. More...
 
template<typename OBJ >
OverWriteStream< Stream > & operator<< (OBJ &o)
 
OverWriteStream< Stream > & operator<< (std::ostream &(*p)(std::ostream &))
 
Stream & get_stream ()
 
void end ()
 Move the cursor at the end of the output. More...
 
void clear (bool force=false)
 Clear the next n lines, return back to the original point, and reset the clear flag if force is set to true, otherwise do this only if the internal counter is set to zero, i.e., we are at the beginning of the next n lines. More...
 
unsigned int get_shell_rows ()
 It returns the number of rows of the current shell. More...
 
unsigned int get_shell_cols ()
 It returns the number of coloumns of the current shell. More...
 
int get_current_line ()
 It returns current line of the stream. More...
 

Private Attributes

unsigned int cols_shell
 
unsigned int rows_shell
 
const unsigned int n_lines
 
const unsigned int width
 
bool clear_next
 
unsigned int current_line
 
Stream & stream_out
 

Friends

template<typename S , typename T >
OverWriteStream< S > & operator<< (OverWriteStream< S > &, const T &)
 

Detailed Description

template<typename Stream>
class OverWriteStream< Stream >

This class uses n_lines lines of stream_out to show the output.

Everytime it reaches the last line it comes back to the first line and rewrites the line.

The constructor takes as argument a stream for the output stream_out (default = std::cout), the number of lines n_lines, and the width of the output.

Definition at line 185 of file utilities.h.

Constructor & Destructor Documentation

§ OverWriteStream()

template<typename Stream>
OverWriteStream< Stream >::OverWriteStream ( unsigned int  n_lines = 1,
Stream &  stream_out = std::cout,
unsigned int  width = 60 
)
inline

Definition at line 200 of file utilities.h.

§ ~OverWriteStream()

template<typename Stream>
OverWriteStream< Stream >::~OverWriteStream ( )
inline

Flush output at the end so that we don't make a mess with the console.

Definition at line 221 of file utilities.h.

Member Function Documentation

§ clear()

template<typename Stream>
void OverWriteStream< Stream >::clear ( bool  force = false)
inline

Clear the next n lines, return back to the original point, and reset the clear flag if force is set to true, otherwise do this only if the internal counter is set to zero, i.e., we are at the beginning of the next n lines.

Definition at line 320 of file utilities.h.

§ end()

template<typename Stream>
void OverWriteStream< Stream >::end ( )
inline

Move the cursor at the end of the output.

It is needed to avoid to rewrite useful lines. Finally, this method delete the class.

Definition at line 305 of file utilities.h.

§ get_current_line()

template<typename Stream>
int OverWriteStream< Stream >::get_current_line ( )
inline

It returns current line of the stream.

Definition at line 374 of file utilities.h.

§ get_shell_cols()

template<typename Stream>
unsigned int OverWriteStream< Stream >::get_shell_cols ( )
inline

It returns the number of coloumns of the current shell.

Definition at line 366 of file utilities.h.

§ get_shell_rows()

template<typename Stream>
unsigned int OverWriteStream< Stream >::get_shell_rows ( )
inline

It returns the number of rows of the current shell.

Definition at line 358 of file utilities.h.

§ get_stream()

template<typename Stream>
Stream& OverWriteStream< Stream >::get_stream ( )
inline

Definition at line 295 of file utilities.h.

§ operator<<() [1/2]

template<typename Stream>
template<typename OBJ >
OverWriteStream<Stream>& OverWriteStream< Stream >::operator<< ( OBJ &  o)
inline

Definition at line 228 of file utilities.h.

§ operator<<() [2/2]

template<typename Stream>
OverWriteStream<Stream>& OverWriteStream< Stream >::operator<< ( std::ostream &(*)(std::ostream &)  p)
inline

Definition at line 235 of file utilities.h.

Friends And Related Function Documentation

§ operator<<

template<typename Stream>
template<typename S , typename T >
OverWriteStream<S>& operator<< ( OverWriteStream< S > &  output_stream,
const T &  t 
)
friend

Definition at line 395 of file utilities.h.

Member Data Documentation

§ clear_next

template<typename Stream>
bool OverWriteStream< Stream >::clear_next
private

Definition at line 385 of file utilities.h.

§ cols_shell

template<typename Stream>
unsigned int OverWriteStream< Stream >::cols_shell
private

Definition at line 380 of file utilities.h.

§ current_line

template<typename Stream>
unsigned int OverWriteStream< Stream >::current_line
private

Definition at line 387 of file utilities.h.

§ n_lines

template<typename Stream>
const unsigned int OverWriteStream< Stream >::n_lines
private

Definition at line 383 of file utilities.h.

§ rows_shell

template<typename Stream>
unsigned int OverWriteStream< Stream >::rows_shell
private

Definition at line 381 of file utilities.h.

§ stream_out

template<typename Stream>
Stream& OverWriteStream< Stream >::stream_out
private

Definition at line 389 of file utilities.h.

§ width

template<typename Stream>
const unsigned int OverWriteStream< Stream >::width
private

Definition at line 384 of file utilities.h.


The documentation for this class was generated from the following file: