REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | Related Functions
TRestStringOutput Class Reference

Detailed Description

This class serves as an universal std::string output tool, aiming at leveling, rendering, and auto saving for the output message.

To use this tool class in the other classes, include this header file. You will get several global output objects: fout, info, essential, debug, etc. they works similarly as std::cout: fout<<"hello world"<<endl;. It is also possible to initialize a local TRestStringOutput object. Then one can customize output color, border and orientation on that.

Definition at line 148 of file TRestStringOutput.h.

#include <TRestStringOutput.h>

Public Types

enum class  REST_Display_Orientation { kLeft = 1 , kMiddle = 0 }
 Enumerate of TRestStringOutput display orientation. More...
 
enum class  REST_Verbose_Level {
  REST_Silent = 0 , REST_Essential = 1 , REST_Warning = REST_Essential , REST_Info = 2 ,
  REST_Debug = 3 , REST_Extreme = 4
}
 Enumerate of verbose level, containing five levels. More...
 

Public Member Functions

void flushstring ()
 
std::string FormattingPrintString (std::string input)
 
std::string GetBuffer ()
 
REST_Verbose_Level GetVerboseLevel ()
 
bool isError ()
 
TRestStringOutputoperator<< (endl_t et)
 
template<class T >
TRestStringOutputoperator<< (T const &content)
 
TRestStringOutputoperator<< (void(*pfunc)(TRestStringOutput &))
 
void resetborder ()
 
void resetcolor ()
 
void resetheader ()
 
void resetorientation ()
 
void resetstring ()
 
void setborder (std::string b)
 
void setcolor (COLORCODE_TYPE colordef)
 
void setheader (std::string headerdef)
 
void setlength (int n)
 
void setorientation (REST_Display_Orientation o)
 
 TRestStringOutput (COLORCODE_TYPE color=COLOR_RESET, std::string formatter="", REST_Display_Orientation orientation=TRestStringOutput::REST_Display_Orientation::kLeft)
 
 TRestStringOutput (REST_Verbose_Level v, COLORCODE_TYPE _color=COLOR_RESET, std::string formatter="", REST_Display_Orientation orientation=TRestStringOutput::REST_Display_Orientation::kLeft, bool _iserror=false)
 

Static Public Member Functions

static void RESTendl (TRestStringOutput &input)
 

Protected Attributes

std::stringstream buf
 
COLORCODE_TYPE color
 
std::string formatstring
 
bool iserror
 
int length
 
REST_Display_Orientation orientation
 
bool useborder
 
REST_Verbose_Level verbose
 

Friends

TRestStringOutputoperator<< (TRestMetadata &mt, TRestStringOutput &so)
 

Related Functions

(Note that these are not member functions.)

void PrintWelcome ()
 

Member Enumeration Documentation

◆ REST_Display_Orientation

Enumerate of TRestStringOutput display orientation.

Definition at line 163 of file TRestStringOutput.h.

◆ REST_Verbose_Level

Enumerate of verbose level, containing five levels.

Enumerator
REST_Silent 

show minimum information of the software, as well as error messages

REST_Essential 

+show some essential information, as well as warnings

REST_Info 

+show most of the information for each steps

REST_Debug 

+show the defined debug messages

REST_Extreme 

show everything

Definition at line 152 of file TRestStringOutput.h.

Constructor & Destructor Documentation

◆ TRestStringOutput() [1/2]

TRestStringOutput::TRestStringOutput ( COLORCODE_TYPE  color = COLOR_RESET,
std::string  formatter = "",
REST_Display_Orientation  orientation = TRestStringOutput::REST_Display_Orientation::kLeft 
)

Definition at line 195 of file TRestStringOutput.cxx.

◆ TRestStringOutput() [2/2]

TRestStringOutput::TRestStringOutput ( REST_Verbose_Level  v,
COLORCODE_TYPE  _color = COLOR_RESET,
std::string  formatter = "",
REST_Display_Orientation  orientation = TRestStringOutput::REST_Display_Orientation::kLeft,
bool  _iserror = false 
)
inline

Definition at line 208 of file TRestStringOutput.h.

Member Function Documentation

