190 template <typename T>
194 template <typename T>
203 template <typename T, typename... Args>
208 template <typename T, typename... Args>
355 template <class PortType>
357 const
std::
string& name,
359 std::unordered_map<
Uuid, PortType*>& byUuid,
360 std::map<
std::
string, PortType*>& byName);
389 detail::NodeFactoryType::InstanceType::unknown_identifier;
428template <
class... Ts>
455template <
class T,
class... Ts>
470template <
class... Ts>
531#define SMGL_NODE(...) ::smgl::NodeDesc<__VA_ARGS__>(#__VA_ARGS__)
533#include "smgl/NodeImpl.hpp"
void notify_output_ports_(Port::State s)
auto serialize(bool useCache, const filesystem::path &cacheRoot) -> Metadata
Serialize the Node to Metadata, optionally caching to disk.
void registerOutputPort(const std::string &name, OutputPort< T, Args... > &port)
Register an OutputPort instance with this class.
virtual auto serialize_(bool useCache, const filesystem::path &cacheDir) -> Metadata
Serialize the Node's state to Metadata.
std::map< std::string, Input * > inputs_by_name_
std::shared_ptr< Node > Pointer
static void LoadAndRegisterPort(const std::string &name, const Metadata &data, std::unordered_map< Uuid, PortType * > &byUuid, std::map< std::string, PortType * > &byName)
auto getOutputConnections() const -> std::vector< Connection >
Get a list of active output connections.
auto getOutputPort(const Uuid &uuid) -> Output &
Get a registered OutputPort by Uuid.
auto update_input_ports_() -> bool
auto getNumberOfOutputConnections() const -> size_t
Get the number of active output connections.
std::function< bool()> usesCacheDir
auto state() -> State
Get the current update state.
auto getInputPort(const Uuid &uuid) -> Input &
Get a registered InputPort by Uuid.
void update()
Update the Node.
std::map< std::string, Output * > outputs_by_name_
auto getOutputPortsInfo() const -> std::vector< Info >
Get registered OutputPort info.
virtual void deserialize_(const Metadata &data, const filesystem::path &cacheDir)
Deserialize the Node's state from Metadata.
auto getInputPortsInfo() const -> std::vector< Info >
Get registered InputPort info.
auto update_output_ports_() -> bool
std::function< void()> compute
Function executed when Node's InputPorts have queued updates and update() is called.
auto getInputConnections() const -> std::vector< Connection >
Get a list of active input connections.
void deserialize(const Metadata &meta, const filesystem::path &cacheRoot)
Deserialize the Node to Metadata.
std::unordered_map< Uuid, Input * > inputs_by_uuid_
void registerInputPort(const std::string &name, InputPort< T > &port)
Register an InputPort instance with this class.
auto getNumberOfInputConnections() const -> size_t
Get the number of active input connections.
void registerPort(const std::string &name, InputPort< T > &port)
Register an InputPort instance with this class.
std::unordered_map< Uuid, Output * > outputs_by_uuid_
Generic output port interface.
Base class for objects which are uniquely identifiable.
auto uuid() const -> Uuid
Universally unique identifier class.
Class for constructing and managing the lifetime of a singleton object.
Project top-level namespace.
auto RegisterNode(const std::string &name) -> bool
Register a Node type for serialization/deserialization using a custom name.
auto DeregisterNodes(const NodeDesc< Ts > &... descs) -> bool
Deregister one or more Node types using source-token descriptors.
auto NodeName() -> std::string
auto DeregisterNode() -> bool
Deregister a Node type.
detail::NodeFactoryType::InstanceType::unknown_identifier unknown_identifier
nlohmann::ordered_json Metadata
Metadata storage class.
auto CreateNode(const std::string &name) -> Node::Pointer
auto RegisterNodes(const NodeDesc< Ts > &... descs) -> bool
Register one or more Node types for serialization/deserialization.
auto IsRegistered(const std::string &name) -> bool
ISO C++ top-level namespace.
Describes untyped connections from an output port.
Source-token descriptor pairing a Node type with a serialization key.
std::string key
Registered serialization key (the source spelling of T)
NodeDesc(std::string k)
Construct a descriptor with an explicit serialization key.
Port registration information.
Info(std::string n, const Uuid &u)