12#ifndef SST_CORE_SST_INFO_H
13#define SST_CORE_SST_INFO_H
15#include "sst/core/configShared.h"
16#include "sst/core/eli/elementinfo.h"
27#include "tinyxml/tinyxml.h"
34#define CFG_OUTPUTHUMAN 0x00000001
35#define CFG_OUTPUTXML 0x00000002
36#define CFG_VERBOSE 0x00000004
47 using FilterMap_t = std::multimap<std::string, std::string>;
55 std::set<std::string> res;
56 for (
auto& i : m_filters )
74 bool doVerbose()
const {
return m_optionBits & CFG_VERBOSE; }
75 void addFilter(
const std::string& name);
83 int setPositionalArg(
int UNUSED(num),
const std::string& arg)
90 int parseHelp(std::string UNUSED(arg)) {
return printUsage(); }
92 SST_CONFIG_DECLARE_OPTION_NOVAR(help, std::bind(&SSTInfoConfig::parseHelp,
this, std::placeholders::_1));
95 static int parseVersion(std::string UNUSED(arg))
97 fprintf(stderr,
"SST Release Version %s\n", PACKAGE_VERSION);
101 SST_CONFIG_DECLARE_OPTION_NOVAR(version, std::bind(&SSTInfoConfig::parseVersion, std::placeholders::_1));
105 int parseQuiet(
const std::string& UNUSED(arg))
107 m_optionBits &= ~CFG_VERBOSE;
111 SST_CONFIG_DECLARE_OPTION_NOVAR(quiet, std::bind(&SSTInfoConfig::parseQuiet,
this, std::placeholders::_1));
114 SST_CONFIG_DECLARE_OPTION(
bool, debugEnabled,
false, &StandardConfigParsers::flag_set_true);
117 int parseNoDisplay(
const std::string& UNUSED(arg))
119 m_optionBits &= ~CFG_OUTPUTHUMAN;
123 SST_CONFIG_DECLARE_OPTION_NOVAR(no_display, std::bind(&SSTInfoConfig::parseNoDisplay,
this, std::placeholders::_1));
126 SST_CONFIG_DECLARE_OPTION(
bool, interactiveEnabled,
false, &StandardConfigParsers::flag_set_true);
131 int parseXML(
const std::string& UNUSED(arg))
133 m_optionBits |= CFG_OUTPUTXML;
137 SST_CONFIG_DECLARE_OPTION_NOVAR(xml, std::bind(&SSTInfoConfig::parseXML,
this, std::placeholders::_1));
139 SST_CONFIG_DECLARE_OPTION(
140 std::string, XMLFilePath,
"./SSTInfo.xml", &StandardConfigParsers::from_string<std::string>);
145 int parseLibs(
const std::string& arg)
151 SST_CONFIG_DECLARE_OPTION_NOVAR(libs, std::bind(&SSTInfoConfig::parseLibs,
this, std::placeholders::_1));
156 std::vector<std::string> m_elementsToProcess;
157 unsigned int m_optionBits;
158 FilterMap_t m_filters;
184 std::string componentName;
185 std::vector<std::string> stringIndexer;
186 std::map<std::string, std::string> infoMap;
190 std::map<std::string, std::vector<ComponentInfo>>
getComponentInfo() {
return m_components; }
204 void outputXML(
int Index, TiXmlNode* XMLParentElement);
207 void setLibraryInfo(std::string baseName, std::string componentName, std::string info);
213 void filterSearch(std::stringstream& outputStream, std::string tag, std::string searchTerm);
227 void resetFilters(
bool libFilter) { m_libraryFilter = libFilter, m_componentFilters.clear(); }
241 for (
auto& pair : m_components ) {
242 for (
auto& comp : pair.second ) {
243 if ( comp.componentName == component ) {
244 m_componentFilters.push_back(component);
252 template <
class BaseType>
254 template <
class BaseType>
256 template <
class BaseType>
259 std::string getLibraryDescription() {
return ""; }
263 std::map<std::string, std::vector<ComponentInfo>> m_components;
264 std::vector<std::string> m_componentNames;
265 bool m_libraryFilter =
false;
266 std::vector<std::string> m_componentFilters;
275class InteractiveWindow
280 info = newwin(LINES - 3, COLS, 0, 0);
281 console = newwin(3, COLS, LINES - 3, 0);
285 void draw(
bool drawConsole =
true);
288 void toggleAutofillBox();
299 void printConsole(
const char* input)
301 DISABLE_WARN_FORMAT_SECURITY
302 wprintw(console, input);
305 void resetCursor(
int pos) { wmove(console, 1, pos); }
306 int getCursorPos() {
return getcurx(console); }
312 bool autofillEnabled;
int printUsage()
Called to print the help/usage message.
Definition configBase.cc:275
ConfigShared(bool suppress_print, bool include_libpath, bool include_env, bool include_verbose)
ConfigShared constructor that it meant to be used when needing a stand alone ConfigShared (i....
Definition configShared.cc:23
FilterMap_t & getFilterMap()
Definition sstinfo.h:65
unsigned int getOptionBits()
Definition sstinfo.h:68
std::set< std::string > getElementsToProcessArray()
Return the list of elements to be processed.
Definition sstinfo.h:53
void clearFilterMap()
Clears the current filter map.
Definition sstinfo.h:62
std::string getUsagePrelude() override
Called to get the prelude for the help/usage message.
Definition sstinfo.cc:779
SSTInfoConfig(bool suppress_print)
Create a new SSTInfo configuration and parse the Command Line.
Definition sstinfo.cc:740
bool doVerbose() const
Definition sstinfo.h:74
bool processAllElements() const
Definition sstinfo.h:72
std::string getLibraryName()
Return the Name of the Library.
Definition sstinfo.h:179
void setAllLibraryInfo()
Store all Library Information.
Definition sstinfo.cc:1031
void outputText(std::stringstream &os)
Return text from info map based on filters.
Definition sstinfo.cc:879
bool getFilter()
Filter output from info map.
Definition sstinfo.h:221
SSTLibraryInfo(const std::string &name)
Create a new SSTInfoElement_LibraryInfo object.
Definition sstinfo.h:174
void setLibraryInfo(std::string baseName, std::string componentName, std::string info)
Put text into info map.
Definition sstinfo.cc:843
void filterSearch(std::stringstream &outputStream, std::string tag, std::string searchTerm)
Set filters based on search term.
Definition sstinfo.cc:920
void setLibraryFilter(bool filter)
Sets the internal library filter status.
Definition sstinfo.h:233
void clearHighlights()
Clear highlight characters from info strings.
Definition sstinfo.cc:990
int setComponentFilter(std::string component)
Adds the component filter string to the end of the internal vector of components.
Definition sstinfo.h:239
void resetFilters(bool libFilter)
Clears the component filter and sets the internal library filter status.
Definition sstinfo.h:227
void outputHumanReadable(std::ostream &os, int LibIndex)
Output the Library Information.
Definition sstinfo.cc:1078
void outputXML(int Index, TiXmlNode *XMLParentElement)
Create the formatted XML data of the Library.
Definition sstinfo.cc:1123
std::map< std::string, std::vector< ComponentInfo > > getComponentInfo()
Return the map of all component info for the Library.
Definition sstinfo.h:190