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