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 |
||
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
23 |
#ifndef __H_GLOBAL_NOTIFY__
|
24 |
#define __H_GLOBAL_NOTIFY__
|
|
25 |
||
26 |
#include "defs.h" |
|
27 |
#include "Func.h" |
|
28 |
||
29 |
BEGIN_DECLS
|
|
30 |
||
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
31 |
/** @file
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
32 |
* @defgroup GlobalNotify GlobalNotify
|
33 |
* @addtogroup GlobalNotify
|
|
34 |
* @{
|
|
35 |
*
|
|
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
36 |
* SSTS provides a system for global notifications. Global notifications are
|
37 |
* like signals, but have global scope, IE: there is only one GlobalNotify
|
|
38 |
* object that can exist in the system at any point.
|
|
39 |
*
|
|
40 |
* 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. |
41 |
* structural stability can not be guaranteed.
|
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
42 |
*
|
43 |
* 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. |
44 |
* function are run.
|
45 |
*
|
|
46 |
* @sa
|
|
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
47 |
*/
|
48 |
||
49 |
||
50 |
/**
|
|
51 |
* An opaque object.
|
|
52 |
* It is not possible to access the data inside this object.
|
|
53 |
*/
|
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
54 |
typedef struct GlobalNotify GlobalNotify; |
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
55 |
|
56 |
/**
|
|
57 |
* Notify all subscribers of the to the
|
|
58 |
*/
|
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
59 |
void
|
60 |
s_global_notify (char * name, spointer user_data); |
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
61 |
|
62 |
/**
|
|
63 |
* Add a new global notification.
|
|
64 |
*
|
|
65 |
* @param name The name of the notification.
|
|
66 |
*
|
|
67 |
* @return The unique handle of the notification on success.
|
|
68 |
* @return <0 on fail.
|
|
69 |
*
|
|
70 |
* @note
|
|
71 |
* You can safely dismiss the handle for the notify.
|
|
72 |
*/
|
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
73 |
int
|
74 |
s_global_notify_add (char * name); |
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
75 |
|
76 |
/**
|
|
77 |
* A convenience method to check if a notify name is already taken.
|
|
78 |
*
|
|
79 |
* @param name The notify name to get the handle from.
|
|
80 |
*
|
|
81 |
* @return <0 on fail.
|
|
82 |
* @return The numerical handle of the notify.
|
|
83 |
*/
|
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
84 |
int
|
85 |
s_global_notify_get_handle (char * name); |
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
86 |
|
87 |
/**
|
|
88 |
* Substribe to a notify using a callback.
|
|
89 |
*
|
|
90 |
* @param name The name of the notify to subscribe to.
|
|
91 |
* @param callback The callback to be triggered when a notify is sent.
|
|
92 |
*
|
|
93 |
* @return The unique subscription handle, this is what is used in
|
|
94 |
* s_global_notify_unsubscribe() to unsubscribe to a notify.
|
|
95 |
*
|
|
96 |
* @note
|
|
97 |
* A notify Callback has to have the following signature:
|
|
|
47
by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h |
98 |
* <tt> void my_callback (char * name, spointer user_data) </tt>
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
99 |
*/
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
100 |
int
|
101 |
s_global_notify_subscribe (char * name, Callback callback); |
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
102 |
|
|
47
by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h |
103 |
/**
|
104 |
* Unsubscribe to a notify.
|
|
105 |
*
|
|
106 |
* @param name The name of the notify to unsubscribe to.
|
|
107 |
* @param subscription_id The ID of the subscription.
|
|
108 |
*/
|
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
109 |
sboolean
|
110 |
s_global_notify_unsubscribe (char * name, int subscription_id); |
|
|
47
by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h |
111 |
|
|
44
by Gustav Hartvigsson
* Started to structuce the dectumentation a little better. |
112 |
/** @} */
|
|
24
by Gustav Hartvigsson
* added skeleton of global noify. |
113 |
|
114 |
END_DECLS
|
|
|
32
by Gustav Hartvigsson
* Added some compile options to the root CMakeLists.txt |
115 |
#endif
|