reference_counted_object.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_REFERENCE_COUNTED_OBJECT_H
21 #define LIBMESH_REFERENCE_COUNTED_OBJECT_H
22 
23 // Local includes
25 
26 // C++ includes
27 #include <typeinfo>
28 
29 namespace libMesh
30 {
31 
32 
33 
66 // ------------------------------------------------------------
67 // ReferenceCounter class definition
68 template <typename T>
70 {
71 protected:
72 
79  {
80 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
81 
82  increment_constructor_count(typeid(T).name());
83 
84 #endif
85  }
86 
91  : ReferenceCounter(other)
92  {
93 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
94 
95  increment_constructor_count(typeid(T).name());
96 
97 #endif
98  }
99 
100 public:
101 
106  {
107 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
108 
109  increment_destructor_count(typeid(T).name());
110 
111 #endif
112  }
113 
114 private:
115 
116 };
117 
118 
119 } // namespace libMesh
120 
121 
122 #endif // LIBMESH_REFERENCE_COUNTED_OBJECT_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo