smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
smgl Namespace Reference

Project top-level namespace. More...

Namespaces

namespace  detail
 Implementation details namespace.
 
namespace  filesystem
 Alias for std::filesystem
 
namespace  policy
 Template policies namespace.
 
namespace  type_traits
 Custom type traits namespace.
 

Classes

struct  bad_connection
 Exception thrown for port connection failures. More...
 
struct  BaseStyle
 Style struct for a node's base style. More...
 
struct  Connection
 Describes untyped connections from an output port. More...
 
struct  ElementStyle
 Style struct for ports and labels. More...
 
struct  FontStyle
 Style struct for a node's overall font style. More...
 
class  Graph
 A collection of Nodes for managing pipeline state and serialization. More...
 
class  GraphStyle
 Class defining a Graph's style when writing to a Dot file. More...
 
class  Input
 Generic input port interface. More...
 
class  InputPort
 Typed InputPort class. More...
 
class  Node
 Generic Node class. More...
 
struct  NodeDesc
 Source-token descriptor pairing a Node type with a serialization key. More...
 
struct  NodeStyle
 Style struct containing all sub-styles for a node. More...
 
class  Output
 Generic output port interface. More...
 
class  OutputPort
 Typed OutputPort class. More...
 
class  Port
 Generic port interface. More...
 
class  UniquelyIdentifiable
 Base class for objects which are uniquely identifiable. More...
 
struct  Update
 Typed update sent over connections. More...
 
class  Uuid
 Universally unique identifier class. More...
 

Typedefs

using Metadata = nlohmann::ordered_json
 Metadata storage class.
 
using unknown_identifier = detail::NodeFactoryType::InstanceType::unknown_identifier
 

Enumerations

enum class  CacheType { Adjacent = 0 , Subdirectory }
 Cache Location Type. More...
 
enum  LogLevel {
  All = 0 , Debug = 10 , Info = 20 , Warning = 30 ,
  Error = 40 , None = 100
}
 Log levels. More...
 

Functions

void WriteDotFile (const filesystem::path &path, const Graph &g, const GraphStyle &style=GraphStyle())
 Write Graph to a file in the Graphviz Dot format.
 
void SetLogLevel (LogLevel level)
 Set the library log level.
 
void SetLogLevel (const std::string &level)
 
auto GetLogLevel () -> LogLevel
 Get the library log level.
 
void SetLogStream (std::ostream *os)
 Set the output stream.
 
template<typename... Args>
void LogError (Args... args)
 
template<typename... Args>
void LogWarning (Args... args)
 
template<typename... Args>
void LogInfo (Args... args)
 
template<typename... Args>
void LogDebug (Args... args)
 
void WriteMetadata (const filesystem::path &path, const Metadata &m)
 Write Metadata to path in JSON format.
 
Metadata LoadMetadata (const filesystem::path &path)
 Load Metadata from JSON file at path.
 
template<class... Ts>
auto RegisterNodes (const NodeDesc< Ts > &... descs) -> bool
 Register one or more Node types for serialization/deserialization.
 
template<class T >
auto RegisterNode (const std::string &name) -> bool
 Register a Node type for serialization/deserialization using a custom name.
 
template<class T , class... Ts>
auto DeregisterNode () -> bool
 Deregister a Node type.
 
template<class... Ts>
auto DeregisterNodes (const NodeDesc< Ts > &... descs) -> bool
 Deregister one or more Node types using source-token descriptors.
 
auto DeregisterNode (const std::string &name) -> bool
 Deregister a Node type by Name.
 
auto CreateNode (const std::string &name) -> Node::Pointer
 
template<class T >
auto NodeName () -> std::string
 
auto NodeName (const Node::Pointer &node) -> std::string
 
auto NodeName (const Node *node) -> std::string
 
auto IsRegistered (const std::string &name) -> bool
 
auto IsRegistered (const Node::Pointer &node) -> bool
 
auto IsRegistered (const Node *node) -> bool
 
template<class... Ts>
bool RegisterNodes (const NodeDesc< Ts > &... descs)
 Register one or more Node types for serialization/deserialization.
 
template<class T >
bool RegisterNode (const std::string &name)
 Register a Node type for serialization/deserialization using a custom name.
 
template<class T , class... Ts>
bool DeregisterNode ()
 Deregister a Node type.
 
template<class... Ts>
bool DeregisterNodes (const NodeDesc< Ts > &... descs)
 Deregister one or more Node types using source-token descriptors.
 
template<class T >
std::string NodeName ()
 
void connect (Output &op, Input &ip)
 Connect an output port to an input port.
 
void disconnect (Output &op, Input &ip)
 Disconnect an output port and input port.
 
void operator>> (Output &op, Input &ip)
 Connect an output port to an input port.
 
void operator<< (Input &ip, Output &op)
 Connect an output port to an input port.
 
