![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
smgl is a C++14 library for creating custom dataflow pipelines that are instrumented for serialization. It was designed to make it easy to convert existing processing workflows into repeatable and observable pipelines for the purposes of experimental reporting, reliability, and validation.
View the latest source code on GitHub.
std::filesystem. If it is not found, then Boost.Filesystem is required. This behavior can be controlled with the SMGL_USE_BOOSTFS CMake flag.This project is built and installed using the CMake build system:
This will install the headers and library to your default system path and provide an easy method to link smgl against your own CMake project:
The CMake project provides a number of flags for configuring the build:
SMGL_BUILD_JSON: Use an in-source build of the JSON library during compilation. (Default: ON)SMGL_USE_BOOSTFS: Use the Boost::filesystem library instead of std::filesystem. (Default: ON if std::filesystem is not found)SMGL_BUILD_TESTS: Build project unit tests. This will download and build the Google Test framework. (Default: OFF)SMGL_BUILD_DOCS: Build documentation. Dependencies: Doxygen, Graphviz (optional). (Default: ON if Doxygen is found)See the Building custom nodes tutorial.
smgl supports two different methods of graph serialization. Explicit serialization writes the graph state to disk when explicitly requested by a call to smgl::Graph::Save. Automatic caching writes the graph state to disk when smgl::Graph::update is called and continuously updates the cache file as Nodes complete execution. For both methods, Nodes must be registered with the Node factory in order for serialization to work correctly.
This example demonstrates writing the graph state to disk a single time using smgl::Graph::Save. This will write all nodes, connections, and intermediate results to disk. The location of the intermediate results relative to the provided JSON file path is controlled by smgl::Graph::setCacheType. To only write the JSON file and not the intermediate results, omit the optional writeCache argument to smgl::Graph::Save.
This example illustrates writing the graph to disk repeatedly as the nodes are updated. This will write all nodes, connections, and intermediate results to disk. The location of the intermediate results relative to the cache file path is controlled by smgl::Graph::setCacheType.
smgl supports basic graph visualization by writing Dot files compatible with the Graphviz software library. Use smgl::WriteDotFile to write a graph to disk, and then use dot to convert this file into an image.
Write the graph to a dot file:
Use dot to convert the dot file to an image:
This library is not meant for everyone. Its primary purpose is for building workflows that are instrumented with metadata, but there are many other use cases for dataflow libraries. If smgl doesn't fit your needs, perhaps on of these libraries will: