Debian Codegraph @

lib/bulk.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2020-2022 Sutou Kouhei <[email protected]>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include "grn_bulk.h"
20
21 #include <groonga/bulk.hpp>
22
23 extern "C" {
24 int64_t
25 grn_bulk_get_int64(grn_ctx *ctx, grn_obj *bulk)
26 {
27 return grn::bulk::get<int64_t>(ctx, bulk, 0);
28 }
29
30 grn_rc
31 grn_bulk_set_int64(grn_ctx *ctx, grn_obj *bulk, int64_t value)
32 {
33 return grn::bulk::set<int64_t>(ctx, bulk, value);
34 }
35
36 double
37 grn_bulk_get_float(grn_ctx *ctx, grn_obj *bulk)
38 {
39 return grn::bulk::get<double>(ctx, bulk, 0);
40 }
41
42 grn_rc
43 grn_bulk_set_float(grn_ctx *ctx, grn_obj *bulk, double value)
44 {
45 return grn::bulk::set<double>(ctx, bulk, value);
46 }
47
48 grn_rc
49 grn_bulk_copy(grn_ctx *ctx, grn_obj *bulk, grn_obj *dest)
50 {
51 unsigned char flags = 0;
52 switch (bulk->header.type) {
53 case GRN_PVECTOR :
54 case GRN_UVECTOR :
55 case GRN_VECTOR :
56 flags += GRN_OBJ_VECTOR;
57 break;
58 default :
59 break;
60 }
61 grn_obj_reinit(ctx,
62 dest,
63 bulk->header.domain,
64 flags);
65 return grn_obj_cast(ctx, bulk, dest, false);
66 }
67 }