template<class Obj , class ObjMemberFn , typename... Args>
auto WrapFunc (Obj *obj, ObjMemberFn &&fn, Args &&... args)
 Wrap a member function w/ arguments into a lambda function.
 

Detailed Description

Project top-level namespace.

Typedef Documentation

◆ Metadata

using smgl::Metadata = typedef nlohmann::ordered_json

Metadata storage class.

Definition at line 12 of file Metadata.hpp.

◆ unknown_identifier

using smgl::unknown_identifier = typedef detail::NodeFactoryType::InstanceType::unknown_identifier

Thrown by NodeFactoryType when attempting to access an unregistered type

Definition at line 388 of file Node.hpp.

Enumeration Type Documentation

◆ CacheType

enum class smgl::CacheType
strong

Cache Location Type.

Enumerator
Adjacent 

Cache directory is the cache file's parent directory

Subdirectory 

Cache directory is a subdirectory derived from the cache filename

Definition at line 21 of file Graph.hpp.

◆ LogLevel

Log levels.

Enumerator
All 

All messages.

Debug 

Debug messages and above.

Info 

Info messages and above.

Warning 

Warning messages and above.

Error 

Error messages and above.

None 

No messages.

Definition at line 18 of file Logging.hpp.

Function Documentation

◆ connect()

void smgl::connect ( Output op,
Input ip 
)

Connect an output port to an input port.

Exceptions
smgl::bad_connectionif port instances do not share underlying type T

◆ CreateNode()

auto smgl::CreateNode ( const std::string name) -> Node::Pointer

Create a Node using it's registered name

◆ DeregisterNode() [1/3]

template<class T , class... Ts>
bool smgl::DeregisterNode ( ) -> bool

Deregister a Node type.

Uses RTTI to lookup existing registration information.

Because Node registration is global, this typically only needs to be called when testing or debugging custom Nodes.

Returns
Whether or not de-registration was successful for all provided types

Definition at line 88 of file NodeImpl.hpp.

◆ DeregisterNode() [2/3]

template<class T , class... Ts>
auto smgl::DeregisterNode ( ) -> bool

Deregister a Node type.

Uses RTTI to lookup existing registration information.

Because Node registration is global, this typically only needs to be called when testing or debugging custom Nodes.

Returns
Whether or not de-registration was successful for all provided types

Definition at line 88 of file NodeImpl.hpp.

◆ DeregisterNode() [3/3]

auto smgl::DeregisterNode ( const std::string name) -> bool

Deregister a Node type by Name.

Because Node registration is global, this typically only needs to be called when testing or debugging custom Nodes.

◆ DeregisterNodes() [1/2]

template<class... Ts>
bool smgl::DeregisterNodes ( const NodeDesc< Ts > &...  descs) -> bool

Deregister one or more Node types using source-token descriptors.

The SMGL_NODE()-based counterpart to RegisterNodes(): each descriptor's key is deregistered by name. Provided for symmetry so a batch can be registered and deregistered with the same SMGL_NODE() call sites.

Because Node registration is global, this typically only needs to be called when testing or debugging custom Nodes.

Returns
Whether or not de-registration was successful for all provided types

Definition at line 108 of file NodeImpl.hpp.

◆ DeregisterNodes() [2/2]

template<class... Ts>
auto smgl::DeregisterNodes ( const NodeDesc< Ts > &...  descs) -> bool

Deregister one or more Node types using source-token descriptors.

The SMGL_NODE()-based counterpart to RegisterNodes(): each descriptor's key is deregistered by name. Provided for symmetry so a batch can be registered and deregistered with the same SMGL_NODE() call sites.

Because Node registration is global, this typically only needs to be called when testing or debugging custom Nodes.

Returns
Whether or not de-registration was successful for all provided types

Definition at line 108 of file NodeImpl.hpp.

◆ disconnect()

void smgl::disconnect ( Output op,
Input ip 
)

Disconnect an output port and input port.

Does nothing if ports are not connected

◆ IsRegistered() [1/3]

auto smgl::IsRegistered ( const Node node) -> bool

Check whether a Node's type has been registered

◆ IsRegistered() [2/3]

auto smgl::IsRegistered ( const Node::Pointer node) -> bool

Check whether a Node's type has been registered

◆ IsRegistered() [3/3]

auto smgl::IsRegistered ( const std::string name) -> bool

Check whether a name has been registered for a Node type

◆ LogDebug()

template<typename... Args>
void smgl::LogDebug ( Args...  args)

Definition at line 94 of file LoggingPrivate.hpp.

◆ LogError()

template<typename... Args>
void smgl::LogError ( Args...  args)

Definition at line 61 of file LoggingPrivate.hpp.

◆ LogInfo()

template<typename... Args>
void smgl::LogInfo ( Args...  args)

