Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JEEP::JCommunicator Class Reference

Auxiliary class to control standard input and output. More...

#include <JCommunicator.hh>

Public Member Functions

 JCommunicator ()
 Default constructor.
 
 JCommunicator (const bool verbose)
 Constructor.
 
bool getVerbose () const
 Get verbose mode.
 
void setVerbose (const bool verbose=true)
 Set verbose mode.
 
std::istream & getInputStream (std::istream &in=std::cin) const
 Get current input stream.
 
std::ostream & getOutputStream (std::ostream &out=std::cout) const
 Get current output stream.
 
std::ostream & getErrorStream (std::ostream &out=std::cerr) const
 Get current error stream.
 

Protected Attributes

bool verbose_
 

Detailed Description

Auxiliary class to control standard input and output.

Definition at line 23 of file JCommunicator.hh.

Constructor & Destructor Documentation

◆ JCommunicator() [1/2]

JEEP::JCommunicator::JCommunicator ( )
inline

Default constructor.

Definition at line 28 of file JCommunicator.hh.

28 :
29 verbose_(true)
30 {}

◆ JCommunicator() [2/2]

JEEP::JCommunicator::JCommunicator ( const bool verbose)
inline

Constructor.

Parameters
verbosedisable I/O if false; else enable

Definition at line 38 of file JCommunicator.hh.

38 :
40 {}
int verbose
Definition elog.cc:70

Member Function Documentation

◆ getVerbose()

bool JEEP::JCommunicator::getVerbose ( ) const
inline

Get verbose mode.

Returns
if true I/O enabled; else disabled

Definition at line 48 of file JCommunicator.hh.

49 {
50 return verbose_;
51 }

◆ setVerbose()

void JEEP::JCommunicator::setVerbose ( const bool verbose = true)
inline

Set verbose mode.

Parameters
verbosedisable I/O if false; else enable

Definition at line 59 of file JCommunicator.hh.

60 {
62 }

◆ getInputStream()

std::istream & JEEP::JCommunicator::getInputStream ( std::istream & in = std::cin) const
inline

Get current input stream.

This method returns the given input stream if the verbose option is set, else a streamer that does not read any input.

Parameters
ininput stream
Returns
input stream

Definition at line 73 of file JCommunicator.hh.

74 {
75 return (verbose_ ? in : JLANG::null);
76 }
static JNullStream null
Null I/O stream.

◆ getOutputStream()

std::ostream & JEEP::JCommunicator::getOutputStream ( std::ostream & out = std::cout) const
inline

Get current output stream.

This method returns the given output stream if the verbose option is set, else a streamer that does not write any output.

Parameters
outoutput stream
Returns
output stream

Definition at line 87 of file JCommunicator.hh.

88 {
89 return (verbose_ ? out : JLANG::null);
90 }

◆ getErrorStream()

std::ostream & JEEP::JCommunicator::getErrorStream ( std::ostream & out = std::cerr) const
inline

Get current error stream.

This method returns the given error stream if the verbose option is set, else a streamer that does not write any output.

Parameters
outerror stream
Returns
error stream

Definition at line 101 of file JCommunicator.hh.

102 {
103 //return (verbose_ ? out : JLANG::null);
104 return out;
105 }

Member Data Documentation

◆ verbose_

bool JEEP::JCommunicator::verbose_
protected

Definition at line 109 of file JCommunicator.hh.


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