1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 #pragma once 21 22 #include <arrow-glib/decimal128.h> 23 #include <arrow-glib/type.h> 24 #include <arrow-glib/version.h> 25 26 G_BEGIN_DECLS 27 28 #define GARROW_TYPE_DATA_TYPE (garrow_data_type_get_type()) 29 G_DECLARE_DERIVABLE_TYPE(GArrowDataType, 30 garrow_data_type, 31 GARROW, 32 DATA_TYPE, 33 GObject) 34 struct _GArrowDataTypeClass 35 { 36 GObjectClass parent_class; 37 }; 38 39 gboolean garrow_data_type_equal (GArrowDataType *data_type, 40 GArrowDataType *other_data_type); 41 gchar *garrow_data_type_to_string (GArrowDataType *data_type); 42 GArrowType garrow_data_type_get_id (GArrowDataType *data_type); 43 44 45 #define GARROW_TYPE_FIXED_WIDTH_DATA_TYPE (garrow_fixed_width_data_type_get_type()) 46 G_DECLARE_DERIVABLE_TYPE(GArrowFixedWidthDataType, 47 garrow_fixed_width_data_type, 48 GARROW, 49 FIXED_WIDTH_DATA_TYPE, 50 GArrowDataType) 51 struct _GArrowFixedWidthDataTypeClass 52 { 53 GArrowDataTypeClass parent_class; 54 }; 55 56 gint garrow_fixed_width_data_type_get_bit_width(GArrowFixedWidthDataType *data_type); 57 /* TODO: 58 GList *garrow_fixed_width_data_type_get_buffer_layout(GArrowFixedWidthDataType *data_type); 59 */ 60 61 62 #define GARROW_TYPE_NULL_DATA_TYPE \ 63 (garrow_null_data_type_get_type()) 64 G_DECLARE_DERIVABLE_TYPE(GArrowNullDataType, 65 garrow_null_data_type, 66 GARROW, 67 NULL_DATA_TYPE, 68 GArrowDataType) 69 struct _GArrowNullDataTypeClass 70 { 71 GArrowDataTypeClass parent_class; 72 }; 73 74 GArrowNullDataType *garrow_null_data_type_new (void); 75 76 77 #define GARROW_TYPE_BOOLEAN_DATA_TYPE (garrow_boolean_data_type_get_type()) 78 G_DECLARE_DERIVABLE_TYPE(GArrowBooleanDataType, 79 garrow_boolean_data_type, 80 GARROW, 81 BOOLEAN_DATA_TYPE, 82 GArrowFixedWidthDataType) 83 struct _GArrowBooleanDataTypeClass 84 { 85 GArrowFixedWidthDataTypeClass parent_class; 86 }; 87 88 GArrowBooleanDataType *garrow_boolean_data_type_new (void); 89 90 91 #define GARROW_TYPE_NUMERIC_DATA_TYPE (garrow_numeric_data_type_get_type()) 92 G_DECLARE_DERIVABLE_TYPE(GArrowNumericDataType, 93 garrow_numeric_data_type, 94 GARROW, 95 NUMERIC_DATA_TYPE, 96 GArrowFixedWidthDataType) 97 struct _GArrowNumericDataTypeClass 98 { 99 GArrowFixedWidthDataTypeClass parent_class; 100 }; 101 102 103 #define GARROW_TYPE_INTEGER_DATA_TYPE (garrow_integer_data_type_get_type()) 104 G_DECLARE_DERIVABLE_TYPE(GArrowIntegerDataType, 105 garrow_integer_data_type, 106 GARROW, 107 INTEGER_DATA_TYPE, 108 GArrowNumericDataType) 109 struct _GArrowIntegerDataTypeClass 110 { 111 GArrowNumericDataTypeClass parent_class; 112 }; 113 114 GARROW_AVAILABLE_IN_0_16 115 gboolean garrow_integer_data_type_is_signed(GArrowIntegerDataType *data_type); 116 117 #define GARROW_TYPE_INT8_DATA_TYPE (garrow_int8_data_type_get_type()) 118 G_DECLARE_DERIVABLE_TYPE(GArrowInt8DataType, 119 garrow_int8_data_type, 120 GARROW, 121 INT8_DATA_TYPE, 122 GArrowIntegerDataType) 123 struct _GArrowInt8DataTypeClass 124 { 125 GArrowIntegerDataTypeClass parent_class; 126 }; 127 128 GArrowInt8DataType *garrow_int8_data_type_new (void); 129 130 131 #define GARROW_TYPE_UINT8_DATA_TYPE (garrow_uint8_data_type_get_type()) 132 G_DECLARE_DERIVABLE_TYPE(GArrowUInt8DataType, 133 garrow_uint8_data_type, 134 GARROW, 135 UINT8_DATA_TYPE, 136 GArrowIntegerDataType) 137 struct _GArrowUInt8DataTypeClass 138 { 139 GArrowIntegerDataTypeClass parent_class; 140 }; 141 142 GArrowUInt8DataType *garrow_uint8_data_type_new (void); 143 144 145 #define GARROW_TYPE_INT16_DATA_TYPE (garrow_int16_data_type_get_type()) 146 G_DECLARE_DERIVABLE_TYPE(GArrowInt16DataType, 147 garrow_int16_data_type, 148 GARROW, 149 INT16_DATA_TYPE, 150 GArrowIntegerDataType) 151 struct _GArrowInt16DataTypeClass 152 { 153 GArrowIntegerDataTypeClass parent_class; 154 }; 155 156 GArrowInt16DataType *garrow_int16_data_type_new (void); 157 158 159 #define GARROW_TYPE_UINT16_DATA_TYPE (garrow_uint16_data_type_get_type()) 160 G_DECLARE_DERIVABLE_TYPE(GArrowUInt16DataType, 161 garrow_uint16_data_type, 162 GARROW, 163 UINT16_DATA_TYPE, 164 GArrowIntegerDataType) 165 struct _GArrowUInt16DataTypeClass 166 { 167 GArrowIntegerDataTypeClass parent_class; 168 }; 169 170 GArrowUInt16DataType *garrow_uint16_data_type_new (void); 171 172 173 #define GARROW_TYPE_INT32_DATA_TYPE (garrow_int32_data_type_get_type()) 174 G_DECLARE_DERIVABLE_TYPE(GArrowInt32DataType, 175 garrow_int32_data_type, 176 GARROW, 177 INT32_DATA_TYPE, 178 GArrowIntegerDataType) 179 struct _GArrowInt32DataTypeClass 180 { 181 GArrowIntegerDataTypeClass parent_class; 182 }; 183 184 GArrowInt32DataType *garrow_int32_data_type_new (void); 185 186 187 #define GARROW_TYPE_UINT32_DATA_TYPE (garrow_uint32_data_type_get_type()) 188 G_DECLARE_DERIVABLE_TYPE(GArrowUInt32DataType, 189 garrow_uint32_data_type, 190 GARROW, 191 UINT32_DATA_TYPE, 192 GArrowIntegerDataType) 193 struct _GArrowUInt32DataTypeClass 194 { 195 GArrowIntegerDataTypeClass parent_class; 196 }; 197 198 GArrowUInt32DataType *garrow_uint32_data_type_new (void); 199 200 201 #define GARROW_TYPE_INT64_DATA_TYPE (garrow_int64_data_type_get_type()) 202 G_DECLARE_DERIVABLE_TYPE(GArrowInt64DataType, 203 garrow_int64_data_type, 204 GARROW, 205 INT64_DATA_TYPE, 206 GArrowIntegerDataType) 207 struct _GArrowInt64DataTypeClass 208 { 209 GArrowIntegerDataTypeClass parent_class; 210 }; 211 212 GArrowInt64DataType *garrow_int64_data_type_new (void); 213 214 215 #define GARROW_TYPE_UINT64_DATA_TYPE (garrow_uint64_data_type_get_type()) 216 G_DECLARE_DERIVABLE_TYPE(GArrowUInt64DataType, 217 garrow_uint64_data_type, 218 GARROW, 219 UINT64_DATA_TYPE, 220 GArrowIntegerDataType) 221 struct _GArrowUInt64DataTypeClass 222 { 223 GArrowIntegerDataTypeClass parent_class; 224 }; 225 226 GArrowUInt64DataType *garrow_uint64_data_type_new (void); 227 228 229 #define GARROW_TYPE_FLOATING_POINT_DATA_TYPE \ 230 (garrow_floating_point_data_type_get_type()) 231 G_DECLARE_DERIVABLE_TYPE(GArrowFloatingPointDataType, 232 garrow_floating_point_data_type, 233 GARROW, 234 FLOATING_POINT_DATA_TYPE, 235 GArrowNumericDataType) 236 struct _GArrowFloatingPointDataTypeClass 237 { 238 GArrowNumericDataTypeClass parent_class; 239 }; 240 241 242 #define GARROW_TYPE_FLOAT_DATA_TYPE (garrow_float_data_type_get_type()) 243 G_DECLARE_DERIVABLE_TYPE(GArrowFloatDataType, 244 garrow_float_data_type, 245 GARROW, 246 FLOAT_DATA_TYPE, 247 GArrowFloatingPointDataType) 248 struct _GArrowFloatDataTypeClass 249 { 250 GArrowFloatingPointDataTypeClass parent_class; 251 }; 252 253 GArrowFloatDataType *garrow_float_data_type_new (void); 254 255 256 #define GARROW_TYPE_DOUBLE_DATA_TYPE (garrow_double_data_type_get_type()) 257 G_DECLARE_DERIVABLE_TYPE(GArrowDoubleDataType, 258 garrow_double_data_type, 259 GARROW, 260 DOUBLE_DATA_TYPE, 261 GArrowFloatingPointDataType) 262 struct _GArrowDoubleDataTypeClass 263 { 264 GArrowFloatingPointDataTypeClass parent_class; 265 }; 266 267 GArrowDoubleDataType *garrow_double_data_type_new (void); 268 269 270 #define GARROW_TYPE_BINARY_DATA_TYPE (garrow_binary_data_type_get_type()) 271 G_DECLARE_DERIVABLE_TYPE(GArrowBinaryDataType, 272 garrow_binary_data_type, 273 GARROW, 274 BINARY_DATA_TYPE, 275 GArrowDataType) 276 struct _GArrowBinaryDataTypeClass 277 { 278 GArrowDataTypeClass parent_class; 279 }; 280 281 GArrowBinaryDataType *garrow_binary_data_type_new (void); 282 283 284 #define GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE (garrow_fixed_size_binary_data_type_get_type()) 285 G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeBinaryDataType, 286 garrow_fixed_size_binary_data_type, 287 GARROW, 288 FIXED_SIZE_BINARY_DATA_TYPE, 289 GArrowDataType) 290 struct _GArrowFixedSizeBinaryDataTypeClass 291 { 292 GArrowFixedWidthDataTypeClass parent_class; 293 }; 294 295 GARROW_AVAILABLE_IN_0_12 296 GArrowFixedSizeBinaryDataType * 297 garrow_fixed_size_binary_data_type_new(gint32 byte_width); 298 GARROW_AVAILABLE_IN_0_12 299 gint32 300 garrow_fixed_size_binary_data_type_get_byte_width(GArrowFixedSizeBinaryDataType *data_type); 301 302 303 #define GARROW_TYPE_LARGE_BINARY_DATA_TYPE (garrow_large_binary_data_type_get_type()) 304 G_DECLARE_DERIVABLE_TYPE(GArrowLargeBinaryDataType, 305 garrow_large_binary_data_type, 306 GARROW, 307 LARGE_BINARY_DATA_TYPE, 308 GArrowDataType) 309 struct _GArrowLargeBinaryDataTypeClass 310 { 311 GArrowDataTypeClass parent_class; 312 }; 313 314 GARROW_AVAILABLE_IN_0_17 315 GArrowLargeBinaryDataType *garrow_large_binary_data_type_new(void); 316 317 318 #define GARROW_TYPE_STRING_DATA_TYPE (garrow_string_data_type_get_type()) 319 G_DECLARE_DERIVABLE_TYPE(GArrowStringDataType, 320 garrow_string_data_type, 321 GARROW, 322 STRING_DATA_TYPE, 323 GArrowBinaryDataType) 324 struct _GArrowStringDataTypeClass 325 { 326 GArrowBinaryDataTypeClass parent_class; 327 }; 328 329 GArrowStringDataType *garrow_string_data_type_new (void); 330 331 332 #define GARROW_TYPE_LARGE_STRING_DATA_TYPE (garrow_large_string_data_type_get_type()) 333 G_DECLARE_DERIVABLE_TYPE(GArrowLargeStringDataType, 334 garrow_large_string_data_type, 335 GARROW, 336 LARGE_STRING_DATA_TYPE, 337 GArrowLargeBinaryDataType) 338 struct _GArrowLargeStringDataTypeClass 339 { 340 GArrowLargeBinaryDataTypeClass parent_class; 341 }; 342 343 GARROW_AVAILABLE_IN_0_17 344 GArrowLargeStringDataType *garrow_large_string_data_type_new(void); 345 346 347 #define GARROW_TYPE_DATE32_DATA_TYPE (garrow_date32_data_type_get_type()) 348 G_DECLARE_DERIVABLE_TYPE(GArrowDate32DataType, 349 garrow_date32_data_type, 350 GARROW, 351 DATE32_DATA_TYPE, 352 GArrowDataType) 353 struct _GArrowDate32DataTypeClass 354 { 355 GArrowDataTypeClass parent_class; 356 }; 357 358 GArrowDate32DataType *garrow_date32_data_type_new (void); 359 360 361 #define GARROW_TYPE_DATE64_DATA_TYPE (garrow_date64_data_type_get_type()) 362 G_DECLARE_DERIVABLE_TYPE(GArrowDate64DataType, 363 garrow_date64_data_type, 364 GARROW, 365 DATE64_DATA_TYPE, 366 GArrowDataType) 367 struct _GArrowDate64DataTypeClass 368 { 369 GArrowDataTypeClass parent_class; 370 }; 371 372 GArrowDate64DataType *garrow_date64_data_type_new (void); 373 374 375 #define GARROW_TYPE_TIMESTAMP_DATA_TYPE (garrow_timestamp_data_type_get_type()) 376 G_DECLARE_DERIVABLE_TYPE(GArrowTimestampDataType, 377 garrow_timestamp_data_type, 378 GARROW, 379 TIMESTAMP_DATA_TYPE, 380 GArrowDataType) 381 struct _GArrowTimestampDataTypeClass 382 { 383 GArrowDataTypeClass parent_class; 384 }; 385 386 GArrowTimestampDataType *garrow_timestamp_data_type_new (GArrowTimeUnit unit); 387 GArrowTimeUnit 388 garrow_timestamp_data_type_get_unit (GArrowTimestampDataType *timestamp_data_type); 389 390 391 #define GARROW_TYPE_TIME_DATA_TYPE (garrow_time_data_type_get_type()) 392 G_DECLARE_DERIVABLE_TYPE(GArrowTimeDataType, 393 garrow_time_data_type, 394 GARROW, 395 TIME_DATA_TYPE, 396 GArrowDataType) 397 struct _GArrowTimeDataTypeClass 398 { 399 GArrowDataTypeClass parent_class; 400 }; 401 402 GArrowTimeUnit garrow_time_data_type_get_unit (GArrowTimeDataType *time_data_type); 403 404 405 #define GARROW_TYPE_TIME32_DATA_TYPE (garrow_time32_data_type_get_type()) 406 G_DECLARE_DERIVABLE_TYPE(GArrowTime32DataType, 407 garrow_time32_data_type, 408 GARROW, 409 TIME32_DATA_TYPE, 410 GArrowTimeDataType) 411 struct _GArrowTime32DataTypeClass 412 { 413 GArrowTimeDataTypeClass parent_class; 414 }; 415 416 GArrowTime32DataType *garrow_time32_data_type_new (GArrowTimeUnit unit, 417 GError **error); 418 419 420 #define GARROW_TYPE_TIME64_DATA_TYPE (garrow_time64_data_type_get_type()) 421 G_DECLARE_DERIVABLE_TYPE(GArrowTime64DataType, 422 garrow_time64_data_type, 423 GARROW, 424 TIME64_DATA_TYPE, 425 GArrowTimeDataType) 426 struct _GArrowTime64DataTypeClass 427 { 428 GArrowTimeDataTypeClass parent_class; 429 }; 430 431 GArrowTime64DataType *garrow_time64_data_type_new (GArrowTimeUnit unit, 432 GError **error); 433 434 435 #define GARROW_TYPE_DECIMAL_DATA_TYPE (garrow_decimal_data_type_get_type()) 436 G_DECLARE_DERIVABLE_TYPE(GArrowDecimalDataType, 437 garrow_decimal_data_type, 438 GARROW, 439 DECIMAL_DATA_TYPE, 440 GArrowFixedSizeBinaryDataType) 441 struct _GArrowDecimalDataTypeClass 442 { 443 GArrowFixedSizeBinaryDataTypeClass parent_class; 444 }; 445 446 #ifndef GARROW_DISABLE_DEPRECATED 447 GARROW_DEPRECATED_IN_0_12_FOR(garrow_decimal128_data_type_new) 448 GArrowDecimalDataType * 449 garrow_decimal_data_type_new(gint32 precision, gint32 scale); 450 #endif 451 gint32 garrow_decimal_data_type_get_precision(GArrowDecimalDataType *decimal_data_type); 452 gint32 garrow_decimal_data_type_get_scale(GArrowDecimalDataType *decimal_data_type); 453 454 455 #define GARROW_TYPE_DECIMAL128_DATA_TYPE (garrow_decimal128_data_type_get_type()) 456 G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128DataType, 457 garrow_decimal128_data_type, 458 GARROW, 459 DECIMAL128_DATA_TYPE, 460 GArrowDecimalDataType) 461 struct _GArrowDecimal128DataTypeClass 462 { 463 GArrowDecimalDataTypeClass parent_class; 464 }; 465 466 GARROW_AVAILABLE_IN_0_12 467 GArrowDecimal128DataType * 468 garrow_decimal128_data_type_new(gint32 precision, gint32 scale); 469 470 G_END_DECLS 471