![]() |
smgl 0.11.0
Structured Metadata Engine and Graph Objects Library
|
Typed InputPort class. More...
#include <smgl/Ports.hpp>
Public Member Functions | |
| ~InputPort () override=default | |
| InputPort (T *target) | |
| Construct with pointer to target object. | |
| InputPort (std::function< void(T)> target) | |
| Construct with std::function target. | |
| template<class Obj , class ObjMemberFn > | |
| InputPort (Obj *obj, ObjMemberFn &&fn) | |
| Construct with member function target. | |
| InputPort (const InputPort &)=delete | |
| InputPort & | operator= (const InputPort &)=delete |
| InputPort (const InputPort &&)=delete | |
| InputPort & | operator= (const InputPort &&)=delete |
| void | post (const Update< T > &u) |
| Post an update to the port. | |
| void | post (T v, bool immediate=false) |
| Post an update to the port. | |
| void | operator() (const Update< T > &u) |
| Post an update to the port. | |
| void | operator() (T v, bool immediate=false) |
| Post an update to the port. | |
| InputPort< T > & | operator= (T v) |
| Post an update to the port. | |
| InputPort< T > & | operator= (Output &op) override |
| Connect an output port to an input port. | |
| bool | update () override |
| Update the target with the most recently posted update. | |
| void | notify (State s) override |
| Receive a state update from a connected port. | |
| Metadata | serialize () override |
| Get port metadata. | |
| void | deserialize (const Metadata &m) override |
| Load port metadata. | |
Public Member Functions inherited from smgl::Input | |
| std::vector< Connection > | getConnections () const |
| std::size_t | numConnections () const |
| Get the number of connections. | |
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 Attributes | |
| std::function< void(T)> | target_ |
| Update< T > | queued_update_ |
Additional Inherited Members | |
Public Types inherited from smgl::Port | |
| enum class | State { Idle , Waiting , Queued , Error } |
Protected Member Functions inherited from smgl::Input | |
| Input () | |
| ~Input () override | |
| virtual void | connect (Output *op) final |
| virtual void | disconnect (Output *op) final |
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::Input | |
| Output * | src_ {nullptr} |
| std::size_t | last_updated_ {0} |
Protected Attributes inherited from smgl::Port | |
| State | state_ {State::Idle} |
| Node * | parent_ {nullptr} |
Protected Attributes inherited from smgl::UniquelyIdentifiable | |
| Uuid | uuid_ {Uuid::Uuid4()} |
Typed InputPort class.
An InputPort receives values via the post() function and passes them to a target object or function. It is similar to a setter function. T should be default constructible.
| T | Type of object received by this port |
|
overridedefault |
Default destructor
|
explicit |
Construct with pointer to target object.
Definition at line 10 of file PortsImpl.hpp.
|
explicit |
Construct with std::function target.
Definition at line 15 of file PortsImpl.hpp.
|
explicit |
Construct with member function target.
Definition at line 21 of file PortsImpl.hpp.
|
delete |
Disable copy
|
delete |
Disable move
|
overridevirtual |
|
overridevirtual |
Receive a state update from a connected port.
Implements smgl::Port.
Definition at line 86 of file PortsImpl.hpp.
| void smgl::InputPort< T >::operator() | ( | const Update< T > & | u | ) |
Post an update to the port.
The target is not updated until update() has been called.
Definition at line 46 of file PortsImpl.hpp.
| void smgl::InputPort< T >::operator() | ( | T | v, |
| bool | immediate = false |
||
| ) |
Post an update to the port.
If immediate = true, the target will be updated immediately.
Definition at line 52 of file PortsImpl.hpp.
|
delete |
Disable move
|
delete |
Disable copy
|
overridevirtual |
Connect an output port to an input port.
| smgl::bad_connection | if port instances do not share underlying type T |
Reimplemented from smgl::Input.
Definition at line 65 of file PortsImpl.hpp.
| auto smgl::InputPort< T >::operator= | ( | T | v | ) |
Post an update to the port.
If immediate = true, the target will be updated immediately.
Definition at line 58 of file PortsImpl.hpp.
| void smgl::InputPort< T >::post | ( | const Update< T > & | u | ) |
Post an update to the port.
The target is not updated until update() has been called.
Definition at line 27 of file PortsImpl.hpp.
| void smgl::InputPort< T >::post | ( | T | v, |
| bool | immediate = false |
||
| ) |
Post an update to the port.
If immediate = true, the target will be updated immediately.
Definition at line 37 of file PortsImpl.hpp.
|
overridevirtual |
|
overridevirtual |
Update the target with the most recently posted update.
Implements smgl::Port.
Definition at line 73 of file PortsImpl.hpp.
|
private |
|
private |
Target object updated by std::function