| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2010-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 COUNTER_H |
| 21 | #define COUNTER_Hcxx . . $ `Kernel/counter.h:21:9`! |
| 22 | |
| 23 | /// class counter from Wikipedia:curiously recurring template pattern |
| 24 | template <typename T> |
| 25 | struct countercxx . . $ counter# |
| 26 | { |
| 27 | /// number of created T-objects |
| 28 | static unsigned int objects_createdcxx . . $ counter#objects_created.; |
| 29 | /// number of alive T-objects ATM of checking |
| 30 | static unsigned int objects_alivecxx . . $ counter#objects_alive.; |
| 31 | /// c'tor: inc counters |
| 32 | countercxx . . $ counter#`counter<T>`(49f6e7a06ebc5aa8). ( void ) |
| 33 | { |
| 34 | ++objects_createdcxx . . $ counter#objects_created.; |
| 35 | ++objects_alivecxx . . $ counter#objects_alive.; |
| 36 | } |
| 37 | /// d'tor: dec counters |
| 38 | virtual ~cxx . . $ counter#`~counter<T>`(49f6e7a06ebc5aa8).counter() |
| 39 | { |
| 40 | --objects_alivecxx . . $ counter#objects_alive.; |
| 41 | } |
| 42 | }; // counter |
| 43 | |
| 44 | template <typename T> unsigned int countercxx . . $ counter#<T>::objects_createdcxx . . $ counter#objects_created.(0); |
| 45 | template <typename T> unsigned int countercxx . . $ counter#<T>::objects_alivecxx . . $ counter#objects_alive.(0); |
| 46 | |
| 47 | #endif |