Definition at line 83 of file LoggingPrivate.hpp.

◆ LogWarning()

template<typename... Args>
void smgl::LogWarning ( Args...  args)

Definition at line 72 of file LoggingPrivate.hpp.

◆ NodeName() [1/4]

template<class T >
std::string smgl::NodeName ( ) -> std::string

Get a Node's registered name

Exceptions
smgl::unknown_identifierif the type pointed to by node has not been registered

Definition at line 120 of file NodeImpl.hpp.

◆ NodeName() [2/4]

template<class T >
auto smgl::NodeName ( ) -> std::string

Get a Node's registered name

Exceptions
smgl::unknown_identifierif the type pointed to by node has not been registered

Definition at line 120 of file NodeImpl.hpp.

◆ NodeName() [3/4]

auto smgl::NodeName ( const Node node) -> std::string

Get a Node's registered name

Exceptions
smgl::unknown_identifierif the type pointed to by node has not been registered

◆ NodeName() [4/4]

auto smgl::NodeName ( const Node::Pointer node) -> std::string

Get a Node's registered name

Exceptions
smgl::unknown_identifierif the type pointed to by node has not been registered

◆ operator<<()

void smgl::operator<< ( Input ip,
Output op 
)

Connect an output port to an input port.

Exceptions
smgl::bad_connectionif port instances do not share underlying type T

◆ operator>>()

void smgl::operator>> ( Output op,
Input ip 
)

Connect an output port to an input port.

Exceptions
smgl::bad_connectionif port instances do not share underlying type T

◆ RegisterNode() [1/2]

template<class T >
bool smgl::RegisterNode ( const std::string name) -> bool

Register a Node type for serialization/deserialization using a custom name.

This is the low-level primitive that RegisterNodes() folds onto. Most users should prefer RegisterNodes(SMGL_NODE(...)) so that keys are captured from source rather than spelled out by hand.

Node registration is global and only needs to be performed once during execution of a program.

Definition at line 81 of file NodeImpl.hpp.

◆ RegisterNode() [2/2]

template<class T >
auto smgl::RegisterNode ( const std::string name) -> bool

Register a Node type for serialization/deserialization using a custom name.

This is the low-level primitive that RegisterNodes() folds onto. Most users should prefer RegisterNodes(SMGL_NODE(...)) so that keys are captured from source rather than spelled out by hand.

Node registration is global and only needs to be performed once during execution of a program.

Definition at line 81 of file NodeImpl.hpp.

◆ RegisterNodes() [1/2]

template<class... Ts>
bool smgl::RegisterNodes ( const NodeDesc< Ts > &...  descs) -> bool

Register one or more Node types for serialization/deserialization.

Each descriptor is registered under its source-token key. Use the SMGL_NODE() macro to construct descriptors so that keys are captured from the as-written type spelling (e.g. std::string stays std::string) and are byte-identical across compilers and platforms.

SMGL_NODE(my::ns::ReadImageNode),
SMGL_NODE(my::ns::WriteImageNode));
#define SMGL_NODE(...)
Construct a smgl::NodeDesc for type T with a source-faithful key.
Definition Node.hpp:531
auto RegisterNodes(const NodeDesc< Ts > &... descs) -> bool
Register one or more Node types for serialization/deserialization.
Definition NodeImpl.hpp:66

Node registration is global and only needs to be performed once during execution of a program.

Returns
Whether or not registration was successful for all provided types

Definition at line 66 of file NodeImpl.hpp.

◆ RegisterNodes() [2/2]

template<class... Ts>
auto smgl::RegisterNodes ( const NodeDesc< Ts > &...  descs) -> bool

Register one or more Node types for serialization/deserialization.

Each descriptor is registered under its source-token key. Use the SMGL_NODE() macro to construct descriptors so that keys are captured from the as-written type spelling (e.g. std::string stays std::string) and are byte-identical across compilers and platforms.

SMGL_NODE(my::ns::ReadImageNode),
SMGL_NODE(my::ns::WriteImageNode));

Node registration is global and only needs to be performed once during execution of a program.

Returns
Whether or not registration was successful for all provided types

Definition at line 66 of file NodeImpl.hpp.

◆ SetLogLevel()

smgl::SetLogLevel ( LogLevel  level)

Set the library log level.

◆ WrapFunc()

template<class Obj , class ObjMemberFn , typename... Args>
auto smgl::WrapFunc ( Obj *  obj,
ObjMemberFn &&  fn,
Args &&...  args 
)

Wrap a member function w/ arguments into a lambda function.

Definition at line 5 of file UtilitiesImpl.hpp.

◆ WriteDotFile()

void smgl::WriteDotFile ( const filesystem::path path,
const Graph g,
const GraphStyle style = GraphStyle() 
)

Write Graph to a file in the Graphviz Dot format.

Friend function: Graphviz WriteDotFile