/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/Callback.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-09 18:45:12 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150409184512-fn8m3f26mzsqdy4n
* Started to structuce the dectumentation a little better.
* Added Callback.[c,h] which will contain the methods to add callbacks to SObjects.
  This is still a work it pregross.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __H_CALLBACK__
 
2
#define __H_CALLBACK__
 
3
 
 
4
#include "baseobject.h"
 
5
#include "defs.h"
 
6
#include "Func.h"
 
7
 
 
8
BEGIN_DECLS
 
9
 
 
10
/**
 
11
 * @file
 
12
 * @defgroup SCallback SCallback
 
13
 * @addtogroup SCallback
 
14
 * @{
 
15
 * Callbacks are used to signals one part of the a program to an other.
 
16
 * It is manly used in SObject s and its children.
 
17
 * 
 
18
 * @sa GlobalNotify
 
19
 */
 
20
 
 
21
/**
 
22
 * An SCallbackEntry is used for convinience when installing callbacks into
 
23
 * SObjects. It may also be used in 
 
24
 */
 
25
typedef struct SCallbackEntry SCallbackEntry;
 
26
 
 
27
/**
 
28
 * The types for callbacks.
 
29
 */
 
30
typedef enum {
 
31
  S_CALLBACK_NULL,
 
32
  S_CALLBACK_CALLBACK,
 
33
  S_CALLBACK_NOTIFY,
 
34
  S_CALLBACK_NOTIFY_CHANGE
 
35
} SCallbackType;
 
36
 
 
37
/**
 
38
 * A list containing the names of the callback types.
 
39
 */
 
40
static char * SCallbackTypeNames[] __attribute__((unused)) = {
 
41
  "NULL",
 
42
  "CALLBACK",
 
43
  "NOTIFY",
 
44
  "NOTIFY_CHANGE",
 
45
  0x0,
 
46
  0x0,
 
47
};
 
48
 
 
49
 
 
50
struct SCallbackEntry {
 
51
  char * name; /**< The name that is used to invoke the callback. */
 
52
  SCallbackType type; /**< The type of the callback, is it a standard callback
 
53
                       * or a notify? */
 
54
  Callback callback; /**< The callback that will be invoked.*/
 
55
};
 
56
 
 
57
 
 
58
 
 
59
/**
 
60
 * @}
 
61
 * @addtogroup SObject
 
62
 * @{
 
63
 */
 
64
 
 
65
/**
 
66
 * Installs an array of callcackentries into an SObject.
 
67
 * 
 
68
 * @param obj The object to install the callback entries into.
 
69
 * @param callbackentries an array containing the callback entries.
 
70
 */
 
71
void s_object_install_callbacks (SObject * obj, SCallbackEntry ** callcackentries);
 
72
 
 
73
/**
 
74
 * Installs a singel callback into an SObject.
 
75
 *
 
76
 * @param obj The object to install the callback into.
 
77
 * @param callbackentry The callback entry to install.
 
78
 */
 
79
void s_object_install_callback (SObject * obj, SCallbackEntry * callbackentry);
 
80
 
 
81
/**@}*/
 
82
 
 
83
END_DECLS
 
84
 
 
85
#endif