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