| Oyranos Colour Management System API

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields
oyObserver_s Struct Reference
Objects_generic

Oyranos object observers. More...

`#include <oyObserver_s.h>`

Collaboration diagram for oyObserver_s:

## 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

## Detailed Description

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".

Note
  New templates will not be created automaticly [notemplates]

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

## Member Function Documentation

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.

Parameters

  [in] | obj | struct object
  | object | the optional object

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

References oyOBJECT_OBSERVER_S.

Referenced by oyObserver_New().

OYAPI oyObserver_s *OYEXPORT oyObserver_New | ( | oyObject_s | object | ) |

allocate a new Observer object

Function oyObserver_New

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

References oyOBJECT_OBSERVER_S, oyObserver_Copy(), oyObserver_Release(), and release.

Referenced by oyStruct_ObserverAdd().

OYAPI int OYEXPORT oyObserver_Release | ( | oyObserver_s ** | obj | ) |

release and possibly deallocate a Observer object

Function oyObserver_Release

Parameters

  [in,out] | obj | struct object

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

References model, observer, oyOBJECT_OBSERVER_S, oyStruct_s::release, and user_data.

Referenced by oyObserver_New().

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

Parameters

  [in] | observer | observer
  [in] | signal_type | basic signal information
  [in] | signal_data | advanced informations

Returns
  0 - not matching; 1 - match, skip others

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2010/04/07

References disable_ref, oyOBJECT_OBSERVER_S, oyObserverGetFlags(), and signal.

Referenced by oyStruct_ObserverSignal().

OYAPI uint32_t OYEXPORT oyObserverGetFlags | ( | void |  | ) |

get global flags for Observation

Function oyObserverGetFlags

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

Referenced by oyObserver_SignalSend(), and oyStruct_ObserverSignal().

OYAPI int OYEXPORT oyObserverSetFlags | ( | uint32_t | flags | ) |

set global flags for Observation

Function oyObserverSetFlags

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/10/26

OYAPI int OYEXPORT oyStruct_DisableSignalSend | ( | oyStruct_s * | model | ) |

disable sending a signal to all ovservers of a model

Function oyStruct_DisableSignalSend

Parameters

  [in] | model | the model

Returns
  0 - no handler found; 1 - error < 0 error or issue

Version
  Oyranos: 0.1.10

Since
  2010/04/07 (Oyranos: 0.1.10)

Date
  2010/04/07

References disable_ref, oyOBJECT_OBSERVER_S, oyOBJECT_STRUCT_LIST_S, oyOption_s::oyOption_GetStruct(), oyOptions_s::oyOptions_Find(), oyStructList_s::oyStructList_Count(), and oyStructList_s::oyStructList_GetType().

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

Parameters

  [in] | model | the model

Returns
  0 - no handler found; 1 - error < 0 error or issue

Version
  Oyranos: 0.1.10

Since
  2010/04/07 (Oyranos: 0.1.10)

Date
  2010/04/07

References disable_ref, oyNAME_NAME, oyOBJECT_OBSERVER_S, oyOBJECT_STRUCT_LIST_S, oyOption_s::oyOption_GetStruct(), oyOptions_s::oyOptions_Find(), oyStruct_s::oyStruct_GetText(), oyStructList_s::oyStructList_Count(), and oyStructList_s::oyStructList_GetType().

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.

Parameters

  model | model to ask
  observer | which observes that model

Returns
  true or false

Version
  Oyranos: 0.1.10

Date
  2009/10/28

Since
  2009/10/28 (Oyranos: 0.1.10)

References observer, oyOBJECT_OBSERVER_S, oyOBJECT_STRUCT_LIST_S, oyOption_s::oyOption_GetStruct(), oyStructList_s::oyStructList_Count(), and oyStructList_s::oyStructList_GetType().

Referenced by oyOptions_s::oyOptions_MoveIn(), oyStructList_s::oyStructList_CopyFrom(), and oyStructList_s::oyStructList_MoveIn().

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

