The Gaudi Framework  master (37c0b60a)
Counter.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIEXAMPLES_COUNTER_H
12 #define GAUDIEXAMPLES_COUNTER_H 1
13 
14 // Include files
15 #include <GaudiKernel/DataObject.h>
16 #include <iostream>
17 
18 namespace Gaudi {
19  namespace Examples {
20 
21  class Collision;
22 
23  // CLID definition
24  static const CLID& CLID_Counter = 109;
25 
32  class GAUDI_API Counter : public DataObject {
33 
34  public:
36  Counter();
37 
39  const CLID& clID() const override { return classID(); }
40  static const CLID& classID() { return CLID_Counter; }
41 
43  int value() const { return m_counter; }
45  int increment() { return ++m_counter; }
47  int decrement() { return --m_counter; }
49  void set( int val ) { m_counter = val; }
50 
51  private:
53  int m_counter;
54  };
55  } // namespace Examples
56 } // namespace Gaudi
57 #endif // GAUDIEXAMPLES_COUNTER_H
Gaudi::Examples::Counter
Definition: Counter.h:32
Gaudi::Examples::Counter::increment
int increment()
Increment counter.
Definition: Counter.h:45
Gaudi::Examples::Counter::set
void set(int val)
Set value.
Definition: Counter.h:49
Gaudi::Examples::Counter::decrement
int decrement()
Decrement counter.
Definition: Counter.h:47
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Examples::Counter::value
int value() const
Retrieve counter value.
Definition: Counter.h:43
DataObject.h
Gaudi::Examples::Counter::classID
static const CLID & classID()
Definition: Counter.h:40
Gaudi::Examples::Counter::m_counter
int m_counter
Counter number.
Definition: Counter.h:53
DataObject
Definition: DataObject.h:36
Gaudi::Examples::Counter::clID
const CLID & clID() const override
Retrieve reference to class definition structure.
Definition: Counter.h:39
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81