◆ flushstring()

void TRestStringOutput::flushstring ( )

Definition at line 309 of file TRestStringOutput.cxx.

◆ FormattingPrintString()

string TRestStringOutput::FormattingPrintString ( std::string  input)

Definition at line 238 of file TRestStringOutput.cxx.

◆ GetBuffer()

std::string TRestStringOutput::GetBuffer ( )
inline

Definition at line 179 of file TRestStringOutput.h.

◆ GetVerboseLevel()

REST_Verbose_Level TRestStringOutput::GetVerboseLevel ( )
inline

Definition at line 178 of file TRestStringOutput.h.

◆ isError()

bool TRestStringOutput::isError ( )
inline

Definition at line 180 of file TRestStringOutput.h.

◆ operator<<() [1/3]

TRestStringOutput & TRestStringOutput::operator<< ( endl_t  et)

Definition at line 2629 of file TRestMetadata.cxx.

◆ operator<<() [2/3]

template<class T >
TRestStringOutput & TRestStringOutput::operator<< ( T const &  content)
inline

Definition at line 218 of file TRestStringOutput.h.

◆ operator<<() [3/3]

TRestStringOutput & TRestStringOutput::operator<< ( void(*)(TRestStringOutput &)  pfunc)

Definition at line 335 of file TRestStringOutput.cxx.

◆ resetborder()

void TRestStringOutput::resetborder ( )
inline

Definition at line 195 of file TRestStringOutput.h.

◆ resetcolor()

void TRestStringOutput::resetcolor ( )
inline

Definition at line 189 of file TRestStringOutput.h.

◆ resetheader()

void TRestStringOutput::resetheader ( )
inline

Definition at line 190 of file TRestStringOutput.h.

◆ resetorientation()

void TRestStringOutput::resetorientation ( )
inline

Definition at line 198 of file TRestStringOutput.h.

◆ resetstring()

void TRestStringOutput::resetstring ( )

Definition at line 233 of file TRestStringOutput.cxx.

◆ RESTendl()

static void TRestStringOutput::RESTendl ( TRestStringOutput input)
inlinestatic

Definition at line 199 of file TRestStringOutput.h.

◆ setborder()

void TRestStringOutput::setborder ( std::string  b)
inline

Definition at line 191 of file TRestStringOutput.h.

◆ setcolor()

void TRestStringOutput::setcolor ( COLORCODE_TYPE  colordef)
inline

Definition at line 184 of file TRestStringOutput.h.

◆ setheader()

void TRestStringOutput::setheader ( std::string  headerdef)
inline

Definition at line 185 of file TRestStringOutput.h.

◆ setlength()

void TRestStringOutput::setlength ( int  n)

Definition at line 285 of file TRestStringOutput.cxx.

◆ setorientation()

void TRestStringOutput::setorientation ( REST_Display_Orientation  o)
inline

Definition at line 197 of file TRestStringOutput.h.

Friends And Related Function Documentation

◆ PrintWelcome()

void PrintWelcome ( )
related

print a welcome message by calling shell script "rest-config"

Definition at line 230 of file TRestStringOutput.h.

Field Documentation

◆ buf

std::stringstream TRestStringOutput::buf
protected

Definition at line 172 of file TRestStringOutput.h.

◆ color

COLORCODE_TYPE TRestStringOutput::color
protected

Definition at line 166 of file TRestStringOutput.h.

◆ formatstring

std::string TRestStringOutput::formatstring
protected

Definition at line 167 of file TRestStringOutput.h.

◆ iserror

bool TRestStringOutput::iserror
protected

Definition at line 169 of file TRestStringOutput.h.

◆ length

int TRestStringOutput::length
protected

Definition at line 173 of file TRestStringOutput.h.

◆ orientation

REST_Display_Orientation TRestStringOutput::orientation
protected

Definition at line 170 of file TRestStringOutput.h.

◆ useborder

bool TRestStringOutput::useborder
protected

Definition at line 168 of file TRestStringOutput.h.

◆ verbose

REST_Verbose_Level TRestStringOutput::verbose
protected

Definition at line 175 of file TRestStringOutput.h.


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