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 )
71 bool doVerbose()
const {
return m_optionBits & CFG_VERBOSE; }
72 void addFilter(
const std::string& name);
78 int setPositionalArg(
int UNUSED(num),
const std::string& arg)
85 int parseHelp(std::string UNUSED(arg)) {
return printUsage(); }
87 SST_CONFIG_DECLARE_OPTION_NOVAR(help, std::bind(&SSTInfoConfig::parseHelp,
this, std::placeholders::_1));
90 static int parseVersion(std::string UNUSED(arg))
92 fprintf(stderr,
"SST Release Version %s\n", PACKAGE_VERSION);
96 SST_CONFIG_DECLARE_OPTION_NOVAR(version, std::bind(&SSTInfoConfig::parseVersion, std::placeholders::_1));
100 int parseQuiet(
const std::string& UNUSED(arg))
102 m_optionBits &= ~CFG_VERBOSE;
106 SST_CONFIG_DECLARE_OPTION_NOVAR(quiet, std::bind(&SSTInfoConfig::parseQuiet,
this, std::placeholders::_1));
109 SST_CONFIG_DECLARE_OPTION(
bool, debugEnabled,
false, &StandardConfigParsers::flag_set_true);
112 int parseNoDisplay(
const std::string& UNUSED(arg))
114 m_optionBits &= ~CFG_OUTPUTHUMAN;
118 SST_CONFIG_DECLARE_OPTION_NOVAR(no_display, std::bind(&SSTInfoConfig::parseNoDisplay,
this, std::placeholders::_1));
121 SST_CONFIG_DECLARE_OPTION(
bool, interactiveEnabled,
false, &StandardConfigParsers::flag_set_true);
126 int parseXML(
const std::string& UNUSED(arg))
128 m_optionBits |= CFG_OUTPUTXML;
132 SST_CONFIG_DECLARE_OPTION_NOVAR(xml, std::bind(&SSTInfoConfig::parseXML,
this, std::placeholders::_1));
134 SST_CONFIG_DECLARE_OPTION(
135 std::string, XMLFilePath,
"./SSTInfo.xml", &StandardConfigParsers::from_string<std::string>);
140 int parseLibs(
const std::string& arg)
146 SST_CONFIG_DECLARE_OPTION_NOVAR(libs, std::bind(&SSTInfoConfig::parseLibs,
this, std::placeholders::_1));
150 unsigned int m_optionBits;
151 FilterMap_t m_filters;
177 std::string componentName;
178 std::vector<std::string> stringIndexer;
179 std::map<std::string, std::string> infoMap;
183 std::map<std::string, std::vector<ComponentInfo>>
getComponentInfo() {
return m_components; }
197 void outputXML(
int Index, TiXmlNode* XMLParentElement);
200 void setLibraryInfo(std::string baseName, std::string componentName, std::string info);
206 void filterSearch(std::stringstream& outputStream, std::string tag, std::string searchTerm);
215 void resetFilters(
bool libFilter) { m_libraryFilter = libFilter, m_componentFilters.clear(); }
229 for (
auto& pair : m_components ) {
230 for (
auto& comp : pair.second ) {
231 if ( comp.componentName == component ) {
232 m_componentFilters.push_back(component);
240 template <
class BaseType>
242 template <
class BaseType>
244 template <
class BaseType>
247 std::string getLibraryDescription() {
return ""; }
251 std::map<std::string, std::vector<ComponentInfo>> m_components;
252 bool m_libraryFilter =
false;
253 std::vector<std::string> m_componentFilters;
262class InteractiveWindow
267 info = newwin(LINES - 3, COLS, 0, 0);
268 console = newwin(3, COLS, LINES - 3, 0);
272 void draw(
bool drawConsole =
true);
283 void printConsole(
const char* input)
285 DISABLE_WARN_FORMAT_SECURITY
286 wprintw(console, input);
289 void resetCursor(
int pos) { wmove(console, 1, pos); }
290 int getCursorPos() {
return getcurx(console); }
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:62
unsigned int getOptionBits()
Definition sstinfo.h:65
std::set< std::string > getElementsToProcessArray()
Return the list of elements to be processed.
Definition sstinfo.h:53
std::string getUsagePrelude() override
Called to get the prelude for the help/usage message.
Definition sstinfo.cc:774
SSTInfoConfig(bool suppress_print)
Create a new SSTInfo configuration and parse the Command Line.
Definition sstinfo.cc:735
bool doVerbose() const
Definition sstinfo.h:71
bool processAllElements() const
Definition sstinfo.h:69
std::string getLibraryName()
Return the Name of the Library.
Definition sstinfo.h:172
void setAllLibraryInfo()
Store all Library Information.
Definition sstinfo.cc:1007
void outputText(std::stringstream &os)
Return text from info map based on filters.
Definition sstinfo.cc:855
SSTLibraryInfo(const std::string &name)
Create a new SSTInfoElement_LibraryInfo object.
Definition sstinfo.h:167
void setLibraryInfo(std::string baseName, std::string componentName, std::string info)
Put text into info map.
Definition sstinfo.cc:820
void filterSearch(std::stringstream &outputStream, std::string tag, std::string searchTerm)
Set filters based on search term.
Definition sstinfo.cc:896
void setLibraryFilter(bool filter)
Sets the internal library filter status.
Definition sstinfo.h:221
void clearHighlights()
Clear highlight characters from info strings.
Definition sstinfo.cc:966
int setComponentFilter(std::string component)
Adds the component filter string to the end of the internal vector of components.
Definition sstinfo.h:227
void resetFilters(bool libFilter)
Clears the component filter and sets the internal library filter status.
Definition sstinfo.h:215
void outputHumanReadable(std::ostream &os, int LibIndex)
Output the Library Information.
Definition sstinfo.cc:1054
void outputXML(int Index, TiXmlNode *XMLParentElement)
Create the formatted XML data of the Library.
Definition sstinfo.cc:1099
std::map< std::string, std::vector< ComponentInfo > > getComponentInfo()
Return the map of all component info for the Library.
Definition sstinfo.h:183