### TinyXml Tutorial Link
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/index.html
Provides a link to a tutorial for getting started with TinyXml. This is a starting point for users to learn how to use the parser.
```HTML
TinyXML Tutorial
```
--------------------------------
### Makefile for Test Frameworks Installation
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
A Makefile snippet providing rules for the configure/make system to install the SST test frameworks.
```Makefile
# Makefile.inc
# Provides rules for the configure/make system on how to install the test frameworks
```
--------------------------------
### Build SST on Ubuntu 20.04
Source: https://github.com/sstsimulator/sst-core/blob/master/README.md
Installs required packages (openmpi, libtool, autoconf, python3, etc.) and compiles the SST core from source. It clones the repository, runs autogen.sh, configures the build with a specified installation prefix, and installs the toolkit.
```sh
DEBIAN_FRONTEND=noninteractive sudo apt install openmpi-bin openmpi-common libtool libtool-bin autoconf python3 python3-dev automake build-essential git
mkdir sst-core && cd sst-core
git clone https://github.com/sstsimulator/sst-core.git sst-core-src
(cd sst-core-src && ./autogen.sh)
mkdir build && cd build
../sst-core-src/configure --prefix=$PWD/../sst-core-install
make install
```
--------------------------------
### Install pdoc3 for Building Documentation
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
The documentation for the SST Testing Frameworks is built using 'pdoc'. Ensure you have Python 3.5+ and install 'pdoc3' using pip.
```bash
> pip3 install pdoc3
```
--------------------------------
### Test SST Installation
Source: https://github.com/sstsimulator/sst-core/blob/master/README.md
Executes a core test command for the Structural Simulation Toolkit (SST) to verify a successful installation. This command should be run after the toolkit has been built and installed.
```sh
/path/to/sst-core/install/bin/sst-test-core
```
--------------------------------
### Install Executables and Libraries
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/CMakeLists.txt
This snippet specifies the installation rules for the built targets. It installs the main executables (sst, sst-info, sst-config, sst-register) and the simulation executables (sstsim.x, sstinfo.x) to the 'libexec' directory.
```cmake
install(TARGETS sst sst-info sst-config sst-register)
install(TARGETS sstsim.x sstinfo.x DESTINATION libexec)
```
--------------------------------
### Configure and Install SST Simulator Configuration
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/cmake_configure_files/CMakeLists.txt
Configures the sstsimulator.conf file from a template and installs it to the etc/sst directory.
```cmake
configure_file(sstsimulator.conf.in
${sst-core_BINARY_DIR}/src/sst/sstsimulator.conf)
install(FILES ${sst-core_BINARY_DIR}/src/sst/sstsimulator.conf
DESTINATION "etc/sst")
```
--------------------------------
### Install CMake Modules
Source: https://github.com/sstsimulator/sst-core/blob/master/share/CMakeLists.txt
This snippet installs all CMake files from the current directory to the 'lib/cmake/SST' destination. It uses 'install' with 'FILES_MATCHING' and a 'PATTERN' to ensure only relevant files are installed.
```cmake
install(
DIRECTORY "."
DESTINATION "lib/cmake/SST"
FILES_MATCHING
PATTERN "*.cmake")
```
--------------------------------
### Install blessings and pygments for Colorized Outputs
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
For colorized output during test runs, both the 'blessings' and 'pygments' Python modules are required. These can be installed together using pip.
```bash
> pip install blessings pygments
```
--------------------------------
### Build SST on CentOS/RHEL 7
Source: https://github.com/sstsimulator/sst-core/blob/master/README.md
Installs necessary dependencies (gcc, python3, openmpi, etc.) and builds the SST core from source using autogen.sh and configure, specifying MPI compilers and installation prefix.
```sh
sudo yum install gcc gcc-c++ python3 python3-devel make automake git libtool libtool-ltdl-devel openmpi openmpi-devel zlib-devel
mkdir sst-core && cd sst-core
git clone https://github.com/sstsimulator/sst-core.git sst-core-src
(cd sst-core-src && ./autogen.sh)
mkdir build && cd build
../sst-core-src/configure \
MPICC=/usr/lib64/openmpi/bin/mpicc \
MPICXX=/usr/lib64/openmpi/bin/mpic++ \
--prefix=$PWD/../sst-core-install
make install
```
--------------------------------
### Install SST-CORE cfgoutput Headers
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/cfgoutput/CMakeLists.txt
This CMake code snippet defines and installs the header files for the SST-CORE cfgoutput module. It lists the header files to be installed and specifies their destination directory within the project's include path.
```CMake
set(SSTCfgOutputHeaders dotConfigOutput.h jsonConfigOutput.h
pythonConfigOutput.h xmlConfigOutput.h)
install(FILES ${SSTCfgOutputHeaders} DESTINATION "include/sst/core/cfgoutput")
```
--------------------------------
### Install SST-CORE RNG Headers with CMake
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/rng/CMakeLists.txt
This snippet defines a list of header files for the SST-CORE random number generator (RNG) module and installs them into the 'include/sst/core/rng' directory. It uses CMake's `set` command to define the header list and the `install` command to perform the installation.
```CMake
set(SSTRNGHeaders
constant.h
discrete.h
distrib.h
expon.h
rng.h
gaussian.h
marsaglia.h
mersenne.h
poisson.h
uniform.h
xorshift.h)
install(FILES ${SSTRNGHeaders} DESTINATION "include/sst/core/rng")
```
--------------------------------
### Install SST-CORE Testing Executables and Loader
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/CMakeLists.txt
This CMake installation command installs the generated testing executables (`sst-test-core`, `sst-test-elements`) and the Python loader script (`sst_test_engine_loader.py`) into the 'bin' directory. It also specifies read, write, and execute permissions for the owner, and read and execute permissions for the group and world.
```cmake
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/sst-test-core
${CMAKE_CURRENT_BINARY_DIR}/sst-test-elements sst_test_engine_loader.py
DESTINATION bin
PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE)
```
--------------------------------
### Install SST Serialization Headers (CMake)
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/serialization/CMakeLists.txt
This snippet defines a list of header files for the SST serialization module and installs them into the 'include/sst/core/serialization' directory. It uses CMake's 'add_subdirectory' and 'install' commands.
```CMake
add_subdirectory(impl)
set(SSTSerializationHeaders
objectMap.h
objectMapDeferred.h
serializable.h
serializable_base.h
serialize.h
serialize_impl_fwd.h
serialize_serializable.h
serializer.h
serializer_fwd.h
statics.h)
install(FILES ${SSTSerializationHeaders}
DESTINATION "include/sst/core/serialization")
```
--------------------------------
### Install SST-CORE Math Headers (CMake)
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/math/CMakeLists.txt
This snippet configures CMake to install the header files for the SST-CORE math module. It specifies the header files to be installed and their destination directory within the installed package.
```cmake
set(SSTMathHeaders sqrt.h)
install(FILES ${SSTMathHeaders} DESTINATION "include/sst/core/math")
```
--------------------------------
### Configure and Install SST Version Pkg-config File
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/cmake_configure_files/CMakeLists.txt
Configures the SST version pkg-config file (SST-VERSION.pc.in) and installs it to the lib/pkgconfg directory.
```cmake
configure_file(SST_version.pc.in
${sst-core_BINARY_DIR}/src/sst/SST-${VERSION}.pc)
install(FILES ${sst-core_BINARY_DIR}/src/sst/SST-${VERSION}.pc
DESTINATION "lib/pkgconfg")
```
--------------------------------
### Example XML: Hello World
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
A simple XML document containing a declaration and a single element with text content.
```XML
World
```
--------------------------------
### Example XML: Application Configuration
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
A more complex XML structure representing application settings, including comments and various data types for attributes.
```XML
Welcome to MyApp
Thank you for using MyApp
```
--------------------------------
### Install SST-CORE eli Headers
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/eli/CMakeLists.txt
This snippet defines a list of header files for the SST-CORE eli module and installs them into the 'include/sst/core/eli' directory. It ensures that the necessary header files are available for the project.
```CMake
set(SSTELIHeaders
attributeInfo.h
categoryInfo.h
defaultInfo.h
elementbuilder.h
elementinfo.h
elibase.h
interfaceInfo.h
paramsInfo.h
portsInfo.h
profilePointInfo.h
statsInfo.h
simpleInfo.h
subcompSlotInfo.h)
install(FILES ${SSTELIHeaders} DESTINATION "include/sst/core/eli")
```
--------------------------------
### Install SST-CORE Testing Utility Scripts
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/CMakeLists.txt
This CMake installation command installs various Python utility scripts used for unit testing within the SST-CORE framework. These scripts are placed in the 'libexec' directory, making them available for test execution.
```cmake
install(
FILES test_engine.py
sst_unittest_parameterized.py
sst_unittest.py
test_engine_globals.py
test_engine_junit.py
test_engine.py
test_engine_support.py
test_engine_unittest.py
sst_unittest_support.py
DESTINATION libexec)
```
--------------------------------
### Clone SST-Core Repository
Source: https://github.com/sstsimulator/sst-core/blob/master/CONTRIBUTING.md
Clones the user's forked sst-core repository from GitHub. This is the initial step to start local development.
```git
git clone git@github.com:fryeguy52/sst-core.git
```
--------------------------------
### Install SST-CORE Environment Headers (CMake)
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/env/CMakeLists.txt
This snippet configures CMake to install the necessary header files for the SST-CORE environment module. It specifies the header files and their installation destination.
```cmake
set(SSTENVHeaders envconfig.h envquery.h)
install(FILES ${SSTENVHeaders} DESTINATION "include/sst/core/env")
```
--------------------------------
### Configure Build Info Header
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/cmake_configure_files/CMakeLists.txt
Configures the build_info.h file from a template. The installation of this file is marked with a TODO.
```cmake
configure_file(build_info.h.in ${sst-core_BINARY_DIR}/src/sst/core/build_info.h)
# TODO figure out how build_info.h needs to be installed
```
--------------------------------
### Install testtools for Concurrent Testing
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
To enable concurrent testing within the SST Testing Frameworks, the 'testtools' Python module needs to be installed using pip. This module facilitates running tests in parallel.
```bash
> pip install testtools
```
--------------------------------
### Install Header Files
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/CMakeLists.txt
This snippet installs the SST header files, including those specified by the SSTHeaders variable and generated headers like sst_config.h and build_info.h, into the 'include/sst/core' directory.
```cmake
install(FILES ${SSTHeaders} DESTINATION "include/sst/core")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sst_config.h
${CMAKE_CURRENT_BINARY_DIR}/build_info.h
DESTINATION "include/sst/core")
```
--------------------------------
### Install SST Interfaces Headers
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/interfaces/CMakeLists.txt
Installs the header files for SST interfaces into the 'include/sst/core/interfaces' directory. This makes the interface headers available for use by other components.
```cmake
set(SSTInterfacesHeaders simpleNetwork.h stdMem.h stringEvent.h TestEvent.h)
install(FILES ${SSTInterfacesHeaders} DESTINATION "include/sst/core/interfaces")
```
--------------------------------
### Configure and Install SST-Core Headers
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/cmake_configure_files/CMakeLists.txt
Configures sst_config.h.in and installs the generated sst_config.h file into the include/sst/core directory. It also creates an INTERFACE library 'sst-config-headers' and sets its include directories.
```cmake
configure_file(sst_config.h.in ${sst-core_BINARY_DIR}/src/sst/core/sst_config.h)
add_library(sst-config-headers INTERFACE)
target_include_directories(sst-config-headers
INTERFACE ${sst-core_BINARY_DIR}/src/sst/core/)
install(FILES ${sst-core_BINARY_DIR}/src/sst/core/sst_config.h
DESTINATION include/sst/core)
```
--------------------------------
### Install SST Serialization Implementation Headers (CMake)
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/serialization/impl/CMakeLists.txt
This CMake code snippet defines a list of header files related to SST serialization implementation and then installs these files into the 'include/sst/core/serialization/impl' directory. It's a standard CMake configuration for managing project headers.
```CMake
set(SSTSerializationImplHeaders
mapper.h
packer.h
ser_buffer_accessor.h
serialize_adapter.h
serialize_array.h
serialize_atomic.h
serialize_insertable.h
serialize_string.h
serialize_tuple.h
serialize_utility.h
sizer.h
unpacker.h)
install(FILES ${SSTSerializationImplHeaders}
DESTINATION "include/sst/core/serialization/impl")
```
--------------------------------
### Example XML: Poetry Verse
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
An XML document with nested elements representing a poetry verse.
```XML
Alas
Great World
Alas (again)
```
--------------------------------
### Install SST-CORE Profile Headers with CMake
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/profile/CMakeLists.txt
This CMake code snippet defines the header files for the SST-CORE profile module and installs them into the 'include/sst/core/profile' directory. It ensures that the necessary profile-related header files are available for use in other projects.
```CMake
set(SSTprofileHeaders componentProfileTool.h profiletool.h)
install(FILES ${SSTprofileHeaders} DESTINATION "include/sst/core/profile")
```
--------------------------------
### Example XML: Shapes with Attributes
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
An XML document defining shapes with integer and float-based attributes.
```XML
```
--------------------------------
### Install SST Interprocess Headers with CMake
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/interprocess/CMakeLists.txt
This CMake code snippet defines a list of header files for the SST interprocess module and installs them into the 'include/sst/core/interprocess' directory of the build. It ensures that the necessary header files are available for projects using SST-CORE.
```CMake
set(SSTInterprocessHeaders
circularBuffer.h
ipctunnel.h
mmapchild_pin3.h
mmapparent.h
shmchild.h
shmparent.h
sstmutex.h
tunneldef.h)
install(FILES ${SSTInterprocessHeaders}
DESTINATION "include/sst/core/interprocess")
```
--------------------------------
### Install SST-CORE statapi Headers (CMake)
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/statapi/CMakeLists.txt
This CMake script defines a list of header files for the SST-CORE statapi and installs them into the 'include/sst/core/statapi' directory. It ensures that the necessary header files are available for projects that depend on the SST-CORE statapi.
```CMake
set(SSTStatAPIHeaders
stataccumulator.h
statbase.h
statengine.h
statfieldinfo.h
statgroup.h
stathistogram.h
statnull.h
statoutputcsv.h
statoutput.h
statoutputhdf5.h
statoutputjson.h
statoutputtxt.h
statuniquecount.h)
install(FILES ${SSTStatAPIHeaders} DESTINATION "include/sst/core/statapi")
```
--------------------------------
### Update Documentation
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/changes.txt
The documentation for the project has been updated to reflect the latest changes and ensure accuracy. This includes revisions to descriptions, usage examples, and API details.
```C++
// Updated the docs.
```
--------------------------------
### C++: Basic AppSettings Initialization and Save/Load
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Demonstrates the basic usage of the AppSettings class, including creating a default settings object, saving it to an XML file, and then loading it back. This serves as a fundamental example of the settings management lifecycle.
```C++
int main(void)
{
AppSettings settings;
ssettings.save("appsettings2.xml");
settings.load("appsettings2.xml");
return 0;
}
```
--------------------------------
### TiXmlString Start and Finish Pointers
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tinystr_8h-source.html
Internal helper methods to get pointers to the beginning (`start()`) and the end (`finish()`) of the string's character buffer.
```C++
char* start() const { return rep_->str; }
```
```C++
char* finish() const { return rep_->str + rep_->size; }
```
--------------------------------
### C++: Customize, Save, and Load AppSettings
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Provides a more comprehensive example of using the AppSettings class. It shows how to customize various settings such as name, messages, window configurations, and connection details before saving to XML, and then loading and displaying these settings. This illustrates a typical workflow for managing application preferences.
```C++
int main(void)
{
// block: customise and save settings
{
AppSettings settings;
settings.m_name="HitchHikerApp";
settings.m_messages["Welcome"]="Don't Panic";
settings.m_messages["Farewell"]="Thanks for all the fish";
settings.m_windows.push_back(WindowSettings(15,25,300,250,"BookFrame"));
settings.m_connection.ip="192.168.0.77";
settings.m_connection.timeout=42.0;
settings.save("appsettings2.xml");
}
// block: load settings
{
AppSettings settings;
settings.load("appsettings2.xml");
printf("%s: %s\n", settings.m_name.c_str(),
settings.m_messages["Welcome"].c_str());
WindowSettings & w=settings.m_windows.front();
printf("%s: Show window '%s' at %d,%d (%d x %d)\n",
settings.m_name.c_str(), w.name.c_str(), w.x, w.y, w.w, w.h);
printf("%s: %s\n", settings.m_name.c_str(), settings.m_messages["Farewell"].c_str());
}
return 0;
}
```
--------------------------------
### Get Help for SST Testing Commands
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
To view the available command-line options and usage instructions for the SST testing commands, use the '--help' flag with either 'sst-test-core' or 'sst-test-elements'.
```bash
sst-test-core --help
sst-test-elements --help
```
--------------------------------
### Build SST Testing Frameworks Documentation
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
After installing 'pdoc3', navigate to the core's testing frameworks source directory and execute the 'build_docs.sh' script to generate the HTML documentation. The output will be found in the 'html/testingframework/index.html' file.
```bash
> cd /src/sst/core/testingframework
> ./build_docs.sh
```
--------------------------------
### SST-Core CMake Build Steps
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/CMAKE_README.md
Demonstrates the basic steps to build the SST-Core project using CMake, including creating a build directory, running cmake, and executing make.
```Shell
> cd sstcore-VERSION
> mkdir build
> cd build
> cmake ../experimental
> make -j
> make install
```
--------------------------------
### Programmatically Build XML Document (Alternative Order)
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Shows an alternative method for programmatically building the same XML document as build_simple_doc, by linking nodes as early as possible.
```C++
void write_simple_doc2( )
{
// same as write_simple_doc1 but add each node
// as early as possible into the tree.
TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
TiXmlElement * element = new TiXmlElement( "Hello" );
doc.LinkEndChild( element );
TiXmlText * text = new TiXmlText( "World" );
element->LinkEndChild( text );
doc.SaveFile( "madeByHand2.xml" );
}
```
--------------------------------
### Programmatically Build XML Document
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Demonstrates building an XML document (similar to example1.xml) programmatically using TinyXML elements and saving it to a file.
```C++
void build_simple_doc( )
{
// Make xml: World
TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
TiXmlElement * element = new TiXmlElement( "Hello" );
TiXmlText * text = new TiXmlText( "World" );
element->LinkEndChild( text );
doc.LinkEndChild( decl );
doc.LinkEndChild( element );
doc.SaveFile( "madeByHand.xml" );
}
```
--------------------------------
### Compiling and Running TinyXML Test
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/readme.txt
Instructions on how to compile and run the 'xmltest' executable from the TinyXML library. This involves navigating to the tinyxml directory and using make commands.
```makefile
make clean
make
```
--------------------------------
### C++: Decode AppSettings from XML using TinyXML
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Illustrates the `load` method for the `AppSettings` class, showing how to parse an XML file and populate the application settings object. It uses TinyXML handles to navigate the XML structure and extract values for messages, window properties, and connection details.
```C++
void AppSettings::load(const char* pFilename)
{
TiXmlDocument doc(pFilename);
if (!doc.LoadFile()) return;
TiXmlHandle hDoc(&doc);
TiXmlElement* pElem;
TiXmlHandle hRoot(0);
// block: name
{
pElem=hDoc.FirstChildElement().Element();
// should always have a valid root but handle gracefully if it does
if (!pElem) return;
m_name=pElem->Value();
// save this for later
hRoot=TiXmlHandle(pElem);
}
// block: string table
{
m_messages.clear(); // trash existing table
pElem=hRoot.FirstChild( "Messages" ).FirstChild().Element();
for( pElem; pElem; pElem=pElem->NextSiblingElement())
{
const char *pKey=pElem->Value();
const char *pText=pElem->GetText();
if (pKey && pText)
{
```
--------------------------------
### Configuring Component Links in SST
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/mainpage.dox
Shows how to define and connect components using SST::Link in a Python configuration script. It illustrates creating components, setting their parameters, and establishing a link between them with specified latencies.
```Python
comp_A = sst.Component("cA", "simpleElementExample.simpleComponent")
comp_A.addParams({
"workPerCycle" : """1000""",
"commSize" : """100""",
})
comp_B = sst.Component("cB", "simpleElementExample.simpleComponent")
comp_B.addParams({
"workPerCycle" : """1000""",
"commSize" : """100""",
})
link_AB = sst.Link("link_AB")
link_AB.connect( (comp_A, "Slink", "10000ps"), (comp_B, "Nlink", "10000ps") )
```
--------------------------------
### TiXmlNode: Get Previous Sibling
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlDocument-members.html
Retrieves the previous sibling node of a TiXmlNode. Versions are available to filter by value or to get the previous sibling of a specific type.
```C++
const [TiXmlNode](classTiXmlNode.html) *[PreviousSibling](classTiXmlNode.html#c2cd892768726270e511b2ab32de4d10)() const;
[TiXmlNode](classTiXmlNode.html)
`[inline]`
```
```C++
const [TiXmlNode](classTiXmlNode.html) *[PreviousSibling](classTiXmlNode.html#5bdd49327eec1e609b7d22af706b8316)(const char *) const;
[TiXmlNode](classTiXmlNode.html)
```
```C++
const [TiXmlNode](classTiXmlNode.html) *[PreviousSibling](classTiXmlNode.html#658276f57d35d5d4256d1dc1a2c398ab)(const std::string &_value) const;
[TiXmlNode](classTiXmlNode.html)
`[inline]`
```
```C++
[TiXmlNode](classTiXmlNode.html) *[PreviousSibling](classTiXmlNode.html#cc8a0434c7f401d4a3b6dee77c1a5912)(const std::string &_value);
[TiXmlNode](classTiXmlNode.html)
`[inline]`
```
--------------------------------
### C++: Encode AppSettings to XML using TinyXML
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Details the implementation of the `save` method for the `AppSettings` class, demonstrating how to serialize application settings into an XML format using the TinyXML library. It covers creating XML elements for messages, window settings, and connection information, including attributes and text content.
```C++
void AppSettings::save(const char* pFilename)
{
TiXmlDocument doc;
TiXmlElement* msg;
TiXmlComment * comment;
string s;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
TiXmlElement * root = new TiXmlElement(m_name.c_str());
doc.LinkEndChild( root );
comment = new TiXmlComment();
s=" Settings for "+m_name+" ";
comment->SetValue(s.c_str());
root->LinkEndChild( comment );
// block: messages
{
MessageMap::iterator iter;
TiXmlElement * msgs = new TiXmlElement( "Messages" );
root->LinkEndChild( msgs );
for (iter=m_messages.begin(); iter != m_messages.end(); iter++)
{
const string & key=(\*iter).first;
const string & value=(\*iter).second;
msg = new TiXmlElement(key.c_str());
msg->LinkEndChild( new TiXmlText(value.c_str()));
msgs->LinkEndChild( msg );
}
}
// block: windows
{
TiXmlElement * windowsNode = new TiXmlElement( "Windows" );
root->LinkEndChild( windowsNode );
list::iterator iter;
for (iter=m_windows.begin(); iter != m_windows.end(); iter++)
{
const WindowSettings& w=*iter;
TiXmlElement * window;
window = new TiXmlElement( "Window" );
windowsNode->LinkEndChild( window );
window->SetAttribute("name", w.name.c_str());
window->SetAttribute("x", w.x);
window->SetAttribute("y", w.y);
window->SetAttribute("w", w.w);
window->SetAttribute("h", w.h);
}
}
// block: connection
{
TiXmlElement * cxn = new TiXmlElement( "Connection" );
root->LinkEndChild( cxn );
cxn->SetAttribute("ip", m_connection.ip.c_str());
cxn->SetDoubleAttribute("timeout", m_connection.timeout);
}
doc.SaveFile(pFilename);
}
```
--------------------------------
### SST Test Frameworks Package Initialization
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
The `__init__.py` file that establishes the SST Test Frameworks as a Python package. It also includes support for pdoc build rules.
```Python
# __init__.py
# Python file to create the SST Test Frameworks as a Python package. Also supports some pdoc build rules.
```
--------------------------------
### Parse XML and Dump to STDOUT
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Demonstrates loading an XML file and recursively dumping its structure, including elements, attributes, and text, to standard output using TinyXML. It handles document declarations, elements with attributes, comments, and text nodes.
```C++
#include "stdafx.h"
#include "tinyxml.h"
// ----------------------------------------------------------------------
// STDOUT dump and indenting utility functions
// ----------------------------------------------------------------------
const unsigned int NUM_INDENTS_PER_SPACE=2;
const char * getIndent( unsigned int numIndents )
{
static const char * pINDENT=" + ";
static const unsigned int LENGTH=strlen( pINDENT );
unsigned int n=numIndents*NUM_INDENTS_PER_SPACE;
if ( n > LENGTH ) n = LENGTH;
return &pINDENT[ LENGTH-n ];
}
// same as getIndent but no "+" at the end
const char * getIndentAlt( unsigned int numIndents )
{
static const char * pINDENT=" ";
static const unsigned int LENGTH=strlen( pINDENT );
unsigned int n=numIndents*NUM_INDENTS_PER_SPACE;
if ( n > LENGTH ) n = LENGTH;
return &pINDENT[ LENGTH-n ];
}
int dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent)
{
if ( !pElement ) return 0;
TiXmlAttribute* pAttrib=pElement->FirstAttribute();
int i=0;
int ival;
double dval;
const char* pIndent=getIndent(indent);
printf("\n");
while (pAttrib)
{
printf( "%s%s: value=[%s]", pIndent, pAttrib->Name(), pAttrib->Value());
if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS) printf( " int=%d", ival);
if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) printf( " d=%1.1f", dval);
printf( "\n" );
i++;
pAttrib=pAttrib->Next();
}
return i;
}
void dump_to_stdout( TiXmlNode* pParent, unsigned int indent = 0 )
{
if ( !pParent ) return;
TiXmlNode* pChild;
TiXmlText* pText;
int t = pParent->Type();
printf( "%s", getIndent(indent));
int num;
switch ( t )
{
case TiXmlNode::DOCUMENT:
printf( "Document" );
break;
case TiXmlNode::ELEMENT:
printf( "Element [%s]", pParent->Value() );
num=dump_attribs_to_stdout(pParent->ToElement(), indent+1);
switch(num)
{
case 0: printf( " (No attributes)"); break;
case 1: printf( "%s1 attribute", getIndentAlt(indent)); break;
default: printf( "%s%d attributes", getIndentAlt(indent), num); break;
}
break;
case TiXmlNode::COMMENT:
printf( "Comment: [%s]", pParent->Value());
break;
case TiXmlNode::UNKNOWN:
printf( "Unknown" );
break;
case TiXmlNode::TEXT:
pText = pParent->ToText();
printf( "Text: [%s]", pText->Value() );
break;
case TiXmlNode::DECLARATION:
printf( "Declaration" );
break;
default:
break;
}
printf( "\n" );
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
{
dump_to_stdout( pChild, indent+1 );
}
}
// load the named file and dump its structure to STDOUT
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\n", pFilename);
dump_to_stdout( &doc ); // defined later in the tutorial
}
else
{
printf("Failed to load file \"%s\"\n", pFilename);
}
}
// ----------------------------------------------------------------------
// main() for printing files named on the command line
// ----------------------------------------------------------------------
int main(int argc, char* argv[])
{
for (int i=1; i sst-test-core
```
--------------------------------
### General Cleanup Suggestions
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/changes.txt
General cleanup suggestions provided by Fletcher Dunn have been implemented. This improves code readability and maintainability.
```C++
// General cleanup suggestions from Fletcher Dunn.
```
--------------------------------
### SST-CORE CMake Project Setup
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/CMakeLists.txt
Initializes the SST-CORE CMake project, specifying the minimum required CMake version, project name, version, description, and supported languages (C and CXX). It also includes a script to prevent in-source builds.
```CMake
cmake_minimum_required(VERSION 3.16)
project(
sst-core
VERSION 13.0.0
DESCRIPTION "SSTCore"
LANGUAGES C CXX)
set(SST_TOP_SRC_DIR "${sst-core_SOURCE_DIR}/..")
include(cmake/PreventInSourceBuilds.cmake)
```
--------------------------------
### SST Core Test Frameworks Launch Scripts
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
Executable Python scripts used to launch the SST test frameworks for sst-core and sst-elements testing. These scripts load the test engine and discover/run tests.
```Shell
#!/usr/bin/env python
# sst-test-core
# Loads and runs the sst-test-engine-loader.py configured for sst-core testing
```
```Shell
#!/usr/bin/env python
# sst-test-elements
# Loads and runs the sst-test-engine-loader.py configured for sst-elements testing
```
--------------------------------
### Fetch Updates from Official SST-Core Repository
Source: https://github.com/sstsimulator/sst-core/blob/master/CONTRIBUTING.md
Fetches all updates from the official sst-core repository and pulls the 'devel' branch to synchronize the local repository with the latest changes.
```git
git checkout devel
git pull
```
--------------------------------
### Example of Safe XML Traversal
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlHandle.html
Demonstrates a common pattern in TinyXml for safely accessing nested elements and attributes, using null checks to prevent errors. This example shows how to retrieve the value of 'attributeB' from the second 'Child' element within a 'Document'.
```C++
TiXmlElement* root = document.FirstChildElement( "Document" );
if ( root )
{
TiXmlElement* element = root->FirstChildElement( "Element" );
if ( element )
{
TiXmlElement* child = element->FirstChildElement( "Child" );
if ( child )
{
TiXmlElement* child2 = child->NextSiblingElement( "Child" );
if ( child2 )
{
// Finally do something useful.
```
--------------------------------
### Setup Upstream for SST-Core Devel Branch
Source: https://github.com/sstsimulator/sst-core/blob/master/CONTRIBUTING.md
Configures the local 'devel' branch to track the 'devel' branch of the official sst-core repository. This allows easy fetching of updates from the main project.
```git
git checkout devel
git remote add sst-official git@github.com:sstsimulator/sst-core.git
git pull --all
git branch devel --set-upstream-to sst-official/devel
```
--------------------------------
### Get Element Text Content - C++
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlElement.html
Provides a convenient way to get the text content directly within an element. It returns the character string of the Text node if the first child is a TiXmlText node, otherwise returns null. This method has limitations compared to direct node access.
```C++
const char* TiXmlElement::GetText(
) const
```
--------------------------------
### SST-CORE Testing and Packaging Setup
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/CMakeLists.txt
Enables the CMake testing framework and includes a placeholder for packaging configurations, indicating that testing and packaging are supported features within the build process.
```CMake
# ------------------------------------------------------------------------
# -- TESTING
# ------------------------------------------------------------------------
enable_testing()
# ------------------------------------------------------------------------
# -- PACKAGING
```
--------------------------------
### Get Node Value
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlNode-members.html
Retrieves the value of the current node.
```C++
const char* Value() const
```
--------------------------------
### Get Document
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlNode.html
Returns a pointer to the TiXmlDocument that the current node belongs to.
```C++
const TiXmlDocument* GetDocument() const
```
--------------------------------
### Running Testsuites with Specific Paths
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
Demonstrates how to use the `-p` command-line argument to specify individual testsuite files or directories for execution. This allows for targeted testing of specific test suites or groups of tests within directories.
```Shell
sst-test-elements -p /testsuite_default_merlin.py /testsuite_extra_merlin.py
sst-test-elements -p
```
--------------------------------
### Build Documentation Script
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
A shell script used to build documentation for the SST test frameworks using pdoc. It generates an HTML output directory.
```Shell
# build_docs.sh
# Script to build documentation using pdoc. Will create a html/ directory.
```
--------------------------------
### Get Node Type
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlElement-members.html
Retrieves the type of the TiXmlNode. This is an inline method.
```C++
Type() const
```
--------------------------------
### Get Row Information
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlNode-members.html
Retrieves the row number associated with the node.
```C++
int Row() const
```
--------------------------------
### Get Parent Node
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlNode-members.html
Retrieves the parent node of the current node.
```C++
const TiXmlNode* Parent() const
```
--------------------------------
### SST-Core CMake Build Directives
Source: https://github.com/sstsimulator/sst-core/blob/master/experimental/CMAKE_README.md
Lists common CMake build directives for SST-Core, explaining their purpose in configuring the build, such as installation prefix, build type, documentation, testing, memory pools, and debugging.
```Shell
-DCMAKE_INSTALL_PREFIX=/path : Sets the CMake installation prefix
-DCMAKE_BUILD_TYPE=TYPE : (Debug, Release, etc) Sets the optimization/debug flags
-DBUILD_DOCUMENTATION=ON : Enables Doxygen documentation: use `make doc`
-DBUILD_ALL_TESTING=ON : Enables the SST test harness: use `make test`; requires installation
-DSST_DISABLE_MEM_POOLS=ON : Disables the SST memory pools
-DSST_ENABLE_EVENT_TRACKING=ON : Enables the SST even tracking (mem pools must be enabled)
-DSST_ENABLE_DEBUG_OUTPUT=ON : Enables the SST debug flags
-DSST_ENABLE_PROFILE_BUILD: Enables the internal SST profiling options
-DSST_DISABLE_ZLIB=ON : Disables LibZ support
-DSST_ENABLE_HDF5=ON : Enables HDF5 support
-DSST_DISABLE_MPI=ON : Disables MPI
-DSST_BUILD_RPM=ON : Enables RPM packaging. Must have RPMTools installed: use `make package`
-DSST_BUILD_DEB=ON : Enables DEB packaging. Must have Debian tools installed: use `make package`
-DSST_BUILD_TGZ=ON : Enables TGZ packaging. Must have TGZ installed: use `make package`
```
--------------------------------
### Get Node Type
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlNode-members.html
Retrieves the type of the current XML node.
```C++
NodeType NodeType() const
```
--------------------------------
### Get Node Value
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlUnknown-members.html
Retrieves the value of the current XML node.
```C++
Value() const
```
--------------------------------
### SST Test Engine
Source: https://github.com/sstsimulator/sst-core/blob/master/src/sst/core/testingframework/readme.md
The core testing engine for the SST frameworks. It provides the entry point for test discovery and execution, handling runtime arguments, configuration, and test suite execution.
```Python
# test_engine.py
# The main testing frameworks engine. This provides the entry point for discovery and running testsuites.
```
```Python
# test_engine_globals.py
# Globals used by the testing frameworks
```
```Python
# test_engine_support.py
# Support classes/functions used by the testing frameworks
```
```Python
# test_engine_unittest.py
# Modified flavors of the Python unittest engine (improved usage and reporting) and support for the optional concurrent module from testtools
```
```Python
# test_engine_junit.py
# Generates JUnit xml data that can be consumed by Jenkins
```
--------------------------------
### Get Node Type
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/classTiXmlUnknown-members.html
Retrieves the type of the current XML node.
```C++
NodeType() const
```
--------------------------------
### Set Attributes for XML Element
Source: https://github.com/sstsimulator/sst-core/blob/master/external/tinyxml/docs/tutorial0.html
Demonstrates how to set attributes for a TinyXML element using SetAttribute and SetDoubleAttribute.
```C++
window = new TiXmlElement( "Demo" );
window->SetAttribute("name", "Circle");
window->SetAttribute("x", 5);
window->SetAttribute("y", 15);
window->SetDoubleAttribute("radius", 3.14159);
```