SST 15.0
Structural Simulation Toolkit
profilePointInfo.h
1// Copyright 2009-2025 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-2025, 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_ELI_PROFILEPOINTINFO_H
13#define SST_CORE_ELI_PROFILEPOINTINFO_H
14
15#include "sst/core/eli/elibase.h"
16
17#include <string>
18#include <vector>
19
20namespace SST::ELI {
21
22template <typename, typename = void>
24{
25 static const std::vector<SST::ElementInfoProfilePoint>& get()
26 {
27 static std::vector<SST::ElementInfoProfilePoint> var = {};
28 return var;
29 }
30};
31
32template <class T>
33struct InfoProfilePoints<T, std::void_t<decltype(T::ELI_getProfilePoints())>>
34{
35 static const std::vector<SST::ElementInfoProfilePoint>& get() { return T::ELI_getProfilePoints(); }
36};
37
38class ProvidesProfilePoints
39{
40public:
41 const std::vector<ElementInfoProfilePoint>& getProfilePoints() const { return points_; }
42
43 void toString(std::ostream& os) const;
44
45 template <class XMLNode>
46 void outputXML(XMLNode* node) const
47 {
48 int idx = 0;
49 for ( const ElementInfoProfilePoint& point : points_ ) {
50 auto* element = new XMLNode("ProfilePoint");
51 element->SetAttribute("Index", idx);
52 element->SetAttribute("Name", point.name);
53 element->SetAttribute("Description", point.description ? point.description : "none");
54 element->SetAttribute("Interface", point.superclass ? point.superclass : "none");
55 node->LinkEndChild(element);
56 ++idx;
57 }
58 }
59
60protected:
61 template <class T>
62 explicit ProvidesProfilePoints(T* UNUSED(t)) :
63 points_(InfoProfilePoints<T>::get())
64 {}
65
66private:
67 std::vector<ElementInfoProfilePoint> points_;
68};
69
70} // namespace SST::ELI
71
72// clang-format off
73#define SST_ELI_DOCUMENT_PROFILE_POINTS(...) \
74 static const std::vector<SST::ElementInfoProfilePoint>& ELI_getProfilePoints() \
75 { \
76 static std::vector<SST::ElementInfoProfilePoint> var = { __VA_ARGS__ }; \
77 auto parent = SST::ELI::InfoProfilePoints< \
78 std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
79 SST::ELI::combineEliInfo(var, parent); \
80 return var; \
81 }
82// clang-format on
83#define SST_ELI_DELETE_PROFILE_POINT(point) { point, nullptr, nullptr }
84
85#endif // SST_CORE_ELI_PROFILEPOINTINFO_H
Definition profilePointInfo.h:24
Definition elibase.h:74