![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
Typed OutputPort class. More...
#include <smgl/Ports.hpp>
Classes | |
| struct | TypedConnection |
| Describes typed connections from an output port. More... | |
Public Types | |
| using | Arguments = std::tuple< Args... > |
Public Types inherited from smgl::Port | |
| enum class | State { Idle , Waiting , Queued , Error } |
Public Member Functions | |
| ~OutputPort () override | |
| OutputPort (T source) | |
| Construct with a copy of source. Source is effectively constant. | |
| OutputPort (T *source) | |
| Construct with a pointer to a source. | |
| OutputPort (std::function< T(Args...)> source, Args &&... args) | |
| Construct with a function source. | |
| template<class Obj , class ObjMemberFn > | |
| OutputPort (Obj *obj, ObjMemberFn &&fn, Args &&... args) | |
| Construct with a member function source. | |
| OutputPort (const OutputPort &)=delete | |
| OutputPort & | operator= (const OutputPort &)=delete |
| OutputPort (const OutputPort &&)=delete | |
| OutputPort & | operator= (const OutputPort &&)=delete |
| std::vector< Connection > | getConnections () const override |
| Get a list of active connections. | |
| std::size_t | numConnections () const override |
| Get the number of active connections. | |
| void | setArgs (Args &&... args) |
| Set the arguments passed to a function source. | |
| T | val () |
| Get the current value of source. | |
| T | operator() () |
| Get the current value of source. | |
| bool | update () override |
| Update all active connections with the value of the source. | |
| void | notify (State s) override |
| Notify all active connections of this port's state. | |
| Metadata | serialize () override |
| Get port metadata. | |
| void | deserialize (const Metadata &m) override |
| Load port metadata. | |
| template<std::size_t... Is> | |
| auto | run_ (std::tuple< Args... > &tup, std::index_sequence< Is... >) -> T |
Public Member Functions inherited from smgl::Port | |
| State | state () const |
| void | setState (State s) |
| void | setParent (Node *p) |
Public Member Functions inherited from smgl::UniquelyIdentifiable | |
| auto | uuid () const -> Uuid |
| void | setUuid (const Uuid &uuid) |
Private Member Functions | |
| template<std::size_t... Is> | |
| T | run_ (std::tuple< Args... > &tup, std::index_sequence< Is... >) |
| T | run_ (std::tuple< Args... > &tup) |
| void | connect (Input *ip) final |
| void | disconnect (Input *ip) final |
Private Attributes | |
| std::function< T(Args...)> | source_ |
| Arguments | args_ |
| std::unordered_map< Uuid, TypedConnection > | connections_ |
Additional Inherited Members | |
Protected Member Functions inherited from smgl::Output | |
| Output () | |
| ~Output () override=default | |
Protected Member Functions inherited from smgl::Port | |
| Port ()=default | |
| Port (State s) | |
| virtual | ~Port ()=default |
Protected Member Functions inherited from smgl::UniquelyIdentifiable | |
| UniquelyIdentifiable ()=default | |
Protected Attributes inherited from smgl::Port | |
| State | state_ {State::Idle} |
| Node * | parent_ {nullptr} |
Protected Attributes inherited from smgl::UniquelyIdentifiable | |
| Uuid | uuid_ {Uuid::Uuid4()} |
Typed OutputPort class.
An OutputPort provides access to the value of its source. It is similar to a getter function. On update(), it posts the current value of source to all connected InputPorts. T should be default constructible.
| T | Type of object received by this port |
| using smgl::OutputPort< T, Args >::Arguments = std::tuple<Args...> |
|
override |
Destructor performs auto-disconnect
Definition at line 112 of file PortsImpl.hpp.
|
explicit |
Construct with a copy of source. Source is effectively constant.
Definition at line 121 of file PortsImpl.hpp.
|
explicit |
Construct with a pointer to a source.
Definition at line 127 of file PortsImpl.hpp.
|
explicit |
Construct with a function source.
If calling source requires arguments, the initial value for these arguments must be passed as the last parameter. Argument values can be changed with setArgs().
Definition at line 134 of file PortsImpl.hpp.
|
explicit |
Construct with a member function source.
If calling source requires arguments, the initial value for these arguments must be passed as the last parameter. Argument values can be changed with setArgs().
Definition at line 142 of file PortsImpl.hpp.
|
delete |
Disable copy
|
delete |
Disable move
|
finalprivatevirtual |
Connect to an input port. Uses RTTI to determine if ip is actually of type InputPort<T>.
| smgl::bad_connection | if ip is not of type InputPort<T> |
Implements smgl::Output.
Definition at line 234 of file PortsImpl.hpp.
|
overridevirtual |
|
finalprivatevirtual |
Disconnect from an input port
Implements smgl::Output.
Definition at line 248 of file PortsImpl.hpp.
|
overridevirtual |
Get a list of active connections.
Implements smgl::Output.
Definition at line 149 of file PortsImpl.hpp.
|
overridevirtual |
Notify all active connections of this port's state.
Implements smgl::Port.
Definition at line 197 of file PortsImpl.hpp.
|
overridevirtual |
Get the number of active connections.
Implements smgl::Output.
Definition at line 161 of file PortsImpl.hpp.
| auto smgl::OutputPort< T, Args >::operator() | ( | ) |
Get the current value of source.
Definition at line 179 of file PortsImpl.hpp.
|
delete |
Disable move
|
delete |
Disable copy
|
private |
Redirect function to get source value with arguments
Definition at line 228 of file PortsImpl.hpp.
|
private |
Get source value with arguments
| auto smgl::OutputPort< T, Args >::run_ | ( | std::tuple< Args... > & | tup, |
| std::index_sequence< Is... > | |||
| ) | -> T |
Definition at line 221 of file PortsImpl.hpp.
|
overridevirtual |
| void smgl::OutputPort< T, Args >::setArgs | ( | Args &&... | args | ) |
Set the arguments passed to a function source.
Definition at line 168 of file PortsImpl.hpp.
|
overridevirtual |
Update all active connections with the value of the source.
Implements smgl::Port.
Definition at line 187 of file PortsImpl.hpp.
| auto smgl::OutputPort< T, Args >::val | ( | ) |
Get the current value of source.
Definition at line 174 of file PortsImpl.hpp.
|
private |
|
private |
|
private |