SST 12.1.0
Structural Simulation Toolkit
statics.h
1// Copyright 2009-2022 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-2022, 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
17namespace SST {
18namespace Core {
19namespace Serialization {
20
22{
23public:
24 typedef void (*clear_fxn)(void);
25
26 static void register_finish(clear_fxn fxn);
27
28 static void finish();
29
30protected:
31 static std::list<clear_fxn>* fxns_;
32};
33
34template <class T>
36{
37public:
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:22