All Classes Namespaces Functions Typedefs Enumerations Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
fmatvec::Atom Class Reference

#include <atom.h>

Inheritance diagram for fmatvec::Atom:
fmatvec::Function< Ret(Arg)> fmatvec::Function< Ret(Arg1, Arg2)>

Public Types

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

Public Member Functions

 BOOST_STATIC_ASSERT_MSG (SIZE==FMATVEC_ATOM_MSGTYPE_SIZE,"The proprocessor define FMATVEC_ATOM_MSGTYPE_SIZE must be equal Atom::SIZE.")
 
virtual ~Atom ()
 dtor.
 
Atomoperator= (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 active)
 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, boost::shared_ptr< bool > &a, boost::shared_ptr< std::ostream > &s)
 Get the shared message stream active flag and the shared message stream of this object.
 
void adoptMessageStreams (const Atom *src=NULL)
 
std::ostream & msg (MsgType type)
 
bool msgAct (MsgType type)
 

Static Public Member Functions

static void setCurrentMessageStream (MsgType type, const boost::shared_ptr< bool > &a=boost::make_shared< bool >(true), const boost::shared_ptr< std::ostream > &s=boost::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

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

Static Private Attributes

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

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

void fmatvec::Atom::adoptMessageStreams ( const Atom src = NULL)

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.

std::ostream& fmatvec::Atom::msg ( MsgType  type)
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.

bool fmatvec::Atom::msgAct ( MsgType  type)
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.

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

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

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

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

void fmatvec::Atom::setCurrentMessageStream ( MsgType  type,
const boost::shared_ptr< bool > &  a = boost::make_shared<bool>(true),
const boost::shared_ptr< std::ostream > &  s = boost::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

array< shared_ptr< bool >, Atom::SIZE > fmatvec::Atom::_msgActStatic
staticprivate
Initial value:
= {{
make_shared<bool>(msgTypeActive(true , "Info" )),
make_shared<bool>(msgTypeActive(true , "Warn" )),
make_shared<bool>(msgTypeActive(false, "Debug"))
}}
array< shared_ptr< ostream >, Atom::SIZE > fmatvec::Atom::_msgSavedStatic
staticprivate
Initial value:
= {{
make_shared<ostream>(cout.rdbuf()),
make_shared<ostream>(cerr.rdbuf()),
make_shared<ostream>(cout.rdbuf())
}}
array< shared_ptr< ostream >, Atom::SIZE > fmatvec::Atom::_msgStatic
staticprivate
Initial value:
= {{
}}

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

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML