Debian Codegraph @

Kernel/tCounter.h

raw symbols SCIP
1 /* This file is part of the FaCT++ DL reasoner
2 Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester
3 Copyright (C) 2015-2017 Dmitry Tsarkov
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef TCOUNTER_H
21 #define TCOUNTER_Hcxx . . $ `Kernel/tCounter.h:21:9`!
22
23 /** define class that allows user to have an integer with restricted
24 * access (i.e. get value, increment and reset). This is useful when
25 * integral value used as a static var of some class
26 */
27 template <typename T>
28 class TCountercxx . . $ TCounter#
29 {
30 public: // type interface
31 /// define integral type of a counter
32 typedef T IntTypecxx . . $ TCounter#IntType#;
33
34 protected: // members
35 /// counter itself
36 IntTypecxx . . $ TCounter#IntType# countercxx . . $ TCounter#counter.;
37
38 public: // interface
39 /// init c'tor
40 explicit TCountercxx . . $ TCounter#`TCounter<T>`(9b289cee16747614). ( const IntTypecxx . . $ TCounter#IntType# n ) : countercxx . . $ TCounter#counter.(n) {}
41 /// copy c'tor
42 template <typename U>
43 explicit TCountercxx . . $ TCounter#`TCounter<T>`(3afabfeb704b7421). ( const TCountercxx . . $ TCounter#<U>& copy ) : countercxx . . $ TCounter#counter.(copy.countercxx . . $ TCounter#counter.) {}
44 /// assignment
45 template <typename U>
46 TCounter& operatorcxx . . $ TCounter#`operator=`(87ee76dfbb66189f).= ( const TCountercxx . . $ TCounter#<U>& copy )
47 {
48 countercxx . . $ TCounter#counter. = copy.countercxx . . $ TCounter#counter.;
49 return *this;
50 }
51
52 // operators
53
54 /// get value of a counter
55 IntTypecxx . . $ TCounter#IntType# valcxx . . $ TCounter#val(8f5363d873dd4781). ( void ) const { return countercxx . . $ TCounter#counter.; }
56 /// increment value of a counter; @return new value
57 IntTypecxx . . $ TCounter#IntType# inccxx . . $ TCounter#inc(5f357b03ed472e5e). ( void ) { return ++countercxx . . $ TCounter#counter.; }
58 /// set new value of a counter
59 void resetcxx . . $ TCounter#reset(9b289cee16747614). ( const IntTypecxx . . $ TCounter#IntType# n ) { countercxx . . $ TCounter#counter. = n; }
60 }; // TCounter
61
62 #endif