Kanzi  3.9.5
Kanzi Engine API
kanzi::ResourceReference< TResourceType > Class Template Reference

#include <kanzi/core.ui/node/resource_reference.hpp>

Inheritance diagram for kanzi::ResourceReference< TResourceType >:
[legend]

Public Types

typedef function< void()> CallbackType
 
typedef shared_ptr< TResourceType > ResourceTypePtr
 

Public Member Functions

void attachOverride () override
 Attaches the resource reference. More...
 
void detachOverride () override
 Detaches the resource reference. More...
 
ResourceTypePtr get () const
 
ResourceSharedPtr getResource () override
 
ResourceTypePtr makeLocal ()
 Clone reference to be an internal copy. More...
 
void onResourceChangeOverride () override
 This method is called when the resource referenced by the existing property type is changed. More...
 
 operator bool_type () const
 
TResourceType & operator* () const
 
TResourceType * operator-> () const
 
 ResourceReference (Node &thisObject, AbstractPropertyType propertyType)
 
void setCallback (CallbackType callback)
 
 ~ResourceReference () override
 
- Public Member Functions inherited from kanzi::AbstractResourceReference
bool isAttached () const
 Indicates whether this resource reference has been attached. More...
 

Protected Member Functions

void notifyCallback ()
 
ResourceTypePtrresolve ()
 
const ResourceTypePtrresolve () const
 
void updateChangeFlags () const
 
void updateResolveNotify (bool onDetach)
 
void updateResource ()
 
- Protected Member Functions inherited from kanzi::AbstractResourceReference
virtual ~AbstractResourceReference ()=default
 Destructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from kanzi::AbstractResourceReference
bool m_attached
 Current resource reference state. Note that attach() is only called once. More...
 

Member Typedef Documentation

◆ CallbackType

template<typename TResourceType >
typedef function<void()> kanzi::ResourceReference< TResourceType >::CallbackType

◆ ResourceTypePtr

template<typename TResourceType >
typedef shared_ptr<TResourceType> kanzi::ResourceReference< TResourceType >::ResourceTypePtr

Constructor & Destructor Documentation

◆ ResourceReference()

template<typename TResourceType >
kanzi::ResourceReference< TResourceType >::ResourceReference ( Node thisObject,
AbstractPropertyType  propertyType 
)
explicit

◆ ~ResourceReference()

template<typename TResourceType >
kanzi::ResourceReference< TResourceType >::~ResourceReference ( )
override

Member Function Documentation

◆ operator bool_type()

template<typename TResourceType >
kanzi::ResourceReference< TResourceType >::operator bool_type ( ) const
inline

◆ attachOverride()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::attachOverride ( )
inlineoverridevirtual

Attaches the resource reference.

Acquires the resource referenced by the property type.

Note: The attach() is only called once.

Implements kanzi::AbstractResourceReference.

◆ onResourceChangeOverride()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::onResourceChangeOverride ( )
inlineoverridevirtual

This method is called when the resource referenced by the existing property type is changed.

Acquires the new resource and executes the callback only if the the new resource is not the same as before.

Note: This method is only called on attached resource references.

Implements kanzi::AbstractResourceReference.

◆ detachOverride()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::detachOverride ( )
inlineoverridevirtual

Detaches the resource reference.

Resets the referenced resource.

Note: The detach() is only called once.

Implements kanzi::AbstractResourceReference.

◆ getResource()

template<typename TResourceType >
ResourceSharedPtr kanzi::ResourceReference< TResourceType >::getResource ( )
inlineoverridevirtual

◆ makeLocal()

template<typename TResourceType >
ResourceTypePtr kanzi::ResourceReference< TResourceType >::makeLocal ( )
inline

Clone reference to be an internal copy.

Default implementation clones nothing, and returns an empty shared pointer.

◆ setCallback()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::setCallback ( CallbackType  callback)
inline

◆ get()

template<typename TResourceType >
ResourceTypePtr kanzi::ResourceReference< TResourceType >::get ( ) const
inline

◆ operator->()

template<typename TResourceType >
TResourceType* kanzi::ResourceReference< TResourceType >::operator-> ( ) const
inline

◆ operator*()

template<typename TResourceType >
TResourceType& kanzi::ResourceReference< TResourceType >::operator* ( ) const
inline

◆ resolve() [1/2]

template<typename TResourceType >
ResourceTypePtr& kanzi::ResourceReference< TResourceType >::resolve ( )
inlineprotected

◆ resolve() [2/2]

template<typename TResourceType >
const ResourceTypePtr& kanzi::ResourceReference< TResourceType >::resolve ( ) const
inlineprotected

◆ updateResource()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::updateResource ( )
protected

◆ updateChangeFlags()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::updateChangeFlags ( ) const
protected

◆ notifyCallback()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::notifyCallback ( )
inlineprotected

◆ updateResolveNotify()

template<typename TResourceType >
void kanzi::ResourceReference< TResourceType >::updateResolveNotify ( bool  onDetach)
inlineprotected

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