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