SST  15.1.0
StructuralSimulationToolkit
categoryInfo.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_CATEGORY_INFO_H
13 #define SST_CORE_CATEGORY_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 <string>
21 #include <vector>
22 
23 namespace SST::ELI {
24 
26 {
27 public:
28  uint32_t category() const { return cat_; }
29 
30  static const char* categoryName(int cat)
31  {
32  switch ( cat ) {
33  case COMPONENT_CATEGORY_PROCESSOR:
34  return "PROCESSOR COMPONENT";
35  case COMPONENT_CATEGORY_MEMORY:
36  return "MEMORY COMPONENT";
37  case COMPONENT_CATEGORY_NETWORK:
38  return "NETWORK COMPONENT";
39  case COMPONENT_CATEGORY_SYSTEM:
40  return "SYSTEM COMPONENT";
41  default:
42  return "UNCATEGORIZED COMPONENT";
43  }
44  }
45 
46  void toString(std::ostream& os) const { os << " Category: " << categoryName(cat_) << "\n"; }
47 
48  template <class XMLNode>
49  void outputXML(XMLNode* UNUSED(node))
50  {}
51 
52 protected:
53  template <class T>
54  explicit ProvidesCategory(T* UNUSED(t)) :
55  cat_(T::ELI_getCategory())
56  {}
57 
58 private:
59  uint32_t cat_;
60 };
61 
62 #define SST_ELI_CATEGORY_INFO(cat) \
63  static uint32_t ELI_getCategory() \
64  { \
65  return cat; \
66  }
67 
68 } // namespace SST::ELI
69 
70 #endif
Definition: attributeInfo.h:22
Definition: categoryInfo.h:25