fmatvec 0.0.0

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
fmatvec::Atom Class Reference

`#include <atom.h>`

Inheritance diagram for fmatvec::Atom:
[legend]

## Public Types

enum | MsgType { Info, Warn, Debug, Error, Deprecated, Status, SIZE }
| Messages can be printed to different message types named here.

## Public Member Functions

virtual | ~Atom ()
| dtor.
Atom & | operator= (const Atom &)
| When a Atom is assinged do not change the messsage streams since we always use the message streams being active at ctor time.
void | setMessageStreamActive (MsgType type, bool activeFlag)
| Set the active flag of this object and all objects which were created using the same message stream as this object.
void | getMessageStream (MsgType type, std::shared_ptr< bool > &a, std::shared_ptr< std::ostream > &s) const
| Get the shared message stream active flag and the shared message stream of this object.
void | adoptMessageStreams (const Atom *src=nullptr)
std::ostream & | msg (MsgType type) const
bool | msgAct (MsgType type) const

## Static Public Member Functions

static void | setCurrentMessageStream (MsgType type, const std::shared_ptr< bool > &a=std::make_shared< bool >(true), const std::shared_ptr< std::ostream > &s=std::make_shared< std::ostream >(std::cout.rdbuf()))
static std::ostream & | msgStatic (MsgType type)
static bool | msgActStatic (MsgType type)

## Protected Member Functions

| Atom ()
| When a Atom is default constructed use the current statically set message streams.
| Atom (const Atom &src)
| When a Atom is copy constructed use the current statically set message streams, not the message streams from src.

## Private Attributes

std::array< std::shared_ptr< bool >, SIZE > | _msgAct
std::array< std::shared_ptr< std::ostream >, SIZE > | _msgSaved
std::array< std::shared_ptr< std::ostream >, SIZE > | _msg

## Static Private Attributes

static std::shared_ptr< std::ostream > | _nullStream = make_shared<ostream>(static_cast<streambuf*>(nullptr))
static std::array< std::shared_ptr< bool >, SIZE > | _msgActStatic
static std::array< std::shared_ptr< std::ostream >, SIZE > | _msgSavedStatic
static std::array< std::shared_ptr< std::ostream >, SIZE > | _msgStatic

## Friends

class | AdoptCurrentMessageStreamsUntilScopeExit

## Detailed Description

Top level class. This is the top level class which is used for (at least) all classes which may be created using a object factory. This class contains only totally basic functionallity like streams for printing messages. No mathematical or other "none" basic content should be added here.

## Member Function Documentation

## ◆ adoptMessageStreams()

void fmatvec::Atom::adoptMessageStreams | ( | const Atom * | src = `nullptr` | ) |

Adopt the message streams from src to this object. If src is NULL adopt the current (static) message streams. Normally always the streams at ctor time are used. But in some special cassed this function is usefull.

## ◆ msg()

std::ostream& fmatvec::Atom::msg | ( | MsgType | type | ) | const

inline

Return the message stream of type type. Node: If the code is performance critical you should check first whether this stream is really printed using msgAct(type). If this return false just skip the complete message.

## ◆ msgAct()

bool fmatvec::Atom::msgAct | ( | MsgType | type | ) | const

inline

Return true if the the message of type type is currently active. Note: If the code is not performance critical their is no need to check this flag. You can just print using msg(type)<<"Hello world"<<endl; and it is not really printed.

## ◆ msgActStatic()

static bool fmatvec::Atom::msgActStatic | ( | MsgType | type | ) |

inline static

Same as msgAct(type). Use this function only if not object is available. This should normally not be the case.

## ◆ msgStatic()

static std::ostream& fmatvec::Atom::msgStatic | ( | MsgType | type | ) |

inline static

Same as msg(type). Use this function only if not object is available. This should normally not be the case.

## ◆ setCurrentMessageStream()

void fmatvec::Atom::setCurrentMessageStream | ( | MsgType | type,
|  | const std::shared_ptr< bool > & | a = `std::make_shared<bool>(true)`,
|  | const std::shared_ptr< std::ostream > & | s = `std::make_shared<std::ostream>(std::cout.rdbuf())`
| ) |  |

static

Set the current message stream used by all subsequent created objects. type defines the message type which should be set using this call. If s is not defined, the message of type type prints to cout. If a is not defined, a new shared bool flag set to true is used. Be aware of data races in streams if objects of type Atom print messages in threads.

## Member Data Documentation

## ◆ _msgActStatic

array< shared_ptr< bool >, Atom::SIZE > fmatvec::Atom::_msgActStatic

static private

Initial value:
= {{
make_shared<bool>(true ),
make_shared<bool>(true ),
make_shared<bool>(false),
make_shared<bool>(true ),
make_shared<bool>(true ),
make_shared<bool>(true )
}}

## ◆ _msgSavedStatic

array< shared_ptr< ostream >, Atom::SIZE > fmatvec::Atom::_msgSavedStatic

static private

Initial value:
= {{
make_shared<PrePostfixedStream>("Info: ", "" , cout),
make_shared<PrePostfixedStream>("Warn: ", "" , cerr),
make_shared<PrePostfixedStream>("Debug:", "" , cout),
make_shared<PrePostfixedStream>("" , "" , cerr),
make_shared<PrePostfixedStream>("Depr: ", "" , cerr),
make_shared<PrePostfixedStream>("" , "\r", cout)
}}

## ◆ _msgStatic

array< shared_ptr< ostream >, Atom::SIZE > fmatvec::Atom::_msgStatic

static private

Initial value:
= {{
}}

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

- /mbsim-env/fmatvec/fmatvec/atom.h
- /mbsim-env/fmatvec/fmatvec/atom.cc