Kanzi  3.9.4
Kanzi Engine API
kanzi::AbstractBindingRuntime Class Referenceabstract

Base class for binding runtimes. More...

#include <kanzi/core.ui/binding/abstract_binding_runtime.hpp>

Inheritance diagram for kanzi::AbstractBindingRuntime:
[legend]

Public Types

enum  AttachmentState {
  Detached, Detaching, Attaching, Attached,
  Removed
}
 Attachment state for keeping track current status. More...
 

Public Member Functions

void attach ()
 Attach the binding. More...
 
void detach ()
 Detaches the binding. More...
 
void detachIfAttachedOrAttaching ()
 Detaches the binding if it is attaching or attached. More...
 
AbstractBindingSharedPtr getBinding () const
 Returns the binding associated with this binding runtime. More...
 
shared_ptr< void > getOwner () const
 Gets the owner. More...
 
BindingSourceRuntimegetSourceRuntime () const
 Gets the source runtime. More...
 
BindingTargetRuntimegetTargetRuntime () const
 Gets the target runtime. More...
 
bool isAttached () const
 Indicates whether this binding runtime has been attached. More...
 
bool isAttaching () const
 Indicates whether this binding runtime is being attached. More...
 
bool isConnected ()
 Indicates whether this binding runtime is connected. More...
 
bool isDetached () const
 Indicates whether this binding runtime is detached. More...
 
bool isDetaching () const
 Indicates whether this binding runtime is being detached. More...
 
bool isRemoved () const
 Gets whether the binding runtime has been removed from the binding host. More...
 
void notifySourceChanged ()
 Called when binding source has changed. More...
 
void notifyTargetChanged ()
 Called when binding target has changed. More...
 
void onRemoved ()
 Called when binding is being removed from where it has been installed. More...
 
void removeFromHost ()
 Removes the binding runtime from the binding host. More...
 
void setHost (BindingHostConceptSharedPtr hostObject)
 Sets the binding host object in which the binding runtime is hosted. More...
 
void setOwner (shared_ptr< void > owner)
 Set the owner. More...
 
bool update ()
 Execute the binding. More...
 
virtual ~AbstractBindingRuntime ()
 Destructor. More...
 

Protected Member Functions

 AbstractBindingRuntime (AbstractBindingSharedPtr binding, BindingSourceRuntimePtr sourceRuntime, BindingTargetRuntimePtr targetRuntime)
 Constructor. More...
 
virtual void attachOverride ()=0
 Binding-dependent attach. More...
 
virtual void detachOverride ()=0
 Binding-dependent detach. More...
 
virtual bool isConnectedOverride ()
 Binding-dependent attached indication. More...
 
virtual void notifySourceChangedOverride ()
 Binding-dependent source change. More...
 
virtual void notifyTargetChangedOverride ()
 Binding-dependent target change. More...
 
bool readFromSource (Variant &value)
 Read from source and execute forward validators. More...
 
bool readFromTarget (Variant &value)
 Reads from target and executes reverse validators. More...
 
virtual bool updateOverride ()=0
 Binding-dependent update. More...
 
bool writeToSource (const Variant &value) const
 Writes to source. More...
 
bool writeToTarget (const Variant &value)
 Write to target. More...
 

Protected Attributes

AttachmentState m_attachmentState
 Current binding runtime state. More...
 
AbstractBindingSharedPtr m_binding
 Associated binding. More...
 
BindingHostConceptWeakPtr m_bindingHost
 The binding host object in which the binding runtime is hosted. More...
 
weak_ptr< void > m_owner
 Owner for tagging the runtime. More...
 
BindingSourceRuntimePtr m_sourceRuntime
 Runtime for source. More...
 
BindingTargetRuntimePtr m_targetRuntime
 Runtime for target. More...
 

Detailed Description

Base class for binding runtimes.

Bindings create abstract binding runtimes to serve as the runtime data of the bindings. Binding runtimes refer to their source bindings, but do not alter them.

Distinct binding implementations create objects of classes inheriting the base AbstractBindingRuntime.

When you remove a binding runtime from a binding host, Kanzi detaches the binding and makes the binding runtime unusable.

See also
AbstractBinding
Since
Kanzi 3.7.0

