SST  14.0.0
StructuralSimulationToolkit
statics.h
1 // Copyright 2009-2024 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-2024, 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 {
23 public:
24  typedef void (*clear_fxn)(void);
25 
26  static void register_finish(clear_fxn fxn);
27 
28  static void finish();
29 
30 protected:
31  static std::list<clear_fxn>* fxns_;
32 };
33 
34 template <class T>
36 {
37 public:
38  need_delete_statics() { statics::register_finish(&T::delete_statics); }
39 };
40 
41 #define free_static_ptr(x) \
42  if ( x ) delete x; \
43  x = 0
44 
45 } // namespace Serialization
46 } // namespace Core
47 } // namespace SST
48 
49 #endif // SST_CORE_SERIALIZATION_STATICS_H
Definition: statics.h:21
Definition: action.cc:18