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