/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef __H_CALLBACK__
#define __H_CALLBACK__

#include "baseobject.h"
#include "defs.h"
#include "Func.h"

BEGIN_DECLS

/**
 * @file
 * @defgroup SCallback SCallback
 * @addtogroup SCallback
 * @{
 * Callbacks are used to signals one part of the a program to an other.
 * It is manly used in SObject s and its children.
 *
 * Please note that this is the best way to implement an "interface".
 *
 * @sa GlobalNotify
 */

/**
 * An SCallbackEntry is used for convinience when installing callbacks into
 * SObjects. It may also be used in 
 */
typedef struct SCallbackEntry SCallbackEntry;

/**
 * The types for callbacks.
 */
typedef enum {
  S_CALLBACK_NULL,
  S_CALLBACK_CALLBACK,
  S_CALLBACK_NOTIFY,
  S_CALLBACK_NOTIFY_CHANGE
} SCallbackType;

/**
 * A list containing the names of the callback types.
 */
static char * SCallbackTypeNames[] __attribute__((unused)) = {
  "NULL",
  "CALLBACK",
  "NOTIFY",
  "NOTIFY_CHANGE",
  0x0,
  0x0,
};


struct SCallbackEntry {
  char * name; /**< The name that is used to invoke the callback. */
  SCallbackType type; /**< The type of the callback, is it a standard callback
                       * or a notify? */
  Callback callback; /**< The callback that will be invoked.*/
};



/**
 * @}
 * @addtogroup SObject
 * @{
 */

/**
 * Installs an array of callcackentries into an SObject.
 * 
 * @param obj The object to install the callback entries into.
 * @param callbackentries an array containing the callback entries.
 */
void s_object_install_callbacks (SObject * obj, SCallbackEntry ** callcackentries);

/**
 * Installs a singel callback into an SObject.
 *
 * @param obj The object to install the callback into.
 * @param callbackentry The callback entry to install.
 */
void s_object_install_callback (SObject * obj, SCallbackEntry * callbackentry);

/**
 * 
 */
spointer s_object_notify (SObject * self, char * name, spointer * data);

/**
 * Alias to s_object_notify()
 */
#define s_object_call(o, n, d) s_object_notify (o, n, d)

/**@}*/

END_DECLS

#endif