SST 12.1.0
Structural Simulation Toolkit
sstinfo.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_SST_INFO_H
13#define SST_CORE_SST_INFO_H
14
15#include "sst/core/eli/elementinfo.h"
16
17#include <map>
18#include <set>
19#include <vector>
20
21#include "tinyxml/tinyxml.h"
22
23class TiXmlNode;
24
25namespace SST {
26
27// CONFIGURATION BITS
28#define CFG_OUTPUTHUMAN 0x00000001
29#define CFG_OUTPUTXML 0x00000002
30#define CFG_VERBOSE 0x00000004
31
32/**
33 * The SSTInfo Configuration class.
34 *
35 * This class will parse the command line, and setup internal
36 * lists of elements and components to be processed.
37 */
39{
40public:
41 typedef std::multimap<std::string, std::string> FilterMap_t;
42 /** Create a new SSTInfo configuration and parse the Command Line. */
45
46 /** Parse the Command Line.
47 * @param argc The number of arguments passed to the application
48 * @param argv The array of arguments
49 */
50 int parseCmdLine(int argc, char* argv[]);
51
52 /** Return the list of elements to be processed. */
53 std::set<std::string> getElementsToProcessArray()
54 {
55 std::set<std::string> res;
56 for ( auto& i : m_filters )
57 res.insert(i.first);
58 return res;
59 }
60
61 /** Return the filter map */
62 FilterMap_t& getFilterMap() { return m_filters; }
63
64 /** Return the bit field of various command line options enabled. */
65 unsigned int getOptionBits() { return m_optionBits; }
66
67 /** Return the user defined path the XML File. */
68 std::string& getXMLFilePath() { return m_XMLFilePath; }
69
70 /** Is debugging output enabled? */
71 bool debugEnabled() const { return m_debugEnabled; }
72 bool processAllElements() const { return m_filters.empty(); }
73 bool doVerbose() const { return m_optionBits & CFG_VERBOSE; }
74
75private:
76 void outputUsage();
77 void outputVersion();
78 void addFilter(const std::string& name);
79
80private:
81 char* m_AppName;
82 std::vector<std::string> m_elementsToProcess;
83 unsigned int m_optionBits;
84 std::string m_XMLFilePath;
85 bool m_debugEnabled;
86 FilterMap_t m_filters;
87};
88
89/**
90 * The SSTInfo representation of ElementLibraryInfo object.
91 *
92 * This class is used internally by SSTInfo to load and process
93 * ElementLibraryInfo objects.
94 */
96{
97
98public:
99 /** Create a new SSTInfoElement_LibraryInfo object.
100 * @param eli Pointer to an ElementLibraryInfo object.
101 */
102 SSTLibraryInfo(const std::string& name) : m_name(name) {}
103
104 /** Return the Name of the Library. */
105 // std::string getLibraryName() {if (m_eli && m_eli->name) return m_eli->name; else return ""; }
106 std::string getLibraryName() { return m_name; }
107
108 /** Output the Library Information.
109 * @param LibIndex The Index of the Library.
110 */
111 void outputHumanReadable(std::ostream& os, int LibIndex);
112
113 /** Create the formatted XML data of the Library.
114 * @param LibIndex The Index of the Library.
115 * @param XMLParentElement The parent element to receive the XML data.
116 */
117 void outputXML(int Index, TiXmlNode* XMLParentElement);
118
119 template <class BaseType>
120 void outputHumanReadable(std::ostream& os, bool printAll);
121 template <class BaseType>
122 void outputXML(TiXmlElement* node);
123
124 std::string getLibraryDescription() { return ""; }
125
126private:
127 std::string m_name;
128};
129
130} // namespace SST
131
132#endif // SST_CORE_SST_INFO_H
The SSTInfo Configuration class.
Definition: sstinfo.h:39
FilterMap_t & getFilterMap()
Return the filter map.
Definition: sstinfo.h:62
unsigned int getOptionBits()
Return the bit field of various command line options enabled.
Definition: sstinfo.h:65
std::set< std::string > getElementsToProcessArray()
Return the list of elements to be processed.
Definition: sstinfo.h:53
bool debugEnabled() const
Is debugging output enabled?
Definition: sstinfo.h:71
SSTInfoConfig()
Create a new SSTInfo configuration and parse the Command Line.
Definition: sstinfo.cc:264
int parseCmdLine(int argc, char *argv[])
Parse the Command Line.
Definition: sstinfo.cc:296
std::string & getXMLFilePath()
Return the user defined path the XML File.
Definition: sstinfo.h:68
The SSTInfo representation of ElementLibraryInfo object.
Definition: sstinfo.h:96
std::string getLibraryName()
Return the Name of the Library.
Definition: sstinfo.h:106
SSTLibraryInfo(const std::string &name)
Create a new SSTInfoElement_LibraryInfo object.
Definition: sstinfo.h:102
void outputHumanReadable(std::ostream &os, int LibIndex)
Output the Library Information.
Definition: sstinfo.cc:423
void outputXML(int Index, TiXmlNode *XMLParentElement)
Create the formatted XML data of the Library.
Definition: sstinfo.cc:461