verbose Class Reference

#include <cverb.h>

Public Member Functions

 verbose (char const *name)
verbose operator| (verbose const &)
verbose operator& (verbose const &)

Static Public Member Functions

static bool setup (std::string const &)
 Return false if this named verbose object has not be registred.
static bool setup (std::vector< std::string > const &args)
 convenient interface calling the above for string in args

Private Attributes

bool set

Friends

std::ostream & operator<< (cverb_object &, verbose const &)
 The returned stream is either a null stream or cout.

Detailed Description

typical use: declare some verbose global object: verbose debug("debug"); verbose stats("stats"); verbose level2("level2");

setup from command line the state of these objects

verbose::setup(command_line_args_to'--verbose=');

cverb << stats << "stats\n"; cverb << (stats&level2) << "very verbose stats\n" cverb << (stats|debug) << "bar\n"; these will give a compile time error cverb << stats << "foo" << debug << "bar"; cout << stats << "foo";

In critical code path cverb can be used in the more efficient way: if (cverb << vdebug) cverb << vdebug << "foo" << "bar"; the condition test the fails bit for the returned stream while the later build a sentry object for each << (more efficient even with one level of <<)

Definition at line 51 of file cverb.h.


Constructor & Destructor Documentation

verbose::verbose ( char const *  name  ) 

create a verbose object named name, the ctor auto-register name as a verbose object, the set state can be intialized through verbose::setup(name)

Definition at line 62 of file cverb.cpp.


Member Function Documentation

verbose verbose::operator& ( verbose const &  rhs  ) 

Definition at line 85 of file cverb.cpp.

References set.

verbose verbose::operator| ( verbose const &  rhs  ) 

Definition at line 77 of file cverb.cpp.

References set.

static bool verbose::setup ( std::vector< std::string > const &  args  )  [static]

convenient interface calling the above for string in args

static bool verbose::setup ( std::string const &   )  [static]

Return false if this named verbose object has not be registred.

Referenced by process_args().

Here is the caller graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< ( cverb_object ,
verbose const &   
) [friend]

The returned stream is either a null stream or cout.


Field Documentation

bool verbose::set [private]

Definition at line 70 of file cverb.h.

Referenced by operator&(), operator<<(), and operator|().


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

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1