| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Stat Class Reference

Small wrapper class for easy manipulation with generic counters and IStatSvc&ICounterSvc interface. More...

#include <GaudiKernel/Stat.h>

Collaboration diagram for Stat:

[legend]
List of all members.

Public Member Functions

 Stat (StatEntity *entity=0, const std::string &name="", const std::string &group="")
 constructor from StatEntity, name and group :
 Stat (StatEntity &entity, const std::string &name="", const std::string &group="")
 constructor from StatEntity, name and group :
 Stat (IStatSvc *svc, const std::string &tag)
 constructor from IStatSvc, tag and value
 Stat (IStatSvc *svc, const std::string &tag, const double flag)
 constructor from IStatSvc, tag and value
 Stat (ICounterSvc *svc, const std::string &group, const std::string &name)
 constructor from ICounterSvc, group and name
 Stat (const Stat &right)
 copy constructor
Statoperator= (const Stat &right)
 Assignement operator.
 ~Stat ()
 destructor
const StatEntityentity () const
 get the entity
const StatEntityoperator-> () const
 dereference operaqtor
 operator const StatEntity & () const
 cast to StatEntity
bool operator! () const
 check validity
Statoperator+= (const double f)
 General increment for the counter.
Statoperator++ ()
 Pre-increment operator for the counter.
Statoperator++ (int)
 Post-increment operator for the counter.
Statoperator-= (const double f)
 General decrement operator for the counter.
Statoperator-- ()
 Pre-decrement operator for the flag.
Statoperator-- (int)
 Post-decrement operator for the flag.
Statoperator+= (const StatEntity &right)
 increment with StatEntity object
Statoperator+= (const Stat &right)
 increment with other stat objects
std::string toString () const
 representation as string
std::ostream & print (std::ostream &o=std::cout) const
 printout to std::ostream
std::ostream & fillStream (std::ostream &o) const
 printout to std::ostream
StatEntitycounter () const
 alternative access to underlying counter (for ICounterSvc::CounterObj)
const std::string & name () const
 counter name
const std::string & group () const
 counter group (for ICounterSvc)

Private Attributes

StatEntitym_entity
 underlying counter
std::string m_tag
 unique stat tag(name)
std::string m_group
IStatSvcm_stat
 Stat service.
ICounterSvcm_counter
 Counter Service.

Detailed Description

Small wrapper class for easy manipulation with generic counters and IStatSvc&ICounterSvc interface.

It acts as "smart pointer" fro StatEntity objects, and allows manipulation with StatEntity objects, owned by GaudiCommon<TYPE> base class and/or IStatSvc/ICounterSvc

   long nTracks = ... ;
   Stat stat( chronoSvc() , "#tracks" , nTracks ) ;

Alternatively one can use operator methods:

   long nTracks = ... ;
   Stat stat( chronoSvc() , "#tracks" ) ;
   stat += nTracks ;

Author:
Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
Date:
2007-08-02

Definition at line 50 of file Stat.h.


Constructor & Destructor Documentation

Stat::Stat ( StatEntity entity = 0,
const std::string &  name = "",
const std::string &  group = "" 
) [inline]

constructor from StatEntity, name and group :

    StatEntity* entity = ... ; 

    // make helper object:
    Stat stat ( entity ) ;

See also:
StatEntity
Parameters:
entity pointer to entity object
name (optional) name of the object, for printout
group (optional) group of the object, for printout

Definition at line 69 of file Stat.h.

00072     : m_entity  ( entity ) 
00073     , m_tag     ( name   ) 
00074     , m_group   ( group  ) 
00075     , m_stat    ( 0      ) 
00076     , m_counter ( 0      ) 
00077   {}

Stat::Stat ( StatEntity entity,
const std::string &  name = "",
const std::string &  group = "" 
) [inline]

constructor from StatEntity, name and group :

    // make helper object:
    Stat stat = Stat( countter("Name") , "Name" ) ;
See also:
StatEntity

GaudiCommon::counter

Parameters:
entity reference to entity object
name (optional) name of the object, for printout
group (optional) group of the object, for printout

Definition at line 92 of file Stat.h.

00095     : m_entity  ( &entity ) 
00096     , m_tag     ( name    ) 
00097     , m_group   ( group   ) 
00098     , m_stat    ( 0       ) 
00099     , m_counter ( 0       ) 
00100   {}

Stat::Stat ( IStatSvc svc,
const std::string &  tag 
)

constructor from IStatSvc, tag and value

   IStatSvc* svc = ... ;
   double eTotal = .... ; 

   // get/create the counter from Stat Service
   Stat eTot ( svc , "total energy" ) ;

   eTot += eTotal ;

See also:
IStatSvc
Parameters:
svc pointer to Chrono&Stat Service tag unique tag for the entry

Stat::Stat ( IStatSvc svc,
const std::string &  tag,
const double  flag 
)

constructor from IStatSvc, tag and value

   IStatSvc* svc = ... ;
   double eTotal = .... ; 

   // get/create the counter from Stat Service
   Stat stat( svc , "total energy" , eTotal ) ;

See also:
IStatSvc
Parameters:
svc pointer to Chrono&Stat Service tag unique tag for the entry
flag "flag"(additive quantity) to be used

Stat::Stat ( ICounterSvc svc,
const std::string &  group,
const std::string &  name 
)

