Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
fmatvec::Atom Class Reference

#include <atom.h>

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

List of all members.

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.
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 active)
 Set the active flag of this object and all objects which were created using the same message stream as this object.
void adoptMessageStreams (const Atom *src=NULL)
 Adopt the message streams from src to this object.
std::ostream & msg (MsgType type)
 Return the message stream of type type.
bool msgAct (MsgType type)
 Return true if the the message of type type is currently active.

Static Public Member Functions

static void setCurrentMessageStream (MsgType type, const boost::shared_ptr< std::ostream > &s=boost::make_shared< std::ostream >(std::cout.rdbuf()))
 Set the current message stream used by all subsequent created objects.
static void setCurrentMessageStreamActive (MsgType type, bool active)
 Set the active flag used by all objects which were or will be created using the current message stream.
static std::ostream & msgStatic (MsgType type)
 Same as msg(type).
static bool msgActStatic (MsgType type)
 Same as msgAct(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
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) [inline, static]

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) [inline, static]

Same as msg(type).

Use this function only if not object is available. This should normally not be the case.

static void fmatvec::Atom::setCurrentMessageStream ( MsgType  type,
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. The default active flag is true this can be changed by a call to setCurrentMessageStreamActive(type, false) Be aware of data races in streams if objects of type Atom print messages in threads.


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