Branch data Line data Source code
1 : : /* 2 : : * Copyright (C) 2024 James Westman <james@jwestman.net> 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, see <https://www.gnu.org/licenses/>. 16 : : */ 17 : : 18 : : #pragma once 19 : : 20 : : #include <glib-object.h> 21 : : #include "shumate-vector-value-private.h" 22 : : #include "../shumate-vector-reader.h" 23 : : 24 : : G_BEGIN_DECLS 25 : : 26 : : typedef struct _ShumateVectorIndexDescription ShumateVectorIndexDescription; 27 : : typedef struct _ShumateVectorIndex ShumateVectorIndex; 28 : : 29 : : typedef struct { 30 : : int len; 31 : : guint32 *bits; 32 : : } ShumateVectorIndexBitset; 33 : : 34 : : ShumateVectorIndexBitset *shumate_vector_index_bitset_new (int len); 35 : : ShumateVectorIndexBitset *shumate_vector_index_bitset_copy (ShumateVectorIndexBitset *bitset); 36 : : void shumate_vector_index_bitset_free (ShumateVectorIndexBitset *bitset); 37 : : void shumate_vector_index_bitset_set (ShumateVectorIndexBitset *bitset, guint bit); 38 : : gboolean shumate_vector_index_bitset_get (ShumateVectorIndexBitset *bitset, guint bit); 39 : : void shumate_vector_index_bitset_clear (ShumateVectorIndexBitset *bitset, guint bit); 40 : : void shumate_vector_index_bitset_and (ShumateVectorIndexBitset *bitset, ShumateVectorIndexBitset *other); 41 : : void shumate_vector_index_bitset_or (ShumateVectorIndexBitset *bitset, ShumateVectorIndexBitset *other); 42 : : void shumate_vector_index_bitset_not (ShumateVectorIndexBitset *bitset); 43 : : int shumate_vector_index_bitset_next (ShumateVectorIndexBitset *bitset, int start); 44 : : 45 [ + - ]: 24 : G_DEFINE_AUTOPTR_CLEANUP_FUNC (ShumateVectorIndexBitset, shumate_vector_index_bitset_free) 46 : : 47 : : ShumateVectorIndex *shumate_vector_index_new (void); 48 : : void shumate_vector_index_free (ShumateVectorIndex *index); 49 : : gboolean shumate_vector_index_has_layer (ShumateVectorIndex *self, int layer_idx); 50 : : void shumate_vector_index_add_bitset (ShumateVectorIndex *self, 51 : : int layer_idx, 52 : : const char *field_name, 53 : : ShumateVectorValue *value, 54 : : ShumateVectorIndexBitset *bitset); 55 : : void shumate_vector_index_add_bitset_has (ShumateVectorIndex *self, 56 : : int layer_idx, 57 : : const char *field_name, 58 : : ShumateVectorIndexBitset *bitset); 59 : : void shumate_vector_index_add_bitset_broad_geometry_type (ShumateVectorIndex *self, 60 : : int layer_idx, 61 : : ShumateGeometryType type, 62 : : ShumateVectorIndexBitset *bitset); 63 : : void shumate_vector_index_add_bitset_geometry_type (ShumateVectorIndex *self, 64 : : int layer_idx, 65 : : ShumateGeometryType type, 66 : : ShumateVectorIndexBitset *bitset); 67 : : ShumateVectorIndexBitset *shumate_vector_index_get_bitset (ShumateVectorIndex *self, 68 : : int layer_idx, 69 : : const char *field_name, 70 : : ShumateVectorValue *value); 71 : : ShumateVectorIndexBitset *shumate_vector_index_get_bitset_has (ShumateVectorIndex *self, 72 : : int layer_idx, 73 : : const char *field_name); 74 : : ShumateVectorIndexBitset *shumate_vector_index_get_bitset_broad_geometry_type (ShumateVectorIndex *self, 75 : : int layer_idx, 76 : : ShumateGeometryType type); 77 : : ShumateVectorIndexBitset *shumate_vector_index_get_bitset_geometry_type (ShumateVectorIndex *self, 78 : : int layer_idx, 79 : : ShumateGeometryType type); 80 : : 81 : : ShumateVectorIndexDescription *shumate_vector_index_description_new (void); 82 : : void shumate_vector_index_description_free (ShumateVectorIndexDescription *description); 83 : : gboolean shumate_vector_index_description_has_layer (ShumateVectorIndexDescription *description, 84 : : const char *layer_name); 85 : : gboolean shumate_vector_index_description_has_field (ShumateVectorIndexDescription *description, 86 : : const char *layer_name, 87 : : const char *field_name); 88 : : gboolean shumate_vector_index_description_has_value (ShumateVectorIndexDescription *description, 89 : : const char *layer_name, 90 : : const char *field_name, 91 : : ShumateVectorValue *value); 92 : : gboolean shumate_vector_index_description_has_field_has_index (ShumateVectorIndexDescription *description, 93 : : const char *layer_name, 94 : : const char *field_name); 95 : : gboolean shumate_vector_index_description_has_broad_geometry_type (ShumateVectorIndexDescription *description, 96 : : const char *layer_name); 97 : : gboolean shumate_vector_index_description_has_geometry_type (ShumateVectorIndexDescription *description, 98 : : const char *layer_name); 99 : : void shumate_vector_index_description_add (ShumateVectorIndexDescription *desc, 100 : : const char *layer, 101 : : const char *field, 102 : : ShumateVectorValue *value); 103 : : void shumate_vector_index_description_add_has_index (ShumateVectorIndexDescription *desc, 104 : : const char *layer, 105 : : const char *field); 106 : : void shumate_vector_index_description_add_broad_geometry_type (ShumateVectorIndexDescription *desc, 107 : : const char *layer); 108 : : void shumate_vector_index_description_add_geometry_type (ShumateVectorIndexDescription *desc, 109 : : const char *layer); 110 : : G_END_DECLS