![]() |
Oyranos Color Management System API |
Oyranos object observers. More...
#include <oyObserver_s.h>
Public Member Functions | |
OYAPI oyObserver_s *OYEXPORT | oyObserver_New (oyObject_s object) |
allocate a new Observer object More... | |
OYAPI oyObserver_s *OYEXPORT | oyObserver_Copy (oyObserver_s *obj, oyObject_s object) |
copy a Observer object More... | |
OYAPI int OYEXPORT | oyObserver_Release (oyObserver_s **obj) |
release and possibly deallocate a Observer object More... | |
OYAPI int OYEXPORT | oyObserver_SignalSend (oyObserver_s *observer, oySIGNAL_e signal_type, oyStruct_s *signal_data) |
send a signal to a Observer object More... | |
OYAPI int OYEXPORT | oyStruct_ObserverAdd (oyStruct_s *model, oyStruct_s *observer, oyStruct_s *user_data, oyObserver_Signal_f signalFunc) |
send a signal to a Observer object More... | |
OYAPI int OYEXPORT | oyStruct_ObserverRemove (oyStruct_s *model, oyStruct_s *observer, oyObserver_Signal_f signalFunc) |
disconnect a observer from a object More... | |
OYAPI int OYEXPORT | oyStruct_ObserverSignal (oyStruct_s *model, oySIGNAL_e signal_type, oyStruct_s *signal_data) |
send a signal to all ovservers of a model More... | |
OYAPI int OYEXPORT | oyStruct_DisableSignalSend (oyStruct_s *model) |
disable sending a signal to all ovservers of a model More... | |
OYAPI int OYEXPORT | oyStruct_EnableSignalSend (oyStruct_s *model) |
reenable sending a signal to all ovservers of a model More... | |
OYAPI int OYEXPORT | oyStruct_ObserversCopy (oyStruct_s *object, oyStruct_s *pattern, uint32_t flags) |
copy a objects observers and models to a different object More... | |
OYAPI int OYEXPORT | oyStruct_ObserverCopyModel (oyStruct_s *model, oyStruct_s *pattern, uint32_t flags) |
copy a models observers to a different model More... | |
OYAPI int OYEXPORT | oyStruct_ObserverCopyObserver (oyStruct_s *observer, oyStruct_s *pattern, uint32_t flags) |
copy a observers models to a different observer More... | |
OYAPI int OYEXPORT | oyStruct_IsObserved (oyStruct_s *model, oyStruct_s *observer) |
return object observation status More... | |
OYAPI uint32_t OYEXPORT | oyObserverGetFlags (void) |
get global flags for Observation More... | |
OYAPI int OYEXPORT | oyObserverSetFlags (uint32_t flags) |
set global flags for Observation More... | |
Data Fields | |
oyStruct_Copy_f | copy |
oyStruct_Release_f | release |
oyPointer | dummy |
oyStruct_s * | observer |
oyStruct_s * | model |
oyStruct_s * | user_data |
oyObserver_Signal_f | signal |
int | disable_ref |
Oyranos object observers.
oyObserver_s is following the viewer/model design pattern. The relations of oyObserver_s' can be anything up to complicated cyclic, directed graphs. The oyObserver_s type is intented for communication to non graph objects. Oyranos graphs have several communication paths available, which should be prefered over oyObserver_s when possible.
The struct contains properties to signal changes to a observer. The signaling provides a small set of very generic signals types as enumeration. It is possible for models to add additional data to the signal. These additional data is only blindly transported. A agreement is not subject of the oyObserver_s structure. For completeness the observed object shall always be included in the signal.
This class is a public members only class and does not belong to the oyranos object model, like all "Generic Objects".
OYAPI oyObserver_s *OYEXPORT oyObserver_Copy | ( | oyObserver_s * | obj, |
oyObject_s | object | ||
) |
copy a Observer object
Function oyObserver_Copy
A reference is not possible as no reference counter is available.
[in] | obj | struct object |
object | the optional object |
References oyOBJECT_OBSERVER_S.
OYAPI oyObserver_s *OYEXPORT oyObserver_New | ( | oyObject_s | object | ) |
allocate a new Observer object
Function oyObserver_New
References oyOBJECT_OBSERVER_S.
OYAPI int OYEXPORT oyObserver_Release | ( | oyObserver_s ** | obj | ) |
release and possibly deallocate a Observer object
Function oyObserver_Release
[in,out] | obj | struct object |
References model, observer, oyOBJECT_OBSERVER_S, oyStruct_s::release, and user_data.
OYAPI int OYEXPORT oyObserver_SignalSend | ( | oyObserver_s * | observer, |
oySIGNAL_e | signal_type, | ||
oyStruct_s * | signal_data | ||
) |
send a signal to a Observer object
Function oyObserver_SignalSend
[in] | observer | observer |
[in] | signal_type | basic signal information |
[in] | signal_data | advanced informations |
References oyOBJECT_OBSERVER_S.
OYAPI uint32_t OYEXPORT oyObserverGetFlags | ( | void | ) |
get global flags for Observation
Function oyObserverGetFlags
OYAPI int OYEXPORT oyObserverSetFlags | ( | uint32_t | flags | ) |
set global flags for Observation
Function oyObserverSetFlags
OYAPI int OYEXPORT oyStruct_DisableSignalSend | ( | oyStruct_s * | model | ) |
disable sending a signal to all ovservers of a model
Function oyStruct_DisableSignalSend
[in] | model | the model |
References oyStruct_s::oy_, and oyOptions_s::oyOptions_Find().
Referenced by oyOptions_s::oyOptions_ObserversDisable().
OYAPI int OYEXPORT oyStruct_EnableSignalSend | ( | oyStruct_s * | model | ) |
reenable sending a signal to all ovservers of a model
Function oyStruct_EnableSignalSend
[in] | model | the model |
References oyStruct_s::oy_, and oyOptions_s::oyOptions_Find().
Referenced by oyOptions_s::oyOptions_ObserversEnable().
OYAPI int OYEXPORT oyStruct_IsObserved | ( | oyStruct_s * | model, |
oyStruct_s * | observer | ||
) |
return object observation status
Function oyStruct_IsObserved
Check if a object is observed by others.
model | model to ask |
observer | which observes that model |
References oyStruct_s::oy_, and oyStructList_s::oyStructList_Count().
Referenced by oyOptions_s::oyOptions_MoveIn(), and oyStructList_s::oyStructList_CopyFrom().
OYAPI int OYEXPORT oyStruct_ObserverAdd | ( | oyStruct_s * | model, |
oyStruct_s * | observer, | ||
oyStruct_s * | user_data, | ||
oyObserver_Signal_f | signalFunc | ||
) |
send a signal to a Observer object
Function oyStruct_ObserverAdd
[in] | model | the to be observed model |
[in] | observer | the in observation intereressted object |
[in] | user_data | additional static informations |
[in] | signalFunc | the signal handler; defaults to oyStructSignalForward_ |
Referenced by oyOptions_s::oyOptions_MoveIn().
OYAPI int OYEXPORT oyStruct_ObserverCopyModel | ( | oyStruct_s * | model, |
oyStruct_s * | pattern, | ||
uint32_t | flags | ||
) |
copy a models observers to a different model
Function oyStruct_ObserverCopyModel
The observers are copied from pattern with object type to a model with the same object type.
[in,out] | model | the model |
[in] | pattern | the pattern to copy from |
[in] | flags | 0x01 omit observer idendity check |
Referenced by oyStruct_ObserversCopy().
OYAPI int OYEXPORT oyStruct_ObserverCopyObserver | ( | oyStruct_s * | observer, |
oyStruct_s * | pattern, | ||
uint32_t | flags | ||
) |
copy a observers models to a different observer
Function oyStruct_ObserverCopyObserver
The models are copied from pattern with object type to a object with the same object type.
[in,out] | observer | the observer |
[in] | pattern | the pattern to copy from |
[in] | flags | 0x01 omit model idendity check |
Referenced by oyStruct_ObserversCopy().
OYAPI int OYEXPORT oyStruct_ObserverRemove | ( | oyStruct_s * | model, |
oyStruct_s * | observer, | ||
oyObserver_Signal_f | signalFunc | ||
) |
disconnect a observer from a object
Function oyStruct_ObserverRemove
[in,out] | observer | the model |
[in] | model | the pattern |
[in] | signalFunc | the signal handler to remove |
OYAPI int OYEXPORT oyStruct_ObserversCopy | ( | oyStruct_s * | object, |
oyStruct_s * | pattern, | ||
uint32_t | flags | ||
) |
copy a objects observers and models to a different object
Function oyStruct_ObserversCopy
oyStruct_ObserversCopy is a convenience function for oyStruct_ObserverCopyModel() and oyStruct_ObserverCopyObserver().
[in,out] | object | the object |
[in] | pattern | the pattern to copy from |
[in] | flags | 0x02 omit observers; 0x04 omit models |
References oyStruct_ObserverCopyModel(), and oyStruct_ObserverCopyObserver().
OYAPI int OYEXPORT oyStruct_ObserverSignal | ( | oyStruct_s * | model, |
oySIGNAL_e | signal_type, | ||
oyStruct_s * | signal_data | ||
) |
send a signal to all ovservers of a model
Function oyStruct_ObserverSignal
[in] | model | the model |
[in] | signal_type | the basic signal type to emit |
[in,out] | signal_data | the advanced signal information |
Referenced by oyOption_s::oyOption_Clear().
oyStruct_Copy_f oyObserver_s::copy |
copy function
int oyObserver_s::disable_ref |
disable signals reference counter == 0 -> enabled; otherwise not
oyPointer oyObserver_s::dummy |
keep to zero
oyStruct_s* oyObserver_s::model |
a reference to the to be observed model
Referenced by oyObserver_Release().
oyStruct_s* oyObserver_s::observer |
a reference to the observing object
Referenced by oyObserver_Release().
oyStruct_Release_f oyObserver_s::release |
release function
oyObserver_Signal_f oyObserver_s::signal |
observers signaling function
oyStruct_s* oyObserver_s::user_data |
optional data; If no other user data is available this data will be passed with the signal.
Referenced by oyObserver_Release().