Kanzi  3.9.7
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...
 
BindingLookupContextgetLookupContext () const
 Gets the lookup context. 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, BindingLookupContextPtr lookupContext, 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...
 
BindingLookupContextPtr m_lookupContext
 
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

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

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

Destructor.

kanzi::AbstractBindingRuntime::AbstractBindingRuntime ( AbstractBindingSharedPtr  binding,
BindingLookupContextPtr  lookupContext,
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.
lookupContextLookup context.
sourceRuntimeSource runtime.
targetRuntimeTarget runtime.
Since
Kanzi 3.9.6 Added BindingLookupContextPtr.

Member Function Documentation

void kanzi::AbstractBindingRuntime::attach ( )

Attach the binding.

Attaches source and target.

void kanzi::AbstractBindingRuntime::detach ( )

Detaches the binding.

Detaches all sources and target

void kanzi::AbstractBindingRuntime::detachIfAttachedOrAttaching ( )

Detaches the binding if it is attaching or attached.

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.

void kanzi::AbstractBindingRuntime::notifySourceChanged ( )

Called when binding source has changed.

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

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.

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.
shared_ptr<void> kanzi::AbstractBindingRuntime::getOwner ( ) const
inline

Gets the owner.

Returns
Shared pointer to the owner.
void kanzi::AbstractBindingRuntime::setOwner ( shared_ptr< void >  owner)
inline

Set the owner.

Parameters
ownerShared pointer to owner.
AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::getBinding ( ) const
inline

Returns the binding associated with this binding runtime.

Returns
Shared pointer to binding.
bool kanzi::AbstractBindingRuntime::isAttached ( ) const
inline

Indicates whether this binding runtime has been attached.

Returns
True if attached, false otherwise.
bool kanzi::AbstractBindingRuntime::isAttaching ( ) const
inline

Indicates whether this binding runtime is being attached.

Returns
True if attaching, false otherwise.
bool kanzi::AbstractBindingRuntime::isDetached ( ) const
inline

Indicates whether this binding runtime is detached.

Returns
True if detached, false otherwise.
bool kanzi::AbstractBindingRuntime::isDetaching ( ) const
inline

Indicates whether this binding runtime is being detached.

Returns
True if detaching, false otherwise.
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.
BindingSourceRuntime* kanzi::AbstractBindingRuntime::getSourceRuntime ( ) const
inline

Gets the source runtime.

Returns
Pointer to source runtime.
BindingTargetRuntime* kanzi::AbstractBindingRuntime::getTargetRuntime ( ) const
inline

Gets the target runtime.

Returns
Pointer to target runtime.
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
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
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
BindingLookupContext& kanzi::AbstractBindingRuntime::getLookupContext ( ) const
inline

Gets the lookup context.

Returns
lookup context
virtual void kanzi::AbstractBindingRuntime::attachOverride ( )
protectedpure virtual
virtual void kanzi::AbstractBindingRuntime::detachOverride ( )
protectedpure virtual
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.
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.
bool kanzi::AbstractBindingRuntime::writeToTarget ( const Variant value)
protected

Write to target.

Parameters
valueValue to write.
Returns
True if write and validators succeeded.
bool kanzi::AbstractBindingRuntime::writeToSource ( const Variant value) const
protected

Writes to source.

Parameters
valueValue to write.
Returns
True if write succeeded.
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.

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

Binding-dependent target change.

Default implementation of throws an exception.

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

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.

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

AbstractBindingSharedPtr kanzi::AbstractBindingRuntime::m_binding
protected

Associated binding.

BindingLookupContextPtr kanzi::AbstractBindingRuntime::m_lookupContext
protected
BindingSourceRuntimePtr kanzi::AbstractBindingRuntime::m_sourceRuntime
protected

Runtime for source.

BindingTargetRuntimePtr kanzi::AbstractBindingRuntime::m_targetRuntime
protected

Runtime for target.

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.

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

Owner for tagging the runtime.

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: