Debian Codegraph @

include/groonga/obj.h

raw symbols SCIP
1 /*
2 Copyright (C) 2015-2018 Brazil
3 Copyright (C) 2018-2026 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #pragma once
21
22 #include <groonga/option.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /* Just for backward compatibility. Use grn_obj_is_true() instead. */
29 #define GRN_OBJ_IS_TRUE(ctx, obj, result) \
30 do { \
31 result = grn_obj_is_true(ctx, obj); \
32 } while (0)
33
34 GRN_API bool
35 grn_obj_is_true(grn_ctx *ctx, grn_obj *obj);
36
37 GRN_API bool
38 grn_obj_is_temporary(grn_ctx *ctx, grn_obj *obj);
39
40 /**
41 * \brief Check whether a Groonga built-in object is or not.
42 *
43 * \param ctx The context object.
44 * \param obj The target object to check.
45 *
46 * \return `true` if the object is a built-in Groonga object, `false` otherwise.
47 */
48 GRN_API bool
49 grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj);
50 GRN_API bool
51 grn_obj_is_bulk(grn_ctx *ctx, grn_obj *obj);
52 GRN_API bool
53 grn_obj_is_text_family_bulk(grn_ctx *ctx, grn_obj *obj);
54 GRN_API bool
55 grn_obj_is_binary_family_bulk(grn_ctx *ctx, grn_obj *obj);
56 GRN_API bool
57 grn_obj_is_number_family_bulk(grn_ctx *ctx, grn_obj *obj);
58 GRN_API bool
59 grn_obj_maybe_record_bulk(grn_ctx *ctx, grn_obj *obj);
60 GRN_API bool
61 grn_obj_is_vector(grn_ctx *ctx, grn_obj *obj);
62 GRN_API bool
63 grn_obj_is_text_family_vector(grn_ctx *ctx, grn_obj *obj);
64 GRN_API bool
65 grn_obj_is_binary_family_vector(grn_ctx *ctx, grn_obj *obj);
66 GRN_API bool
67 grn_obj_is_number_family_vector(grn_ctx *ctx, grn_obj *obj);
68 GRN_API bool
69 grn_obj_is_weight_vector(grn_ctx *ctx, grn_obj *obj);
70 GRN_API bool
71 grn_obj_is_uvector(grn_ctx *ctx, grn_obj *obj);
72 GRN_API bool
73 grn_obj_is_weight_uvector(grn_ctx *ctx, grn_obj *obj);
74 GRN_API bool
75 grn_obj_is_db(grn_ctx *ctx, grn_obj *obj);
76 GRN_API bool
77 grn_obj_is_table(grn_ctx *ctx, grn_obj *obj);
78 GRN_API bool
79 grn_obj_is_table_with_key(grn_ctx *ctx, grn_obj *obj);
80 GRN_API bool
81 grn_obj_is_table_with_value(grn_ctx *ctx, grn_obj *obj);
82 GRN_API bool
83 grn_obj_is_lexicon(grn_ctx *ctx, grn_obj *obj);
84 GRN_API bool
85 grn_obj_is_lexicon_without_data_column(grn_ctx *ctx, grn_obj *obj);
86 GRN_API bool
87 grn_obj_is_tiny_hash_table(grn_ctx *ctx, grn_obj *obj);
88 GRN_API bool
89 grn_obj_is_patricia_trie(grn_ctx *ctx, grn_obj *obj);
90 GRN_API bool
91 grn_obj_is_result_set(grn_ctx *ctx, grn_obj *obj);
92 GRN_API bool
93 grn_obj_is_column(grn_ctx *ctx, grn_obj *obj);
94 GRN_API bool
95 grn_obj_is_number_family_column(grn_ctx *ctx, grn_obj *obj);
96 GRN_API bool
97 grn_obj_is_scalar_column(grn_ctx *ctx, grn_obj *obj);
98 GRN_API bool
99 grn_obj_is_text_family_scalar_column(grn_ctx *ctx, grn_obj *obj);
100 GRN_API bool
101 grn_obj_is_binary_family_scalar_column(grn_ctx *ctx, grn_obj *obj);
102 GRN_API bool
103 grn_obj_is_number_family_scalar_column(grn_ctx *ctx, grn_obj *obj);
104 /**
105 * \brief Check whether the specified object is a vector column or not.
106 *
107 * \param ctx The context object.
108 * \param obj The target object to check.
109 *
110 * \return `true` if the object is a vector column, `false` otherwise.
111 */
112 GRN_API bool
113 grn_obj_is_vector_column(grn_ctx *ctx, grn_obj *obj);
114 GRN_API bool
115 grn_obj_is_text_family_vector_column(grn_ctx *ctx, grn_obj *obj);
116 GRN_API bool
117 grn_obj_is_binary_family_vector_column(grn_ctx *ctx, grn_obj *obj);
118 GRN_API bool
119 grn_obj_is_weight_vector_column(grn_ctx *ctx, grn_obj *obj);
120 GRN_API bool
121 grn_obj_is_reference_column(grn_ctx *ctx, grn_obj *obj);
122 GRN_API bool
123 grn_obj_is_data_column(grn_ctx *ctx, grn_obj *obj);
124 GRN_API bool
125 grn_obj_is_index_column(grn_ctx *ctx, grn_obj *obj);
126 GRN_API bool
127 grn_obj_is_accessor(grn_ctx *ctx, grn_obj *obj);
128 GRN_API bool
129 grn_obj_is_id_accessor(grn_ctx *ctx, grn_obj *obj);
130 GRN_API bool
131 grn_obj_is_key_accessor(grn_ctx *ctx, grn_obj *obj);
132 GRN_API bool
133 grn_obj_is_value_accessor(grn_ctx *ctx, grn_obj *obj);
134 GRN_API bool
135 grn_obj_is_score_accessor(grn_ctx *ctx, grn_obj *obj);
136 GRN_API bool
137 grn_obj_is_referable_score_accessor(grn_ctx *ctx, grn_obj *obj);
138 GRN_API bool
139 grn_obj_is_nsubrecs_accessor(grn_ctx *ctx, grn_obj *obj);
140 GRN_API bool
141 grn_obj_is_max_accessor(grn_ctx *ctx, grn_obj *obj);
142 GRN_API bool
143 grn_obj_is_min_accessor(grn_ctx *ctx, grn_obj *obj);
144 GRN_API bool
145 grn_obj_is_sum_accessor(grn_ctx *ctx, grn_obj *obj);
146 GRN_API bool
147 grn_obj_is_avg_accessor(grn_ctx *ctx, grn_obj *obj);
148 GRN_API bool
149 grn_obj_is_mean_accessor(grn_ctx *ctx, grn_obj *obj);
150 GRN_API bool
151 grn_obj_is_column_value_accessor(grn_ctx *ctx, grn_obj *obj);
152 GRN_API bool
153 grn_obj_is_scalar_accessor(grn_ctx *ctx, grn_obj *obj);
154 /**
155 * \brief Check whether a text family scalar accessor or not.
156 *
157 * \param ctx The context object.
158 * \param obj The target object to check.
159 *
160 * \return `true` if the object is an accessor of \ref
161 * GRN_DB_SHORT_TEXT range table or \ref GRN_DB_SHORT_TEXT /
162 * \ref GRN_DB_TEXT / \ref GRN_DB_LONG_TEXT scalar column,
163 * `false` otherwise.
164 */
165 GRN_API bool
166 grn_obj_is_text_family_scalar_accessor(grn_ctx *ctx, grn_obj *obj);
167 GRN_API bool
168 grn_obj_is_binary_family_scalar_accessor(grn_ctx *ctx, grn_obj *obj);
169 GRN_API bool
170 grn_obj_is_number_family_scalar_accessor(grn_ctx *ctx, grn_obj *obj);
171 GRN_API bool
172 grn_obj_is_vector_accessor(grn_ctx *ctx, grn_obj *obj);
173 GRN_API bool
174 grn_obj_is_type(grn_ctx *ctx, grn_obj *obj);
175 GRN_API bool
176 grn_obj_is_text_family_type(grn_ctx *ctx, grn_obj *obj);
177 GRN_API bool
178 grn_obj_is_binary_family_type(grn_ctx *ctx, grn_obj *obj);
179 GRN_API bool
180 grn_obj_is_proc(grn_ctx *ctx, grn_obj *obj);
181 GRN_API bool
182 grn_obj_is_tokenizer_proc(grn_ctx *ctx, grn_obj *obj);
183 GRN_API bool
184 grn_obj_is_command_proc(grn_ctx *ctx, grn_obj *obj);
185 GRN_API bool
186 grn_obj_is_function_proc(grn_ctx *ctx, grn_obj *obj);
187 GRN_API bool
188 grn_obj_is_selector_proc(grn_ctx *ctx, grn_obj *obj);
189 GRN_API bool
190 grn_obj_is_selector_only_proc(grn_ctx *ctx, grn_obj *obj);
191 GRN_API bool
192 grn_obj_is_applier_proc(grn_ctx *ctx, grn_obj *obj);
193 /**
194 * \brief Return whether `obj` is a function that has a sorter callback
195 * or not.
196 *
197 * \param ctx The context object.
198 * \param obj The target object.
199 *
200 * \return `true` if `obj` is a function that has a sorter callback,
201 * `false` otherwise.
202 *
203 * Since: 15.1.8
204 */
205 GRN_API bool
206 grn_obj_is_sorter_proc(grn_ctx *ctx, grn_obj *obj);
207 GRN_API bool
208 grn_obj_is_normalizer_proc(grn_ctx *ctx, grn_obj *obj);
209 GRN_API bool
210 grn_obj_is_token_filter_proc(grn_ctx *ctx, grn_obj *obj);
211 /**
212 * \brief Return whether `obj` is a function that has a extractor
213 * callback or not.
214 *
215 * \param ctx The context object.
216 * \param obj The target object.
217 *
218 * \return `true` if `obj` is a function that has a extractor
219 * callback, `false` otherwise.
220 *
221 * Since: 16.0.1
222 */
223 GRN_API bool
224 grn_obj_is_extractor_proc(grn_ctx *ctx, grn_obj *obj);
225 GRN_API bool
226 grn_obj_is_scorer_proc(grn_ctx *ctx, grn_obj *obj);
227 GRN_API bool
228 grn_obj_is_window_function_proc(grn_ctx *ctx, grn_obj *obj);
229 GRN_API bool
230 grn_obj_is_aggregator_proc(grn_ctx *ctx, grn_obj *obj);
231 GRN_API bool
232 grn_obj_is_expr(grn_ctx *ctx, grn_obj *obj);
233 GRN_API bool
234 grn_obj_is_visible(grn_ctx *ctx, grn_obj *obj);
235 GRN_API grn_rc
236 grn_obj_set_visibility(grn_ctx *ctx, grn_obj *obj, bool is_visible);
237 GRN_API bool
238 grn_obj_have_source(grn_ctx *ctx, grn_obj *obj);
239 GRN_API bool
240 grn_obj_is_token_column(grn_ctx *ctx, grn_obj *obj);
241 GRN_API bool
242 grn_obj_is_generated_column(grn_ctx *ctx, grn_obj *obj);
243
244 GRN_API grn_rc
245 grn_obj_reindex(grn_ctx *ctx, grn_obj *obj);
246
247 GRN_API void
248 grn_obj_touch(grn_ctx *ctx, grn_obj *obj, grn_timeval *tv);
249 GRN_API uint32_t
250 grn_obj_get_last_modified(grn_ctx *ctx, grn_obj *obj);
251 GRN_API bool
252 grn_obj_is_dirty(grn_ctx *ctx, grn_obj *obj);
253
254 GRN_API const char *
255 grn_obj_set_flag_to_string(int flags);
256
257 GRN_API const char *
258 grn_obj_type_to_string(uint8_t type);
259 GRN_API bool
260 grn_obj_type_is_table(uint8_t type);
261 GRN_API bool
262 grn_obj_type_is_column(uint8_t type);
263
264 GRN_API bool
265 grn_obj_name_is_column(grn_ctx *ctx, const char *name, int name_len);
266
267 bool
268 grn_obj_is_empty(grn_ctx *ctx, grn_obj *obj, grn_id id);
269
270 GRN_API bool
271 grn_obj_is_corrupt(grn_ctx *ctx, grn_obj *obj);
272 GRN_API size_t
273 grn_obj_get_disk_usage(grn_ctx *ctx, grn_obj *obj);
274
275 GRN_API grn_rc
276 grn_obj_set_option_values(grn_ctx *ctx,
277 grn_obj *obj,
278 const char *name,
279 int name_length,
280 grn_obj *values);
281 GRN_API grn_option_revision
282 grn_obj_get_option_values(grn_ctx *ctx,
283 grn_obj *obj,
284 const char *name,
285 int name_length,
286 grn_option_revision revision,
287 grn_obj *values);
288 GRN_API grn_rc
289 grn_obj_clear_option_values(grn_ctx *ctx, grn_obj *obj);
290
291 GRN_API grn_rc
292 grn_obj_to_script_syntax(grn_ctx *ctx, grn_obj *obj, grn_obj *buffer);
293
294 GRN_API grn_rc
295 grn_obj_warm(grn_ctx *ctx, grn_obj *obj);
296
297 #ifdef __cplusplus
298 }
299 #endif