1 /* -*- c-basic-offset: 2 -*- */
2 /*
3   Copyright(C) 2009-2018  Brazil
4   Copyright(C) 2020-2021  Sutou Kouhei <kou@clear-code.com>
5 
6   This library is free software; you can redistribute it and/or
7   modify it under the terms of the GNU Lesser General Public
8   License version 2.1 as published by the Free Software Foundation.
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 module groonga_d.vector;
20 
21 
22 private static import groonga_d.groonga;
23 
24 extern(C):
25 nothrow @nogc:
26 
27 /+
28 #include <groonga.h>
29 +/
30 
31 //GRN_API
32 uint grn_vector_size(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector);
33 
34 //GRN_API
35 groonga_d.groonga.grn_rc grn_vector_add_element(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, const (char)* str, uint str_len, uint weight, groonga_d.groonga.grn_id domain);
36 
37 //GRN_API
38 groonga_d.groonga.grn_rc grn_vector_add_element_float(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, const (char)* str, uint str_len, float weight, groonga_d.groonga.grn_id domain);
39 
40 //GRN_API
41 uint grn_vector_get_element(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, const (char)** str, uint* weight, groonga_d.groonga.grn_id* domain);
42 
43 //GRN_API
44 uint grn_vector_get_element_float(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, const (char)** str, float* weight, groonga_d.groonga.grn_id* domain);
45 
46 //GRN_API
47 bool grn_vector_get_element_bool(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, bool default_value);
48 
49 //GRN_API
50 byte grn_vector_get_element_int8(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, byte default_value);
51 
52 //GRN_API
53 ubyte grn_vector_get_element_uint8(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, ubyte default_value);
54 
55 //GRN_API
56 short grn_vector_get_element_int16(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, short default_value);
57 
58 //GRN_API
59 ushort grn_vector_get_element_uint16(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, ushort default_value);
60 
61 //GRN_API
62 int grn_vector_get_element_int32(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, int default_value);
63 
64 //GRN_API
65 uint grn_vector_get_element_uint32(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, uint default_value);
66 
67 //GRN_API
68 long grn_vector_get_element_int64(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, long default_value);
69 
70 //GRN_API
71 ulong grn_vector_get_element_uint64(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, ulong default_value);
72 
73 //GRN_API
74 float grn_vector_get_element_float32(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, float default_value);
75 
76 //GRN_API
77 double grn_vector_get_element_float64(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, uint offset, double default_value);
78 
79 //GRN_API
80 uint grn_vector_pop_element(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, const (char)** str, uint* weight, groonga_d.groonga.grn_id* domain);
81 
82 //GRN_API
83 uint grn_vector_pop_element_float(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* vector, const (char)** str, float* weight, groonga_d.groonga.grn_id* domain);
84 
85 //GRN_API
86 groonga_d.groonga.grn_rc grn_vector_copy(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* src, groonga_d.groonga.grn_obj* dest);
87 
88 //GRN_API
89 uint grn_uvector_size(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector);
90 
91 //GRN_API
92 uint grn_uvector_element_size(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector);
93 
94 //GRN_API
95 groonga_d.groonga.grn_rc grn_uvector_add_element(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector, groonga_d.groonga.grn_id id, uint weight);
96 
97 //GRN_API
98 groonga_d.groonga.grn_id grn_uvector_get_element(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector, uint offset, uint* weight);
99 
100 //GRN_API
101 groonga_d.groonga.grn_rc grn_uvector_add_element_record(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector, groonga_d.groonga.grn_id id, float weight);
102 
103 //GRN_API
104 groonga_d.groonga.grn_id grn_uvector_get_element_record(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* uvector, uint offset, float* weight);
105 
106 //GRN_API
107 groonga_d.groonga.grn_rc grn_uvector_copy(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* src, groonga_d.groonga.grn_obj* dest);