| 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"cxx . . $ `<file>/lib/grn_bulk.h`/ |
| 20 | |
| 21 | #include <groonga/bulk.hpp>cxx . . $ `<file>/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 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::getcxx . . $ grn/bulk/get(fc0e5dd5d2409f65).<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 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<int64_t>(ctx, bulk, value); |
| 34 | } |
| 35 | |
| 36 | double |
| 37 | grn_bulk_get_float(grn_ctx *ctx, grn_obj *bulk) |
| 38 | { |
| 39 | return grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::getcxx . . $ grn/bulk/get(fc0e5dd5d2409f65).<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 grncxx . . $ grn/::bulkcxx . . $ grn/bulk/::setcxx . . $ grn/bulk/set(ca8f724eff6ab81).<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->headercxx . . $ _grn_obj#header..type) { |
| 53 | case GRN_PVECTORcxx . . $ `include/groonga/groonga.h:876:9`! : |
| 54 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 55 | case GRN_VECTORcxx . . $ `include/groonga/groonga.h:877:9`! : |
| 56 | flags += GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!; |
| 57 | break; |
| 58 | default : |
| 59 | break; |
| 60 | } |
| 61 | grn_obj_reinit(ctx, |
| 62 | dest, |
| 63 | bulk->headercxx . . $ _grn_obj#header..domain, |
| 64 | flags); |
| 65 | return grn_obj_cast(ctx, bulk, dest, false); |
| 66 | } |
| 67 | } |