SST 16.0.0
Structural Simulation Toolkit
checkpointableInfo.h
1// Copyright 2009-2026 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-2026, 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_CHECKPOINTABLE_INFO_H
13#define SST_CORE_CHECKPOINTABLE_INFO_H
14
15#include "sst/core/eli/elibase.h"
16#include "sst/core/warnmacros.h"
17
18#include <cstdint>
19#include <iostream>
20#include <ostream>
21#include <string>
22#include <type_traits>
23#include <vector>
24
25namespace SST::ELI {
26
27template <typename, typename = void>
29{
30 static bool get() { return false; }
31};
32
33template <class T>
34struct GetCheckpointable<T, std::void_t<decltype(T::ELI_isCheckpointable())>>
35{
36 static bool get() { return T::ELI_isCheckpointable(); }
37};
38
39
40class ProvidesCheckpointable
41{
42public:
43 bool isCheckpointable() const { return checkpointable_; }
44
45 void toString(std::ostream& os) const
46 {
47 os << " Checkpointable: " << (checkpointable_ ? "true" : "false") << "\n";
48 }
49
50 template <class XMLNode>
51 void outputXML(XMLNode* UNUSED(node))
52 {
53 node->SetAttribute("Checkpointable", checkpointable_);
54 }
55
56protected:
57 template <class T>
58 explicit ProvidesCheckpointable(T* UNUSED(t)) :
59 checkpointable_(GetCheckpointable<T>::get())
60 {}
61
62private:
63 bool checkpointable_;
64};
65
66#define SST_ELI_IS_CHECKPOINTABLE() \
67 static bool ELI_isCheckpointable() \
68 { \
69 return true; \
70 }
71
72} // namespace SST::ELI
73
74#endif
Definition checkpointableInfo.h:29