oyObserver_s Struct Reference
Description: C source code API documentation for the Oyranos project.
Keywords: Oyranos,Color Management,Color Management,ICC,CMS,C,doxygen,API,documentation

| Oyranos Color Management System API - Version 0.9.6

Public Member Functions | Data Fields
oyObserver_s Struct Reference
Miscellaneous » Generic Objects

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

## ◆ oyObserver_Copy()

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.

## ◆ 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_Release()

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.

## ◆ oyObserver_SignalSend()

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

## ◆ oyObserverGetFlags()

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

## ◆ oyObserverSetFlags()

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

## ◆ oyStruct_DisableSignalSend()

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 oyStruct_s::oy_, and oyOptions_s::oyOptions_Find().

Referenced by oyOptions_s::oyOptions_ObserversDisable().

## ◆ oyStruct_EnableSignalSend()

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 oyStruct_s::oy_, and oyOptions_s::oyOptions_Find().

Referenced by oyOptions_s::oyOptions_ObserversEnable().

## ◆ oyStruct_IsObserved()

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 oyStruct_s::oy_, and oyStructList_s::oyStructList_Count().

Referenced by oyOptions_s::oyOptions_MoveIn().

## ◆ oyStruct_ObserverAdd()

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

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

## ◆ oyStruct_ObserverCopyModel()

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

## ◆ oyStruct_ObserverCopyObserver()

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

## ◆ oyStruct_ObserverRemove()

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

## ◆ oyStruct_ObserversCopy()

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

## ◆ oyStruct_ObserverSignal()

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

## Field Documentation

## ◆ copy

oyStruct_Copy_f oyObserver_s::copy

copy function

## ◆ disable_ref

int oyObserver_s::disable_ref

disable signals reference counter == 0 -> enabled; otherwise not

## ◆ dummy

oyPointer oyObserver_s::dummy

keep to zero

## ◆ model

oyStruct_s* oyObserver_s::model

a reference to the to be observed model

Referenced by oyObserver_Release().

## ◆ observer

oyStruct_s* oyObserver_s::observer

a reference to the observing object

Referenced by oyObserver_Release().

## ◆ release

oyStruct_Release_f oyObserver_s::release

release function

## ◆ signal

oyObserver_Signal_f oyObserver_s::signal

observers signaling function

## ◆ user_data

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