ObserverObjectInterface Class Reference

#include <observerobject.h>

Inheritance diagram for ObserverObjectInterface:

Detailed Description

Component to allow objects to use the observable concept. Object interfaces can define observables by writing:

MAXON_OBSERVABLE(void, ObserverDestroyed, (ObserverObjectInterface* sender), ObservableCombinerRunAllComponent);
MAXON_OBSERVABLE(void, ObserverDestroyed,(ObserverObjectInterface *sender), ObservableCombinerRunAllComponent)

A observable can be hooked up by external objects. As soon as a observable is fired all objects get this notification.

Public Member Functions

MAXON_METHOD String GetName () const
 
MAXON_METHOD void SetName (const String &name)
 
 MAXON_OBSERVABLE (void, ObserverDestroyed,(ObserverObjectInterface *sender), ObservableCombinerRunAllComponent)
 
 MAXON_OBSERVABLE (void, ObserverDisconnectNotify,(const ObserverObjectRef &owner, const Id &observerId, const ObserverObjectRef &observer), ObservableCombinerRunAllComponent)
 
 MAXON_OBSERVABLE (Result< void >, ObserverConnectNotify,(const ObserverObjectRef &owner, const Id &observableId, const ObserverObjectRef &observer), ObservableCombinerRunAllComponent)
 

Private Member Functions

 MAXON_INTERFACE (ObserverObjectInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.observerobject", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( ObserverObjectInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.observerobject"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")   
)
private

◆ GetName()

MAXON_METHOD String GetName ( ) const

Returns the name of the object.

◆ SetName()

MAXON_METHOD void SetName ( const String name)

Sets the name of the object.

Parameters
[in]nameNew name to be set.

◆ MAXON_OBSERVABLE() [1/3]

MAXON_OBSERVABLE ( void  ,
ObserverDestroyed  ,
(ObserverObjectInterface *sender)  ,
ObservableCombinerRunAllComponent   
)

observable: This observable is fired as soon as the object is destroyed. Please be aware of that it's not longer possible to create BaseRef to this object within this code! The reason is that the Destroy is called as soon as the last reference is going to 0. As soon as you would do that it would crash! -observableparam[in] sender A pointer to the destroyed object. Do not convert this pointer into a BaseRef (see comments above).

◆ MAXON_OBSERVABLE() [2/3]

MAXON_OBSERVABLE ( void  ,
ObserverDisconnectNotify  ,
(const ObserverObjectRef &owner, const Id &observerId, const ObserverObjectRef &observer)  ,
ObservableCombinerRunAllComponent   
)

Observable: This observable is fired as soon as anybody disconnects from a observable of this object. -observableparam[in] owner A reference to the object which owns the observable. -observableparam[in] observableId The name of the observable that has been disconnected. -observableparam[in] observer A reference to the connected object. This parameter can be zero.

◆ MAXON_OBSERVABLE() [3/3]

MAXON_OBSERVABLE ( Result< void >  ,
ObserverConnectNotify  ,
(const ObserverObjectRef &owner, const Id &observableId, const ObserverObjectRef &observer)  ,
ObservableCombinerRunAllComponent   
)

Observable: This observable is fired as soon as anybody connects to a observable of this object. -observableparam[in] owner A reference to the object which owns the observable. -observableparam[in] observableId The name of the observable that will be connected. -observableparam[in] observer A reference to the connected object. This parameter can be zero, e.g. if a lambda function is connected.