Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
InstanceCount.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_InstanceCount_H_
9#define model_InstanceCount_H_
10
11//#include <modelMacros.h> // model_checkInput
12
13namespace model
14{
15
16 /************************************************************/
17 /************************************************************/
27 template<typename Derived>
29 {
30
31
32 // The incremental counters
33 static size_t count;
34
35 public:
36
37
38
39 /**********************************************************************/
41 {
42 count+=1;
43 }
44
45 /**********************************************************************/
47 {
48 count+=1;
49 }
50
51 /**********************************************************************/
53 {
54 count-=1;
55 }
56
57 /**********************************************************************/
58 static size_t& counter()
59 {
60 return count;
61 }
62
63
64
65
66
67 };
68
69 template<typename Derived>
70 size_t InstanceCount<Derived>::count = 0;
71
72} // namespace model
73#endif
InstanceCount(const InstanceCount &)
static size_t & counter()