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