Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
sfiprimitives.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __SFI_PRIMITIVES_H__
3 #define __SFI_PRIMITIVES_H__
4 
5 #include <sfi/sfivalues.hh>
6 
7 
8 /* --- SfiBBlock primitive type --- */
9 struct _SfiBBlock {
10  guint ref_count;
11  guint n_bytes;
12  guint8 *bytes;
13 };
14 SfiBBlock* sfi_bblock_new (void);
15 SfiBBlock* sfi_bblock_new_sized (guint size);
16 SfiBBlock* sfi_bblock_ref (SfiBBlock *bblock);
17 void sfi_bblock_unref (SfiBBlock *bblock);
18 void sfi_bblock_resize (SfiBBlock *bblock,
19  guint size);
20 SfiBBlock* sfi_bblock_copy_deep (const SfiBBlock *bblock);
21 #define sfi_bblock_copy_shallow sfi_bblock_ref
22 void sfi_bblock_append (SfiBBlock *bblock,
23  guint n_bytes,
24  const guint8 *bytes);
25 void sfi_bblock_append1 (SfiBBlock *bblock,
26  guint8 byte0);
27 guint sfi_bblock_length (const SfiBBlock *bblock);
28 guint8* sfi_bblock_get (const SfiBBlock *bblock);
29 
30 
31 /* --- SfiFBlock primitive type --- */
32 struct _SfiFBlock {
33  guint ref_count;
34  guint n_values;
35  gfloat *values;
36  GFreeFunc freefunc;
37 };
38 SfiFBlock* sfi_fblock_new (void);
39 SfiFBlock* sfi_fblock_new_sized (guint size);
40 SfiFBlock* sfi_fblock_new_foreign (guint n_values,
41  gfloat *values,
42  GFreeFunc freefunc);
43 SfiFBlock* sfi_fblock_ref (SfiFBlock *fblock);
44 void sfi_fblock_unref (SfiFBlock *fblock);
45 void sfi_fblock_resize (SfiFBlock *fblock,
46  guint size);
47 SfiFBlock* sfi_fblock_copy_deep (const SfiFBlock *fblock);
48 #define sfi_fblock_copy_shallow sfi_fblock_ref
49 void sfi_fblock_append (SfiFBlock *fblock,
50  guint n_values,
51  const gfloat *values);
52 void sfi_fblock_append1 (SfiFBlock *fblock,
53  gfloat float0);
54 guint sfi_fblock_length (const SfiFBlock *fblock);
55 gfloat* sfi_fblock_get (const SfiFBlock *fblock);
56 
57 
58 /* --- SfiSeq primitive type --- */
59 struct _SfiSeq {
60  guint ref_count;
61  guint n_elements;
62  GValue *elements;
63 };
64 SfiSeq* sfi_seq_new (void);
65 SfiSeq* sfi_seq_ref (SfiSeq *seq);
66 void sfi_seq_unref (SfiSeq *seq);
67 SfiSeq* sfi_seq_copy_deep (const SfiSeq *seq);
68 #define sfi_seq_copy_shallow sfi_seq_ref
69 void sfi_seq_append (SfiSeq *seq,
70  const GValue *value);
71 GValue* sfi_seq_append_empty (SfiSeq *seq,
72  GType value_type);
73 void sfi_seq_clear (SfiSeq *seq);
74 guint sfi_seq_length (const SfiSeq *seq);
75 GValue* sfi_seq_get (const SfiSeq *seq,
76  guint index);
77 gboolean sfi_seq_check (SfiSeq *seq,
78  GType element_type);
79 gboolean sfi_seq_validate (SfiSeq *seq,
80  GParamSpec *pspec);
81 /* convenience */
82 void sfi_seq_append_bool (SfiSeq *seq,
83  SfiBool v_bool);
84 void sfi_seq_append_int (SfiSeq *seq,
85  SfiInt v_int);
86 void sfi_seq_append_num (SfiSeq *seq,
87  SfiNum v_num);
88 void sfi_seq_append_real (SfiSeq *seq,
89  SfiReal v_real);
90 void sfi_seq_append_string (SfiSeq *seq,
91  const gchar *string);
92 void sfi_seq_append_choice (SfiSeq *seq,
93  const gchar *choice);
94 void sfi_seq_append_bblock (SfiSeq *seq,
95  SfiBBlock *bblock);
96 void sfi_seq_append_fblock (SfiSeq *seq,
97  SfiFBlock *fblock);
98 void sfi_seq_append_pspec (SfiSeq *seq,
99  GParamSpec *pspec);
100 void sfi_seq_append_seq (SfiSeq *seq,
101  SfiSeq *v_seq);
102 void sfi_seq_append_rec (SfiSeq *seq,
103  SfiRec *rec);
104 void sfi_seq_append_proxy (SfiSeq *seq,
105  SfiProxy proxy);
106 SfiBool sfi_seq_get_bool (SfiSeq *seq,
107  guint index);
108 SfiInt sfi_seq_get_int (SfiSeq *seq,
109  guint index);
110 SfiNum sfi_seq_get_num (SfiSeq *seq,
111  guint index);
112 SfiReal sfi_seq_get_real (SfiSeq *seq,
113  guint index);
114 const gchar* sfi_seq_get_string (SfiSeq *seq,
115  guint index);
116 const gchar* sfi_seq_get_choice (SfiSeq *seq,
117  guint index);
118 SfiBBlock* sfi_seq_get_bblock (SfiSeq *seq,
119  guint index);
120 SfiFBlock* sfi_seq_get_fblock (SfiSeq *seq,
121  guint index);
122 GParamSpec* sfi_seq_get_pspec (SfiSeq *seq,
123  guint index);
124 SfiSeq* sfi_seq_get_seq (SfiSeq *seq,
125  guint index);
126 SfiRec* sfi_seq_get_rec (SfiSeq *seq,
127  guint index);
128 SfiProxy sfi_seq_get_proxy (SfiSeq *seq,
129  guint index);
130 /* conversion convenience */
131 gchar** sfi_seq_to_strv (SfiSeq *seq);
132 SfiSeq* sfi_seq_from_strv (gchar **strv);
133 SfiSeq* sfi_seq_from_cstrv (const gchar **strv);
134 
135 
136 /* --- SfiRec primitive type --- */
137 struct _SfiRec {
138  guint ref_count;
139  guint n_fields;
140  guint sorted : 1;
141  GValue *fields;
142  gchar **field_names;
143 };
144 SfiRec* sfi_rec_new (void);
145 SfiRec* sfi_rec_ref (SfiRec *rec);
146 void sfi_rec_unref (SfiRec *rec);
147 SfiRec* sfi_rec_copy_deep (SfiRec *rec);
148 #define sfi_rec_copy_shallow sfi_rec_ref
149 void sfi_rec_swap_fields (SfiRec *rec,
150  SfiRec *swapper);
151 gboolean sfi_rec_validate (SfiRec *rec,
152  SfiRecFields fields);
153 void sfi_rec_clear (SfiRec *rec);
154 void sfi_rec_set (SfiRec *rec,
155  const gchar *field_name,
156  const GValue *value);
157 GValue* sfi_rec_get (SfiRec *rec,
158  const gchar *field_name);
159 GValue* sfi_rec_forced_get (SfiRec *rec,
160  const gchar *field_name,
161  GType gtype);
162 guint sfi_rec_n_fields (const SfiRec *rec);
163 GValue* sfi_rec_field (const SfiRec *rec,
164  guint index);
165 gboolean sfi_rec_check (SfiRec *rec,
166  SfiRecFields rfields);
167 void sfi_rec_sort (SfiRec *rec);
168 /* convenience */
169 void sfi_rec_set_bool (SfiRec *rec,
170  const gchar *field_name,
171  SfiBool v_bool);
172 void sfi_rec_set_int (SfiRec *rec,
173  const gchar *field_name,
174  SfiInt v_int);
175 void sfi_rec_set_num (SfiRec *rec,
176  const gchar *field_name,
177  SfiNum v_num);
178 void sfi_rec_set_real (SfiRec *rec,
179  const gchar *field_name,
180  SfiReal v_real);
181 void sfi_rec_set_string (SfiRec *rec,
182  const gchar *field_name,
183  const gchar *string);
184 void sfi_rec_set_choice (SfiRec *rec,
185  const gchar *field_name,
186  const gchar *choice);
187 void sfi_rec_set_bblock (SfiRec *rec,
188  const gchar *field_name,
189  SfiBBlock *bblock);
190 void sfi_rec_set_fblock (SfiRec *rec,
191  const gchar *field_name,
192  SfiFBlock *fblock);
193 void sfi_rec_set_pspec (SfiRec *rec,
194  const gchar *field_name,
195  GParamSpec *pspec);
196 void sfi_rec_set_seq (SfiRec *rec,
197  const gchar *field_name,
198  SfiSeq *seq);
199 void sfi_rec_set_rec (SfiRec *rec,
200  const gchar *field_name,
201  SfiRec *v_rec);
202 void sfi_rec_set_proxy (SfiRec *rec,
203  const gchar *field_name,
204  SfiProxy proxy);
205 SfiBool sfi_rec_get_bool (SfiRec *rec,
206  const gchar *field_name);
207 SfiInt sfi_rec_get_int (SfiRec *rec,
208  const gchar *field_name);
209 SfiNum sfi_rec_get_num (SfiRec *rec,
210  const gchar *field_name);
211 SfiReal sfi_rec_get_real (SfiRec *rec,
212  const gchar *field_name);
213 const gchar* sfi_rec_get_string (SfiRec *rec,
214  const gchar *field_name);
215 const gchar* sfi_rec_get_choice (SfiRec *rec,
216  const gchar *field_name);
217 SfiBBlock* sfi_rec_get_bblock (SfiRec *rec,
218  const gchar *field_name);
219 SfiFBlock* sfi_rec_get_fblock (SfiRec *rec,
220  const gchar *field_name);
221 GParamSpec* sfi_rec_get_pspec (SfiRec *rec,
222  const gchar *field_name);
223 SfiSeq* sfi_rec_get_seq (SfiRec *rec,
224  const gchar *field_name);
225 SfiRec* sfi_rec_get_rec (SfiRec *rec,
226  const gchar *field_name);
227 SfiProxy sfi_rec_get_proxy (SfiRec *rec,
228  const gchar *field_name);
229 
230 #endif /* __SFI_PRIMITIVES_H__ */
231 
232 /* vim:set ts=8 sts=2 sw=2: */
Definition: sfiprimitives.hh:9
Definition: sfiprimitives.hh:32
Pointer sized integer object handle.
Definition: sfitypes.hh:29
Definition: sfiprimitives.hh:137
Definition: sfiprimitives.hh:59