![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
A collection of Nodes for managing pipeline state and serialization. More...
#include <smgl/Graph.hpp>
Public Types | |
| enum class | State { Idle , Updating , Error } |
Public Member Functions | |
| auto | operator[] (const Uuid &uuid) const -> Node::Pointer |
| Get a Node by Uuid. | |
| void | insertNode (const Node::Pointer &n) |
| Add a Node to the Graph. | |
| template<typename NodeType , typename... Args> | |
| auto | insertNode (Args... args) -> std::shared_ptr< NodeType > |
| Construct a Node and add it to the graph. | |
| template<typename N , typename... Ns> | |
| void | insertNodes (N &n0, Ns &&... nodes) |
| Add one or more Nodes to the Graph. | |
| void | removeNode (const Node::Pointer &n) |
| Remove a Node from the Graph. | |
| auto | size () const -> std::size_t |
| Get the number of nodes in the graph. | |
| auto | state () const -> State |
| Get the current graph state. | |
| auto | cacheFile () const -> filesystem::path |
| Get the root cache file for the Graph. | |
| void | setCacheFile (const filesystem::path &p) |
| Set the root cache file for the Graph. | |
| auto | cacheType () const -> CacheType |
| Get the graph's CacheType. | |
| void | setCacheType (CacheType t) |
| Set the graph's CacheType. | |
| auto | cacheDir () const -> filesystem::path |
| Returns the cache directory as configured by cacheFile() and cacheType() | |
| auto | cacheEnabled () const -> bool |
| Whether or not graph caching is enabled. | |
| void | setEnableCache (bool enable) |
| Set whether or not graph caching is enabled. | |
| void | setProjectMetadata (const Metadata &m) |
| Set the project metadata. | |
| auto | projectMetadata () const -> const Metadata & |
| Get the project metadata. | |
| auto | projectMetadata () -> Metadata & |
| Get the project metadata. | |
| auto | update () -> State |
| Update the Graph's nodes. | |
| template<typename N , typename... Ns> | |
| auto | insertNodes (N &n0, Ns &&... nodes) -> void |
Public Member Functions inherited from smgl::UniquelyIdentifiable | |
| auto | uuid () const -> Uuid |
| void | setUuid (const Uuid &uuid) |
Static Public Member Functions | |
| static auto | Serialize (const Graph &g) -> Metadata |
| Serialize a Graph to a Metadata object. | |
| static auto | Save (const filesystem::path &path, const Graph &g, bool writeCache=false) -> void |
| Save a Graph to a JSON file. | |
| static auto | Load (const filesystem::path &path) -> Graph |
| Load a Graph from a JSON file. | |
| static auto | CheckRegistration (const filesystem::path &path) -> std::vector< std::string > |
| Checks that a Graph JSON file can be loaded. | |
| static auto | CheckRegistration (const Graph &g) -> std::vector< std::string > |
| Checks that a Graph can be serialized. | |
| static auto | Schedule (const Graph &g) -> std::vector< Node::Pointer > |
| Generate an update schedule for the provided Graph. | |
Static Public Attributes | |
| static constexpr std::uint32_t | Version {1} |
Static Private Member Functions | |
| static auto | Serialize (const Graph &g, bool useCache, const filesystem::path &cacheDir) -> Metadata |
Private Attributes | |
| filesystem::path | cacheFile_ |
| CacheType | cacheType_ {CacheType::Subdirectory} |
| bool | cache_enabled_ {false} |
| std::unordered_map< Uuid, Node::Pointer > | nodes_ |
| State | state_ {State::Idle} |
| Metadata | extraMetadata_ |
Friends | |
| auto | WriteDotFile (const filesystem::path &path, const Graph &g, const GraphStyle &style) -> void |
| Write Graph to a file in the Graphviz Dot format. | |
Additional Inherited Members | |
Protected Member Functions inherited from smgl::UniquelyIdentifiable | |
| UniquelyIdentifiable ()=default | |
Protected Attributes inherited from smgl::UniquelyIdentifiable | |
| Uuid | uuid_ {Uuid::Uuid4()} |
A collection of Nodes for managing pipeline state and serialization.
|
strong |
| auto smgl::Graph::cacheEnabled | ( | ) | const -> bool |
Whether or not graph caching is enabled.
If cacheEnabled() is true, Nodes are allowed to write data to a unique subdirectory in cacheDir(). The exact location is relative to cacheFile() and is determined by setCacheType().
| auto smgl::Graph::cacheFile | ( | ) | const -> filesystem::path |
Get the root cache file for the Graph.
If cacheEnabled() is true, Nodes are allowed to write data to a unique subdirectory in cacheDir(). The exact location is relative to cacheFile() and is determined by setCacheType().
| auto smgl::Graph::cacheType | ( | ) | const -> CacheType |
Get the graph's CacheType.
A graph's CacheType determines the location of the cache relative to cacheFile().
|
static |
Checks that a Graph JSON file can be loaded.
Checks that every Node in the Graph is registered with the serialization system. Returns the list of unregistered types as strings so that missing registrations can be handled appropriately before calling Graph::Load.
| path | Path to input file in the JSON format |
|
static |
Checks that a Graph can be serialized.
Checks that every Node in the Graph is registered with the serialization system. Returns the list of unregistered types as strings so that missing registrations can be handled appropriately before calling Graph::Load. Because unregistered types have no source-token key, the returned strings are the raw typeid().name() of each unregistered Node (mangled on GCC/Clang, readable on MSVC).
| g | Graph to be checked |
| auto smgl::Graph::insertNode | ( | Args... | args | ) | -> std::shared_ptr<NodeType> |
Construct a Node and add it to the graph.
Definition at line 5 of file GraphImpl.hpp.
| auto smgl::Graph::insertNodes | ( | N & | n0, |
| Ns &&... | nodes | ||
| ) | -> void |
Definition at line 13 of file GraphImpl.hpp.
|
static |
| auto smgl::Graph::projectMetadata | ( | ) | -> Metadata & |
Get the project metadata.
|
static |
Save a Graph to a JSON file.
If writeCache is true, cache information will be written adjacent to the provided path honoring the cacheType() configuration.
| path | Path to output file |
| g | Graph to be saved |
| writeCache | Whether or not to write cache files |
|
static |
Serialize a Graph to a Metadata object.
|
staticprivate |
Perform graph serialization
| void smgl::Graph::setCacheFile | ( | const filesystem::path & | p | ) |
Set the root cache file for the Graph.
If cacheEnabled() is true, Nodes are allowed to write data to a unique subdirectory in cacheDir(). The exact location is relative to cacheFile() and is determined by setCacheType().
| void smgl::Graph::setCacheType | ( | CacheType | t | ) |
Set the graph's CacheType.
A graph's CacheType determines the location of the cache relative to cacheFile().
| void smgl::Graph::setEnableCache | ( | bool | enable | ) |
Set whether or not graph caching is enabled.
If cacheEnabled() is true, Nodes are allowed to write data to a unique subdirectory in cacheDir(). The exact location is relative to cacheFile() and is determined by setCacheType().
| auto smgl::Graph::update | ( | ) | -> State |
|
friend |
Write Graph to a file in the Graphviz Dot format.
Friend function: Graphviz WriteDotFile
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |