SST  9.1.0
StructuralSimulationToolkit
statics.h
1 // Copyright 2009-2019 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2019, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_SERIALIZATION_STATICS_H
13 #define SST_CORE_SERIALIZATION_STATICS_H
14 
15 #include <list>
16 
17 namespace SST {
18 namespace Core {
19 namespace Serialization {
20 
21 class statics {
22  public:
23  typedef void (*clear_fxn)(void);
24 
25  static void
26  register_finish(clear_fxn fxn);
27 
28  static void
29  finish();
30 
31  protected:
32  static std::list<clear_fxn>* fxns_;
33 
34 };
35 
36 template <class T>
38  public:
40  statics::register_finish(&T::delete_statics);
41  }
42 };
43 
44 #define free_static_ptr(x) \
45  if (x) delete x; x = 0
46 
47 }
48 }
49 }
50 
51 #endif // STATICS_H
Definition: statics.h:21