/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
24 by Gustav Hartvigsson
* added skeleton of global noify.
1
/*
2
Copyright (c) 2013-2014 Gustav Hartvigsson
3
4
Permission is hereby granted, free of charge, to any person obtaining a copy
5
of this software and associated documentation files (the "Software"), to deal
6
in the Software without restriction, including without limitation the rights
7
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
copies of the Software, and to permit persons to whom the Software is
9
furnished to do so, subject to the following conditions:
10
11
The above copyright notice and this permission notice shall be included in
12
all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
THE SOFTWARE.
21
*/
22
126.1.1 by Gustav Hartvigsson
* Using
23
#pragma once
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
24
25
#include "defs.h"
26
#include "Func.h"
27
110 by Gustav Hartvigsson
* added S_ prifix to my macros. I should not be a scrub.
28
S_BEGIN_DECLS
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
29
24 by Gustav Hartvigsson
* added skeleton of global noify.
30
/** @file
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
31
 * @defgroup SGlobalNotify SGlobalNotify
32
 * @addtogroup SGlobalNotify
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
33
 * @{
34
 *
24 by Gustav Hartvigsson
* added skeleton of global noify.
35
 * SSTS provides a system for global notifications. Global notifications are
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
36
 * like signals, but have global scope, IE: there is only one SGlobalNotify
24 by Gustav Hartvigsson
* added skeleton of global noify.
37
 * object that can exist in the system at any point.
38
 *
39
 * It in not possible to directly access the GlobalNotify object, and it's
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
40
 * structural stability can not be guaranteed.
24 by Gustav Hartvigsson
* added skeleton of global noify.
41
 *
42
 * SSTS does not initialise the the GlobalNotify object until one of it's
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
43
 * function are run.
44
 *
45
 * @sa 
24 by Gustav Hartvigsson
* added skeleton of global noify.
46
 */
47
48
49
/**
50
 * An opaque object.
51
 * It is not possible to access the data inside this object.
52
 */
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
53
typedef struct SGlobalNotify SGlobalNotify;
24 by Gustav Hartvigsson
* added skeleton of global noify.
54
55
/**
56
 * Notify all subscribers of the to the 
57
 */
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
58
S_EXPORTED
61 by Gustav Hartvigsson
* Made the code more easy to read.
59
void
162 by Gustav Hartvigsson
* stuff to do with the unfinished base32 implementation.
60
s_global_notify (schar * name,
61
                 spointer user_data);
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
62
63
/**
64
 * Add a new global notification.
65
 *
66
 * @param name The name of the notification.
67
 *
68
 * @return The unique handle of the notification on success.
69
 * @return <0 on fail.
70
 *
71
 * @note
72
 * You can safely dismiss the handle for the notify.
73
 */
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
74
S_EXPORTED
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
75
sint
76
s_global_notify_add (schar * name);
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
77
78
/**
79
 * A convenience method to check if a notify name is already taken.
80
 * 
81
 * @param name The notify name to get the handle from.
82
 *
83
 * @return <0 on fail.
84
 * @return The numerical handle of the notify.
85
 */
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
86
S_EXPORTED
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
87
sint
88
s_global_notify_get_handle (schar * name);
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
89
90
/**
91
 * Substribe to a notify using a callback.
92
 *
93
 * @param name The name of the notify to subscribe to.
94
 * @param callback The callback to be triggered when a notify is sent.
95
 *
96
 * @return The unique subscription handle, this is what is used in
97
 *         s_global_notify_unsubscribe() to unsubscribe to a notify.
98
 *
99
 * @note
100
 * A notify Callback has to have the following signature:
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
101
 * <tt> void my_callback (char * name, spointer user_data) </tt>
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
102
 */
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
103
S_EXPORTED
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
104
sint
162 by Gustav Hartvigsson
* stuff to do with the unfinished base32 implementation.
105
s_global_notify_subscribe (schar * name,
106
                           Callback callback);
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
107
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
108
/**
109
 * Unsubscribe to a notify.
110
 * 
111
 * @param name The name of the notify to unsubscribe to.
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
112
 * @param subscription_id The ID of the subscription.
113
 *
114
 * @returns TRUE on success
115
 * @returns FALSE on fail
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
116
 */
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
117
S_EXPORTED
61 by Gustav Hartvigsson
* Made the code more easy to read.
118
sboolean
162 by Gustav Hartvigsson
* stuff to do with the unfinished base32 implementation.
119
s_global_notify_unsubscribe (schar * name,
120
                             sint subscription_id);
146 by Gustav Hartvigsson
* Reorderd includes in SimpleTypeSystem.h
121
122
/**
123
 * Teardown down the global notification system.
124
 *
125
 * This should not be called directly, use s_teardown() to instead.
126
 */
127
S_HIDDEN
128
void
129
s_global_notify_teardown ();
130
131
132
S_END_DECLS
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
133
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
134
/** @} */
24 by Gustav Hartvigsson
* added skeleton of global noify.
135