constructor from ICounterSvc, group and name

   ICounterSvc* svc = ... ;

   // get/create the counter from Counter Service
   Stat stat( svc , "ECAL" , "TotalEnergy" ) ;

See also:
ICounterSvc::get

ICounterSvc::create

Parameters:
svc pointer to Counter Service
group group name
name counter name

Stat::Stat ( const Stat right  ) 

copy constructor

Stat::~Stat (  ) 

destructor


Member Function Documentation

Stat& Stat::operator= ( const Stat right  ) 

Assignement operator.

const StatEntity* Stat::entity (  )  const [inline]

get the entity

Definition at line 169 of file Stat.h.

00169 { return  m_entity     ; }

const StatEntity* Stat::operator-> (  )  const [inline]

dereference operaqtor

Definition at line 171 of file Stat.h.

00171 { return    entity()   ; }

Stat::operator const StatEntity & (  )  const [inline]

cast to StatEntity

Definition at line 173 of file Stat.h.

00173 { return   *entity()   ; }

bool Stat::operator! (  )  const [inline]

check validity

Definition at line 175 of file Stat.h.

00175 { return 0 == m_entity ; }

Stat& Stat::operator+= ( const double  f  )  [inline]

General increment for the counter.

    Stat stat = ... ;    

    const long nTracks = ... ;

    stat += nTracks ; 

See also:
StatEntity
Parameters:
f value to be added to the counter
Returns:
selfreference

Definition at line 193 of file Stat.h.

00194   {
00195     if ( 0 != m_entity ) { (*m_entity) += f ; }
00196     return *this ;
00197   }

Stat& Stat::operator++ (  )  [inline]

Pre-increment operator for the counter.

    Stat stat = ... ;    

    ++stat ; 

See also:
StatEntity
Returns:
selfreference

Definition at line 211 of file Stat.h.

00212   { 
00213     if ( 0 != m_entity ) { ++(*m_entity) ; }
00214     return *this ;
00215   }

Stat& Stat::operator++ ( int   )  [inline]

Post-increment operator for the counter.

    Stat stat = ... ;    

    stat++ ; 
See also:
StatEntity
Returns:
self-reference

Definition at line 228 of file Stat.h.

00229   { 
00230     if ( 0 != m_entity ) { (*m_entity)++ ; }
00231     return *this ;
00232   } 

Stat& Stat::operator-= ( const double  f  )  [inline]

General decrement operator for the counter.

See also:
StatEntity
Returns:
self-reference
Parameters:
f counter decrement

Definition at line 238 of file Stat.h.

00239   {
00240     if ( 0 != m_entity ) { (*m_entity) -= f ; }
00241     return *this ; 
00242   }

Stat& Stat::operator-- (  )  [inline]

Pre-decrement operator for the flag.

Definition at line 244 of file Stat.h.

00245   { 
00246     if ( 0 != m_entity ) { --(*m_entity)   ; }
00247     return *this ;
00248   }

Stat& Stat::operator-- ( int   )  [inline]

Post-decrement operator for the flag.

Definition at line 250 of file Stat.h.

00251   { 
00252     if ( 0 != m_entity ) {   (*m_entity)-- ; }
00253     return *this ;
00254   }

Stat& Stat::operator+= ( const StatEntity right  )  [inline]

increment with StatEntity object

Definition at line 256 of file Stat.h.

00257   {
00258     if ( 0 != m_entity ) { (*m_entity) += right ; }
00259     return *this ;
00260   }

Stat& Stat::operator+= ( const Stat right  )  [inline]

increment with other stat objects

Definition at line 262 of file Stat.h.

00263   {
00264     if ( 0 != right.entity() ) { (*this) += *right.entity() ; }
00265     return *this ;
00266   }

std::string Stat::toString (  )  const

representation as string

std::ostream& Stat::print ( std::ostream &  o = std::cout  )  const

printout to std::ostream

Parameters:
s the reference to the output stream
Returns:
the reference to the output stream

std::ostream& Stat::fillStream ( std::ostream &  o  )  const [inline]

printout to std::ostream

Parameters:
s the reference to the output stream
Returns:
the reference to the output stream

Definition at line 279 of file Stat.h.

00279 { return print ( o ) ; }

StatEntity* Stat::counter (  )  const [inline]

alternative access to underlying counter (for ICounterSvc::CounterObj)

Definition at line 282 of file Stat.h.

00282 { return  m_entity   ; }

const std::string& Stat::name (  )  const [inline]

counter name

Definition at line 284 of file Stat.h.

00284 { return  m_tag      ; }

const std::string& Stat::group (  )  const [inline]

counter group (for ICounterSvc)

Definition at line 286 of file Stat.h.

00286 { return  m_group    ; }


Member Data Documentation

StatEntity* Stat::m_entity [private]

underlying counter

Definition at line 290 of file Stat.h.

std::string Stat::m_tag [private]

unique stat tag(name)

Definition at line 292 of file Stat.h.

std::string Stat::m_group [private]

Definition at line 294 of file Stat.h.

IStatSvc* Stat::m_stat [private]

Stat service.

Definition at line 296 of file Stat.h.

ICounterSvc* Stat::m_counter [private]

Counter Service.

Definition at line 298 of file Stat.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:15 2011 for GaudiKernel by doxygen 1.4.7