Member Enumeration Documentation

◆ AttachmentState

Attachment state for keeping track current status.

Enumerator
Detached 

Detached.

Detaching 

Detaching.

Set after detach is called, but not yet completed.

Attaching 

Attaching.

Set after attach is called, but not yet completed.

Attached 

Attached.

Removed 

Removed.

Constructor & Destructor Documentation

◆ ~AbstractBindingRuntime()

virtual kanzi::AbstractBindingRuntime::~AbstractBindingRuntime ( )
virtual

Destructor.

◆ AbstractBindingRuntime()

kanzi::AbstractBindingRuntime::AbstractBindingRuntime ( AbstractBindingSharedPtr  binding,
BindingSourceRuntimePtr  sourceRuntime,
BindingTargetRuntimePtr  targetRuntime 
)
explicitprotected

Constructor.

Abstract binding runtime takes ownership of both source and target runtimes.

Parameters
bindingHost binding to keep a reference to.
sourceRuntimeSource runtime.
targetRuntimeTarget runtime.

Member Function Documentation

◆ attach()

void kanzi::AbstractBindingRuntime::attach ( )

Attach the binding.

Attaches source and target.

◆ detach()

void kanzi::AbstractBindingRuntime::detach ( )

Detaches the binding.

Detaches all sources and target

◆ detachIfAttachedOrAttaching()

void kanzi::AbstractBindingRuntime::detachIfAttachedOrAttaching ( )

Detaches the binding if it is attaching or attached.

◆ onRemoved()

void kanzi::AbstractBindingRuntime::onRemoved ( )

Called when binding is being removed from where it has been installed.

Automatically called on binding target runtime destruction, but also called manually when binding is being removed from a Node or RenderPass to remove potential installed value sources.

◆ notifySourceChanged()

void kanzi::AbstractBindingRuntime::notifySourceChanged ( )

Called when binding source has changed.

Usually called by binding sources that notify the binding runtime of the change.

◆ notifyTargetChanged()

void kanzi::AbstractBindingRuntime::notifyTargetChanged ( )

Called when binding target has changed.

This should not be called for most bindings, as they only work in one direction.

◆ update()

bool kanzi::AbstractBindingRuntime::update ( )

Execute the binding.

Performs read from the source and write to the target.

Returns
True if both read and write succeeded.

◆ getOwner()

shared_ptr<void> kanzi::AbstractBindingRuntime::getOwner ( ) const
inline

Gets the owner.

Returns
Shared pointer to the owner.

◆ setOwner()

void kanzi::AbstractBindingRuntime::setOwner ( shared_ptr< void >  owner)
inline

Set the owner.

Parameters
ownerShared pointer to owner.

◆ getBinding()

AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::getBinding ( ) const
inline

Returns the binding associated with this binding runtime.

Returns
Shared pointer to binding.

◆ isAttached()

bool kanzi::AbstractBindingRuntime::isAttached ( ) const
inline

Indicates whether this binding runtime has been attached.

Returns
True if attached, false otherwise.

◆ isAttaching()

bool kanzi::AbstractBindingRuntime::isAttaching ( ) const
inline

Indicates whether this binding runtime is being attached.

Returns
True if attaching, false otherwise.

◆ isDetached()

bool kanzi::AbstractBindingRuntime::isDetached ( ) const
inline

Indicates whether this binding runtime is detached.

Returns
True if detached, false otherwise.

◆ isDetaching()

bool kanzi::AbstractBindingRuntime::isDetaching ( ) const
inline

Indicates whether this binding runtime is being detached.

Returns
True if detaching, false otherwise.

◆ isConnected()

bool kanzi::AbstractBindingRuntime::isConnected ( )
inline

Indicates whether this binding runtime is connected.

Attaching a binding causes it to be potentially connected.

Returns
True if connected, false if not connected.

◆ getSourceRuntime()

BindingSourceRuntime* kanzi::AbstractBindingRuntime::getSourceRuntime ( ) const
inline

Gets the source runtime.

Returns
Pointer to source runtime.

◆ getTargetRuntime()

BindingTargetRuntime* kanzi::AbstractBindingRuntime::getTargetRuntime ( ) const
inline

Gets the target runtime.

