SST  12.0.1
StructuralSimulationToolkit
categoryInfo.h
1 // Copyright 2009-2022 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-2022, 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 <iostream>
19 #include <string>
20 #include <vector>
21 
22 namespace SST {
23 namespace 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& UNUSED(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  ProvidesCategory(T* UNUSED(t)) : cat_(T::ELI_getCategory())
55  {}
56 
57 private:
58  uint32_t cat_;
59 };
60 
61 #define SST_ELI_CATEGORY_INFO(cat) \
62  static uint32_t ELI_getCategory() { return cat; }
63 
64 } // namespace ELI
65 } // namespace SST
66 
67 #endif
Definition: categoryInfo.h:25