Parameters

  [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_

Returns
  0 - fine; 1 - error

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2010/06/25

References oyStruct_s::copy, model, observer, oyOBJECT_OBSERVER_S, oyObserver_New(), oyStructList_s::oyStructList_Count(), oyStructList_s::oyStructList_GetType(), oyStructList_s::oyStructList_MoveIn(), signal, and user_data.

Referenced by oyOptions_s::oyOptions_MoveIn(), oyOptions_s::oyOptions_ObserverAdd(), oyStruct_ObserverCopyModel(), oyStruct_ObserverCopyObserver(), oyStructList_s::oyStructList_MoveIn(), and oyStructList_s::oyStructList_ObserverAdd().

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.

Parameters

  [in,out] | model | the model
  [in] | pattern | the pattern to copy from
  [in] | flags | 0x01 omit observer idendity check

Returns
  0 - good; >= 1 - error; < 0 issue

Version
  Oyranos: 0.1.10

Since
  2009/11/02 (Oyranos: 0.1.10)

Date
  2009/11/02

References model, observer, oyNAME_NAME, oyOBJECT_OBSERVER_S, oyStruct_s::oyStruct_GetText(), oyStruct_ObserverAdd(), oyStructList_s::oyStructList_Count(), oyStructList_s::oyStructList_GetType(), signal, and user_data.

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.

Parameters

  [in,out] | observer | the observer
  [in] | pattern | the pattern to copy from
  [in] | flags | 0x01 omit model idendity check

Returns
  0 - good; >= 1 - error; < 0 issue

Version
  Oyranos: 0.1.10

Since
  2009/11/02 (Oyranos: 0.1.10)

Date
  2009/11/02

References model, observer, oyNAME_NAME, oyOBJECT_OBSERVER_S, oyStruct_s::oyStruct_GetText(), oyStruct_ObserverAdd(), oyStructList_s::oyStructList_Count(), oyStructList_s::oyStructList_GetType(), signal, and user_data.

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

Parameters

  [in,out] | observer | the model
  [in] | model | the pattern
  [in] | signalFunc | the signal handler to remove

Returns
  0 - fine; 1 - error

Version
  Oyranos: 0.1.10

Since
  2009/10/26 (Oyranos: 0.1.10)

Date
  2009/11/02

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().

Parameters

  [in,out] | object | the object
  [in] | pattern | the pattern to copy from
  [in] | flags | 0x02 omit observers; 0x04 omit models

Returns
  0 - good; >= 1 - error; < 0 issue

Version
  Oyranos: 0.1.10

Since
  2009/11/02 (Oyranos: 0.1.10)

Date
  2009/11/02

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

Parameters

  [in] | model | the model
  [in] | signal_type | the basic signal type to emit
  [in,out] | signal_data | the advanced signal information

Returns
  0 - no handler found; 1 - handler found; < 0 error or issue

Version
  Oyranos: 0.1.10

Since
  2009/10/27 (Oyranos: 0.1.10)

Date
  2009/10/27

References model, observer, oyNAME_NAME, oyOBJECT_OBSERVER_S, oyOBJECT_STRUCT_LIST_S, oyObserver_SignalSend(), oyObserverGetFlags(), oyOption_s::oyOption_GetStruct(), oyOptions_s::oyOptions_Find(), oySignalToString(), oyStruct_s::oyStruct_GetText(), oyStructList_s::oyStructList_Count(), and oyStructList_s::oyStructList_GetType().

Referenced by oyFilterSocket_s::oyFilterSocket_SignalToGraph(), oyOption_s::oyOption_Clear(), oyOption_s::oyOption_SetFromData(), and oyOption_s::oyOption_SetFromDouble().

## Field Documentation

oyStruct_Copy_f oyObserver_s::copy

copy function

int oyObserver_s::disable_ref

        disable signals reference counter

== 0 -> enabled; otherwise not

Referenced by oyObserver_SignalSend(), oyStruct_DisableSignalSend(), and oyStruct_EnableSignalSend().

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_ObserverAdd(), oyStruct_ObserverCopyModel(), oyStruct_ObserverCopyObserver(), and oyStruct_ObserverSignal().

oyStruct_s* oyObserver_s::observer

a reference to the observing object

Referenced by oyObserver_Release(), oyStruct_IsObserved(), oyStruct_ObserverAdd(), oyStruct_ObserverCopyModel(), oyStruct_ObserverCopyObserver(), and oyStruct_ObserverSignal().

oyStruct_Release_f oyObserver_s::release

release function

Referenced by oyObserver_New().

oyObserver_Signal_f oyObserver_s::signal

observers signaling function

Referenced by oyObserver_SignalSend(), oyStruct_ObserverAdd(), oyStruct_ObserverCopyModel(), and oyStruct_ObserverCopyObserver().

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(), oyStruct_ObserverAdd(), oyStruct_ObserverCopyModel(), and oyStruct_ObserverCopyObserver().