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