Returns
Pointer to target runtime.

◆ setHost()

void kanzi::AbstractBindingRuntime::setHost ( BindingHostConceptSharedPtr  hostObject)

Sets the binding host object in which the binding runtime is hosted.

Parameters
hostObjectThe binding host object in which the binding runtime is hosted.
Since
Kanzi 3.9.0

◆ removeFromHost()

void kanzi::AbstractBindingRuntime::removeFromHost ( )

Removes the binding runtime from the binding host.

When you remove a binding from a host, Kanzi detaches the binding runtime and makes the binding runtime unusable.

Since
Kanzi 3.9.0

◆ isRemoved()

bool kanzi::AbstractBindingRuntime::isRemoved ( ) const

Gets whether the binding runtime has been removed from the binding host.

Returns
If the binding runtime has been removed from the binding host, true, otherwise false.
Since
Kanzi 3.9.0

◆ attachOverride()

virtual void kanzi::AbstractBindingRuntime::attachOverride ( )
protectedpure virtual

◆ detachOverride()

virtual void kanzi::AbstractBindingRuntime::detachOverride ( )
protectedpure virtual

◆ readFromSource()

bool kanzi::AbstractBindingRuntime::readFromSource ( Variant value)
protected

Read from source and execute forward validators.

Parameters
valueValue to read to.
Returns
True if read and validators succeeded.

◆ readFromTarget()

bool kanzi::AbstractBindingRuntime::readFromTarget ( Variant value)
protected

Reads from target and executes reverse validators.

Parameters
valueValue to read to.
Returns
True if read and validators succeeded.

◆ writeToTarget()

bool kanzi::AbstractBindingRuntime::writeToTarget ( const Variant value)
protected

Write to target.

Parameters
valueValue to write.
Returns
True if write and validators succeeded.

◆ writeToSource()

bool kanzi::AbstractBindingRuntime::writeToSource ( const Variant value) const
protected

Writes to source.

Parameters
valueValue to write.
Returns
True if write succeeded.

◆ notifySourceChangedOverride()

virtual void kanzi::AbstractBindingRuntime::notifySourceChangedOverride ( )
protectedvirtual

Binding-dependent source change.

Default implementation simply calls update() on the forward direction.

Reimplemented in kanzi::ToSourceBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ExpressionBindingRuntime.

◆ notifyTargetChangedOverride()

virtual void kanzi::AbstractBindingRuntime::notifyTargetChangedOverride ( )
protectedvirtual

Binding-dependent target change.

Default implementation of throws an exception.

Reimplemented in kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.

◆ updateOverride()

virtual bool kanzi::AbstractBindingRuntime::updateOverride ( )
protectedpure virtual

Binding-dependent update.

Returns
True if both read and write succeeded.

Implemented in kanzi::ToSourceBindingRuntime, kanzi::ManualBindingRuntime, kanzi::ExpressionBindingRuntime, and kanzi::BindingBaseRuntime.

◆ isConnectedOverride()

virtual bool kanzi::AbstractBindingRuntime::isConnectedOverride ( )
protectedvirtual

Binding-dependent attached indication.

Default implementation checks source and target.

Returns
True if both source and target are connected, false otherwise.

Reimplemented in kanzi::ToSourceBindingRuntime.

Member Data Documentation

◆ m_binding

AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::m_binding
protected

Associated binding.

◆ m_sourceRuntime

BindingSourceRuntimePtr kanzi::AbstractBindingRuntime::m_sourceRuntime
protected

Runtime for source.

◆ m_targetRuntime

BindingTargetRuntimePtr kanzi::AbstractBindingRuntime::m_targetRuntime
protected

Runtime for target.

◆ m_attachmentState

AttachmentState kanzi::AbstractBindingRuntime::m_attachmentState
protected

Current binding runtime state.

A binding runtime may be attached even if it is not connected. Attach is only called once.

◆ m_owner

weak_ptr<void> kanzi::AbstractBindingRuntime::m_owner
protected

Owner for tagging the runtime.

◆ m_bindingHost

BindingHostConceptWeakPtr kanzi::AbstractBindingRuntime::m_bindingHost
protected

The binding host object in which the binding runtime is hosted.


The documentation for this class was generated from the following file: