/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/GlobalNotify.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:
20
20
THE SOFTWARE.
21
21
*/
22
22
 
 
23
#ifndef __H_GLOBAL_NOTIFY__
 
24
#define __H_GLOBAL_NOTIFY__
 
25
 
 
26
#include "defs.h"
 
27
#include "Func.h"
 
28
 
 
29
BEGIN_DECLS
 
30
 
23
31
/** @file
 
32
 * @defgroup GlobalNotify GlobalNotify
 
33
 * @addtogroup GlobalNotify
 
34
 * @{
 
35
 *
24
36
 * SSTS provides a system for global notifications. Global notifications are
25
37
 * like signals, but have global scope, IE: there is only one GlobalNotify
26
38
 * object that can exist in the system at any point.
27
39
 *
28
40
 * It in not possible to directly access the GlobalNotify object, and it's
29
 
 * structiral stability can not be guaranteed.
 
41
 * structural stability can not be guaranteed.
30
42
 *
31
43
 * SSTS does not initialise the the GlobalNotify object until one of it's
32
 
 * function
 
44
 * function are run.
 
45
 *
 
46
 * @sa 
33
47
 */
34
48
 
35
 
#ifndef __H_GLOBAL_NOTIFY__
36
 
#define __H_GLOBAL_NOTIFY__
37
 
 
38
 
#include "defs.h"
39
 
#include "Func.h"
40
 
 
41
 
BEGIN_DECLS
42
49
 
43
50
/**
44
51
 * An opaque object.
45
52
 * It is not possible to access the data inside this object.
46
53
 */
47
 
typedef struct _GlobalNotify GlobalNotify;
 
54
typedef struct GlobalNotify GlobalNotify;
48
55
 
49
56
/**
50
57
 * Notify all subscribers of the to the 
51
58
 */
52
 
void s_global_notify (char * name, spointer * user_data);
53
 
 
54
 
 
55
 
void s_global_notiy_add (char * name, );
56
 
 
57
 
 
58
 
void s_global_notify_subscribe (char * name, Callback)
 
59
void s_global_notify (char * name, spointer user_data);
 
60
 
 
61
/**
 
62
 * Add a new global notification.
 
63
 *
 
64
 * @param name The name of the notification.
 
65
 *
 
66
 * @return The unique handle of the notification on success.
 
67
 * @return <0 on fail.
 
68
 *
 
69
 * @note
 
70
 * You can safely dismiss the handle for the notify.
 
71
 */
 
72
int s_global_notify_add (char * name);
 
73
 
 
74
/**
 
75
 * A convenience method to check if a notify name is already taken.
 
76
 * 
 
77
 * @param name The notify name to get the handle from.
 
78
 *
 
79
 * @return <0 on fail.
 
80
 * @return The numerical handle of the notify.
 
81
 */
 
82
int s_global_notify_get_handle (char * name);
 
83
 
 
84
/**
 
85
 * Substribe to a notify using a callback.
 
86
 *
 
87
 * @param name The name of the notify to subscribe to.
 
88
 * @param callback The callback to be triggered when a notify is sent.
 
89
 *
 
90
 * @return The unique subscription handle, this is what is used in
 
91
 *         s_global_notify_unsubscribe() to unsubscribe to a notify.
 
92
 *
 
93
 * @note
 
94
 * A notify Callback has to have the following signature:
 
95
 * <code> void my_callback (char * name, spointer user_data) </code>
 
96
 */
 
97
int s_global_notify_subscribe (char * name, Callback callback);
 
98
 
 
99
/** @} */
59
100
 
60
101
END_DECLS
61
102
#endif