http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/binary-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/binary-array-builder.h b/c_glib/arrow-glib/binary-array-builder.h deleted file mode 100644 index 111a83a..0000000 --- a/c_glib/arrow-glib/binary-array-builder.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_BINARY_ARRAY_BUILDER \ - (garrow_binary_array_builder_get_type()) -#define GARROW_BINARY_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_BINARY_ARRAY_BUILDER, \ - GArrowBinaryArrayBuilder)) -#define GARROW_BINARY_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_BINARY_ARRAY_BUILDER, \ - GArrowBinaryArrayBuilderClass)) -#define GARROW_IS_BINARY_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_BINARY_ARRAY_BUILDER)) -#define GARROW_IS_BINARY_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_BINARY_ARRAY_BUILDER)) -#define GARROW_BINARY_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_BINARY_ARRAY_BUILDER, \ - GArrowBinaryArrayBuilderClass)) - -typedef struct _GArrowBinaryArrayBuilder GArrowBinaryArrayBuilder; -typedef struct _GArrowBinaryArrayBuilderClass GArrowBinaryArrayBuilderClass; - -/** - * GArrowBinaryArrayBuilder: - * - * It wraps `arrow::BinaryBuilder`. - */ -struct _GArrowBinaryArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowBinaryArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_binary_array_builder_get_type(void) G_GNUC_CONST; - -GArrowBinaryArrayBuilder *garrow_binary_array_builder_new(void); - -gboolean garrow_binary_array_builder_append(GArrowBinaryArrayBuilder *builder, - const guint8 *value, - gint32 length, - GError **error); -gboolean garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder, - GError **error); - -G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/boolean-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/boolean-array-builder.cpp b/c_glib/arrow-glib/boolean-array-builder.cpp deleted file mode 100644 index 146eb31..0000000 --- a/c_glib/arrow-glib/boolean-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/boolean-array-builder.h> -#include <arrow-glib/error.hpp> - -G_BEGIN_DECLS - -/** - * SECTION: boolean-array-builder - * @short_description: Boolean array builder class - * - * #GArrowBooleanArrayBuilder is the class to create a new - * #GArrowBooleanArray. - */ - -G_DEFINE_TYPE(GArrowBooleanArrayBuilder, - garrow_boolean_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_boolean_array_builder_init(GArrowBooleanArrayBuilder *builder) -{ -} - -static void -garrow_boolean_array_builder_class_init(GArrowBooleanArrayBuilderClass *klass) -{ -} - -/** - * garrow_boolean_array_builder_new: - * - * Returns: A newly created #GArrowBooleanArrayBuilder. - */ -GArrowBooleanArrayBuilder * -garrow_boolean_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::BooleanBuilder>(memory_pool); - auto builder = - GARROW_BOOLEAN_ARRAY_BUILDER(g_object_new(GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_boolean_array_builder_append: - * @builder: A #GArrowBooleanArrayBuilder. - * @value: A boolean value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder, - gboolean value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::BooleanBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(static_cast<bool>(value)); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[boolean-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_boolean_array_builder_append_null: - * @builder: A #GArrowBooleanArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::BooleanBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[boolean-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/boolean-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/boolean-array-builder.h b/c_glib/arrow-glib/boolean-array-builder.h deleted file mode 100644 index ca50e97..0000000 --- a/c_glib/arrow-glib/boolean-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_BOOLEAN_ARRAY_BUILDER \ - (garrow_boolean_array_builder_get_type()) -#define GARROW_BOOLEAN_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \ - GArrowBooleanArrayBuilder)) -#define GARROW_BOOLEAN_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \ - GArrowBooleanArrayBuilderClass)) -#define GARROW_IS_BOOLEAN_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY_BUILDER)) -#define GARROW_IS_BOOLEAN_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_BOOLEAN_ARRAY_BUILDER)) -#define GARROW_BOOLEAN_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_BOOLEAN_ARRAY_BUILDER, \ - GArrowBooleanArrayBuilderClass)) - -typedef struct _GArrowBooleanArrayBuilder GArrowBooleanArrayBuilder; -typedef struct _GArrowBooleanArrayBuilderClass GArrowBooleanArrayBuilderClass; - -/** - * GArrowBooleanArrayBuilder: - * - * It wraps `arrow::BooleanBuilder`. - */ -struct _GArrowBooleanArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowBooleanArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_boolean_array_builder_get_type(void) G_GNUC_CONST; - -GArrowBooleanArrayBuilder *garrow_boolean_array_builder_new(void); - -gboolean garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder, - gboolean value, - GError **error); -gboolean garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/double-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/double-array-builder.cpp b/c_glib/arrow-glib/double-array-builder.cpp deleted file mode 100644 index cc44eea..0000000 --- a/c_glib/arrow-glib/double-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/double-array-builder.h> -#include <arrow-glib/error.hpp> - -G_BEGIN_DECLS - -/** - * SECTION: double-array-builder - * @short_description: 64-bit floating point array builder class - * - * #GArrowDoubleArrayBuilder is the class to create a new - * #GArrowDoubleArray. - */ - -G_DEFINE_TYPE(GArrowDoubleArrayBuilder, - garrow_double_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_double_array_builder_init(GArrowDoubleArrayBuilder *builder) -{ -} - -static void -garrow_double_array_builder_class_init(GArrowDoubleArrayBuilderClass *klass) -{ -} - -/** - * garrow_double_array_builder_new: - * - * Returns: A newly created #GArrowDoubleArrayBuilder. - */ -GArrowDoubleArrayBuilder * -garrow_double_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::DoubleBuilder>(memory_pool, arrow::float64()); - auto builder = - GARROW_DOUBLE_ARRAY_BUILDER(g_object_new(GARROW_TYPE_DOUBLE_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_double_array_builder_append: - * @builder: A #GArrowDoubleArrayBuilder. - * @value: A double value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder, - gdouble value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::DoubleBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[double-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_double_array_builder_append_null: - * @builder: A #GArrowDoubleArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::DoubleBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[double-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/double-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/double-array-builder.h b/c_glib/arrow-glib/double-array-builder.h deleted file mode 100644 index 5d95c89..0000000 --- a/c_glib/arrow-glib/double-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_DOUBLE_ARRAY_BUILDER \ - (garrow_double_array_builder_get_type()) -#define GARROW_DOUBLE_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \ - GArrowDoubleArrayBuilder)) -#define GARROW_DOUBLE_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \ - GArrowDoubleArrayBuilderClass)) -#define GARROW_IS_DOUBLE_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_DOUBLE_ARRAY_BUILDER)) -#define GARROW_IS_DOUBLE_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_DOUBLE_ARRAY_BUILDER)) -#define GARROW_DOUBLE_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_DOUBLE_ARRAY_BUILDER, \ - GArrowDoubleArrayBuilderClass)) - -typedef struct _GArrowDoubleArrayBuilder GArrowDoubleArrayBuilder; -typedef struct _GArrowDoubleArrayBuilderClass GArrowDoubleArrayBuilderClass; - -/** - * GArrowDoubleArrayBuilder: - * - * It wraps `arrow::DoubleBuilder`. - */ -struct _GArrowDoubleArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowDoubleArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_double_array_builder_get_type(void) G_GNUC_CONST; - -GArrowDoubleArrayBuilder *garrow_double_array_builder_new(void); - -gboolean garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder, - gdouble value, - GError **error); -gboolean garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/float-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/float-array-builder.cpp b/c_glib/arrow-glib/float-array-builder.cpp deleted file mode 100644 index 77a9a0b..0000000 --- a/c_glib/arrow-glib/float-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/float-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: float-array-builder - * @short_description: 32-bit floating point array builder class - * - * #GArrowFloatArrayBuilder is the class to creating a new - * #GArrowFloatArray. - */ - -G_DEFINE_TYPE(GArrowFloatArrayBuilder, - garrow_float_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_float_array_builder_init(GArrowFloatArrayBuilder *builder) -{ -} - -static void -garrow_float_array_builder_class_init(GArrowFloatArrayBuilderClass *klass) -{ -} - -/** - * garrow_float_array_builder_new: - * - * Returns: A newly created #GArrowFloatArrayBuilder. - */ -GArrowFloatArrayBuilder * -garrow_float_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::FloatBuilder>(memory_pool, arrow::float32()); - auto builder = - GARROW_FLOAT_ARRAY_BUILDER(g_object_new(GARROW_TYPE_FLOAT_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_float_array_builder_append: - * @builder: A #GArrowFloatArrayBuilder. - * @value: A float value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder, - gfloat value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::FloatBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[float-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_float_array_builder_append_null: - * @builder: A #GArrowFloatArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::FloatBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[float-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/float-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/float-array-builder.h b/c_glib/arrow-glib/float-array-builder.h deleted file mode 100644 index 0039003..0000000 --- a/c_glib/arrow-glib/float-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_FLOAT_ARRAY_BUILDER \ - (garrow_float_array_builder_get_type()) -#define GARROW_FLOAT_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_FLOAT_ARRAY_BUILDER, \ - GArrowFloatArrayBuilder)) -#define GARROW_FLOAT_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_FLOAT_ARRAY_BUILDER, \ - GArrowFloatArrayBuilderClass)) -#define GARROW_IS_FLOAT_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_FLOAT_ARRAY_BUILDER)) -#define GARROW_IS_FLOAT_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_FLOAT_ARRAY_BUILDER)) -#define GARROW_FLOAT_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_FLOAT_ARRAY_BUILDER, \ - GArrowFloatArrayBuilderClass)) - -typedef struct _GArrowFloatArrayBuilder GArrowFloatArrayBuilder; -typedef struct _GArrowFloatArrayBuilderClass GArrowFloatArrayBuilderClass; - -/** - * GArrowFloatArrayBuilder: - * - * It wraps `arrow::FloatBuilder`. - */ -struct _GArrowFloatArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowFloatArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_float_array_builder_get_type(void) G_GNUC_CONST; - -GArrowFloatArrayBuilder *garrow_float_array_builder_new(void); - -gboolean garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder, - gfloat value, - GError **error); -gboolean garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int16-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int16-array-builder.cpp b/c_glib/arrow-glib/int16-array-builder.cpp deleted file mode 100644 index fbf18ef..0000000 --- a/c_glib/arrow-glib/int16-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/int16-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: int16-array-builder - * @short_description: 16-bit integer array builder class - * - * #GArrowInt16ArrayBuilder is the class to create a new - * #GArrowInt16Array. - */ - -G_DEFINE_TYPE(GArrowInt16ArrayBuilder, - garrow_int16_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_int16_array_builder_init(GArrowInt16ArrayBuilder *builder) -{ -} - -static void -garrow_int16_array_builder_class_init(GArrowInt16ArrayBuilderClass *klass) -{ -} - -/** - * garrow_int16_array_builder_new: - * - * Returns: A newly created #GArrowInt16ArrayBuilder. - */ -GArrowInt16ArrayBuilder * -garrow_int16_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::Int16Builder>(memory_pool, arrow::int16()); - auto builder = - GARROW_INT16_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT16_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_int16_array_builder_append: - * @builder: A #GArrowInt16ArrayBuilder. - * @value: A int16 value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder, - gint16 value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int16Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int16-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_int16_array_builder_append_null: - * @builder: A #GArrowInt16ArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int16Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int16-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int16-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int16-array-builder.h b/c_glib/arrow-glib/int16-array-builder.h deleted file mode 100644 index f222cfd..0000000 --- a/c_glib/arrow-glib/int16-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT16_ARRAY_BUILDER \ - (garrow_int16_array_builder_get_type()) -#define GARROW_INT16_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT16_ARRAY_BUILDER, \ - GArrowInt16ArrayBuilder)) -#define GARROW_INT16_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT16_ARRAY_BUILDER, \ - GArrowInt16ArrayBuilderClass)) -#define GARROW_IS_INT16_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT16_ARRAY_BUILDER)) -#define GARROW_IS_INT16_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT16_ARRAY_BUILDER)) -#define GARROW_INT16_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT16_ARRAY_BUILDER, \ - GArrowInt16ArrayBuilderClass)) - -typedef struct _GArrowInt16ArrayBuilder GArrowInt16ArrayBuilder; -typedef struct _GArrowInt16ArrayBuilderClass GArrowInt16ArrayBuilderClass; - -/** - * GArrowInt16ArrayBuilder: - * - * It wraps `arrow::Int16Builder`. - */ -struct _GArrowInt16ArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowInt16ArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_int16_array_builder_get_type(void) G_GNUC_CONST; - -GArrowInt16ArrayBuilder *garrow_int16_array_builder_new(void); - -gboolean garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder, - gint16 value, - GError **error); -gboolean garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int32-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int32-array-builder.cpp b/c_glib/arrow-glib/int32-array-builder.cpp deleted file mode 100644 index 30cc470..0000000 --- a/c_glib/arrow-glib/int32-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/int32-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: int32-array-builder - * @short_description: 32-bit integer array builder class - * - * #GArrowInt32ArrayBuilder is the class to create a new - * #GArrowInt32Array. - */ - -G_DEFINE_TYPE(GArrowInt32ArrayBuilder, - garrow_int32_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_int32_array_builder_init(GArrowInt32ArrayBuilder *builder) -{ -} - -static void -garrow_int32_array_builder_class_init(GArrowInt32ArrayBuilderClass *klass) -{ -} - -/** - * garrow_int32_array_builder_new: - * - * Returns: A newly created #GArrowInt32ArrayBuilder. - */ -GArrowInt32ArrayBuilder * -garrow_int32_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::Int32Builder>(memory_pool, arrow::int32()); - auto builder = - GARROW_INT32_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT32_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_int32_array_builder_append: - * @builder: A #GArrowInt32ArrayBuilder. - * @value: A int32 value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder, - gint32 value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int32Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int32-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_int32_array_builder_append_null: - * @builder: A #GArrowInt32ArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int32Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int32-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int32-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int32-array-builder.h b/c_glib/arrow-glib/int32-array-builder.h deleted file mode 100644 index bdb380d..0000000 --- a/c_glib/arrow-glib/int32-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT32_ARRAY_BUILDER \ - (garrow_int32_array_builder_get_type()) -#define GARROW_INT32_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT32_ARRAY_BUILDER, \ - GArrowInt32ArrayBuilder)) -#define GARROW_INT32_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT32_ARRAY_BUILDER, \ - GArrowInt32ArrayBuilderClass)) -#define GARROW_IS_INT32_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT32_ARRAY_BUILDER)) -#define GARROW_IS_INT32_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT32_ARRAY_BUILDER)) -#define GARROW_INT32_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT32_ARRAY_BUILDER, \ - GArrowInt32ArrayBuilderClass)) - -typedef struct _GArrowInt32ArrayBuilder GArrowInt32ArrayBuilder; -typedef struct _GArrowInt32ArrayBuilderClass GArrowInt32ArrayBuilderClass; - -/** - * GArrowInt32ArrayBuilder: - * - * It wraps `arrow::Int32Builder`. - */ -struct _GArrowInt32ArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowInt32ArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_int32_array_builder_get_type(void) G_GNUC_CONST; - -GArrowInt32ArrayBuilder *garrow_int32_array_builder_new(void); - -gboolean garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder, - gint32 value, - GError **error); -gboolean garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int64-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int64-array-builder.cpp b/c_glib/arrow-glib/int64-array-builder.cpp deleted file mode 100644 index b5eff11..0000000 --- a/c_glib/arrow-glib/int64-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/int64-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: int64-array-builder - * @short_description: 64-bit integer array builder class - * - * #GArrowInt64ArrayBuilder is the class to create a new - * #GArrowInt64Array. - */ - -G_DEFINE_TYPE(GArrowInt64ArrayBuilder, - garrow_int64_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_int64_array_builder_init(GArrowInt64ArrayBuilder *builder) -{ -} - -static void -garrow_int64_array_builder_class_init(GArrowInt64ArrayBuilderClass *klass) -{ -} - -/** - * garrow_int64_array_builder_new: - * - * Returns: A newly created #GArrowInt64ArrayBuilder. - */ -GArrowInt64ArrayBuilder * -garrow_int64_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::Int64Builder>(memory_pool, arrow::int64()); - auto builder = - GARROW_INT64_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT64_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_int64_array_builder_append: - * @builder: A #GArrowInt64ArrayBuilder. - * @value: A int64 value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder, - gint64 value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int64Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int64-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_int64_array_builder_append_null: - * @builder: A #GArrowInt64ArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int64Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int64-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int64-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int64-array-builder.h b/c_glib/arrow-glib/int64-array-builder.h deleted file mode 100644 index 8f4947e..0000000 --- a/c_glib/arrow-glib/int64-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT64_ARRAY_BUILDER \ - (garrow_int64_array_builder_get_type()) -#define GARROW_INT64_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT64_ARRAY_BUILDER, \ - GArrowInt64ArrayBuilder)) -#define GARROW_INT64_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT64_ARRAY_BUILDER, \ - GArrowInt64ArrayBuilderClass)) -#define GARROW_IS_INT64_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT64_ARRAY_BUILDER)) -#define GARROW_IS_INT64_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT64_ARRAY_BUILDER)) -#define GARROW_INT64_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT64_ARRAY_BUILDER, \ - GArrowInt64ArrayBuilderClass)) - -typedef struct _GArrowInt64ArrayBuilder GArrowInt64ArrayBuilder; -typedef struct _GArrowInt64ArrayBuilderClass GArrowInt64ArrayBuilderClass; - -/** - * GArrowInt64ArrayBuilder: - * - * It wraps `arrow::Int64Builder`. - */ -struct _GArrowInt64ArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowInt64ArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_int64_array_builder_get_type(void) G_GNUC_CONST; - -GArrowInt64ArrayBuilder *garrow_int64_array_builder_new(void); - -gboolean garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int8-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int8-array-builder.cpp b/c_glib/arrow-glib/int8-array-builder.cpp deleted file mode 100644 index 5107a6f..0000000 --- a/c_glib/arrow-glib/int8-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/int8-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: int8-array-builder - * @short_description: 8-bit integer array builder class - * - * #GArrowInt8ArrayBuilder is the class to create a new - * #GArrowInt8Array. - */ - -G_DEFINE_TYPE(GArrowInt8ArrayBuilder, - garrow_int8_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_int8_array_builder_init(GArrowInt8ArrayBuilder *builder) -{ -} - -static void -garrow_int8_array_builder_class_init(GArrowInt8ArrayBuilderClass *klass) -{ -} - -/** - * garrow_int8_array_builder_new: - * - * Returns: A newly created #GArrowInt8ArrayBuilder. - */ -GArrowInt8ArrayBuilder * -garrow_int8_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::Int8Builder>(memory_pool, arrow::int8()); - auto builder = - GARROW_INT8_ARRAY_BUILDER(g_object_new(GARROW_TYPE_INT8_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_int8_array_builder_append: - * @builder: A #GArrowInt8ArrayBuilder. - * @value: A int8 value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder, - gint8 value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int8Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int8-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_int8_array_builder_append_null: - * @builder: A #GArrowInt8ArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::Int8Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[int8-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/int8-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/int8-array-builder.h b/c_glib/arrow-glib/int8-array-builder.h deleted file mode 100644 index 321e931..0000000 --- a/c_glib/arrow-glib/int8-array-builder.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_INT8_ARRAY_BUILDER \ - (garrow_int8_array_builder_get_type()) -#define GARROW_INT8_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_INT8_ARRAY_BUILDER, \ - GArrowInt8ArrayBuilder)) -#define GARROW_INT8_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_INT8_ARRAY_BUILDER, \ - GArrowInt8ArrayBuilderClass)) -#define GARROW_IS_INT8_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_INT8_ARRAY_BUILDER)) -#define GARROW_IS_INT8_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_INT8_ARRAY_BUILDER)) -#define GARROW_INT8_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_INT8_ARRAY_BUILDER, \ - GArrowInt8ArrayBuilderClass)) - -typedef struct _GArrowInt8ArrayBuilder GArrowInt8ArrayBuilder; -typedef struct _GArrowInt8ArrayBuilderClass GArrowInt8ArrayBuilderClass; - -/** - * GArrowInt8ArrayBuilder: - * - * It wraps `arrow::Int8Builder`. - */ -struct _GArrowInt8ArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowInt8ArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_int8_array_builder_get_type(void) G_GNUC_CONST; - -GArrowInt8ArrayBuilder *garrow_int8_array_builder_new(void); - -gboolean garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder, - gint8 value, - GError **error); -gboolean garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/list-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/list-array-builder.cpp b/c_glib/arrow-glib/list-array-builder.cpp deleted file mode 100644 index 6c8f53d..0000000 --- a/c_glib/arrow-glib/list-array-builder.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/list-array-builder.h> -#include <arrow-glib/error.hpp> - -G_BEGIN_DECLS - -/** - * SECTION: list-array-builder - * @short_description: List array builder class - * @include: arrow-glib/arrow-glib.h - * - * #GArrowListArrayBuilder is the class to create a new - * #GArrowListArray. - */ - -G_DEFINE_TYPE(GArrowListArrayBuilder, - garrow_list_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_list_array_builder_init(GArrowListArrayBuilder *builder) -{ -} - -static void -garrow_list_array_builder_class_init(GArrowListArrayBuilderClass *klass) -{ -} - -/** - * garrow_list_array_builder_new: - * @value_builder: A #GArrowArrayBuilder for value array. - * - * Returns: A newly created #GArrowListArrayBuilder. - */ -GArrowListArrayBuilder * -garrow_list_array_builder_new(GArrowArrayBuilder *value_builder) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_value_builder = garrow_array_builder_get_raw(value_builder); - auto arrow_list_builder = - std::make_shared<arrow::ListBuilder>(memory_pool, arrow_value_builder); - std::shared_ptr<arrow::ArrayBuilder> arrow_builder = arrow_list_builder; - auto builder = garrow_array_builder_new_raw(&arrow_builder); - return GARROW_LIST_ARRAY_BUILDER(builder); -} - -/** - * garrow_list_array_builder_append: - * @builder: A #GArrowListArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - * - * It appends a new list element. To append a new list element, you - * need to call this function then append list element values to - * `value_builder`. `value_builder` is the #GArrowArrayBuilder - * specified to constructor. You can get `value_builder` by - * garrow_list_array_builder_get_value_builder(). - * - * |[<!-- language="C" --> - * GArrowInt8ArrayBuilder *value_builder; - * GArrowListArrayBuilder *builder; - * - * value_builder = garrow_int8_array_builder_new(); - * builder = garrow_list_array_builder_new(value_builder, NULL); - * - * // Start 0th list element: [1, 0, -1] - * garrow_list_array_builder_append(builder, NULL); - * garrow_int8_array_builder_append(value_builder, 1); - * garrow_int8_array_builder_append(value_builder, 0); - * garrow_int8_array_builder_append(value_builder, -1); - * - * // Start 1st list element: [-29, 29] - * garrow_list_array_builder_append(builder, NULL); - * garrow_int8_array_builder_append(value_builder, -29); - * garrow_int8_array_builder_append(value_builder, 29); - * - * { - * // [[1, 0, -1], [-29, 29]] - * GArrowArray *array = garrow_array_builder_finish(builder); - * // Now, builder is needless. - * g_object_unref(builder); - * g_object_unref(value_builder); - * - * // Use array... - * g_object_unref(array); - * } - * ]| - */ -gboolean -garrow_list_array_builder_append(GArrowListArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::ListBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[list-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_list_array_builder_append_null: - * @builder: A #GArrowListArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - * - * It appends a new NULL element. - */ -gboolean -garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::ListBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[list-array-builder][append-null]"); - return FALSE; - } -} - -/** - * garrow_list_array_builder_get_value_builder: - * @builder: A #GArrowListArrayBuilder. - * - * Returns: (transfer full): The #GArrowArrayBuilder for values. - */ -GArrowArrayBuilder * -garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder) -{ - auto arrow_builder = - static_cast<arrow::ListBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - auto arrow_value_builder = arrow_builder->value_builder(); - return garrow_array_builder_new_raw(&arrow_value_builder); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/list-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/list-array-builder.h b/c_glib/arrow-glib/list-array-builder.h deleted file mode 100644 index 2c2e58e..0000000 --- a/c_glib/arrow-glib/list-array-builder.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_LIST_ARRAY_BUILDER \ - (garrow_list_array_builder_get_type()) -#define GARROW_LIST_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_LIST_ARRAY_BUILDER, \ - GArrowListArrayBuilder)) -#define GARROW_LIST_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_LIST_ARRAY_BUILDER, \ - GArrowListArrayBuilderClass)) -#define GARROW_IS_LIST_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_LIST_ARRAY_BUILDER)) -#define GARROW_IS_LIST_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_LIST_ARRAY_BUILDER)) -#define GARROW_LIST_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_LIST_ARRAY_BUILDER, \ - GArrowListArrayBuilderClass)) - -typedef struct _GArrowListArrayBuilder GArrowListArrayBuilder; -typedef struct _GArrowListArrayBuilderClass GArrowListArrayBuilderClass; - -/** - * GArrowListArrayBuilder: - * - * It wraps `arrow::ListBuilder`. - */ -struct _GArrowListArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowListArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_list_array_builder_get_type(void) G_GNUC_CONST; - -GArrowListArrayBuilder *garrow_list_array_builder_new(GArrowArrayBuilder *value_builder); - -gboolean garrow_list_array_builder_append(GArrowListArrayBuilder *builder, - GError **error); -gboolean garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, - GError **error); - -GArrowArrayBuilder *garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/string-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/string-array-builder.cpp b/c_glib/arrow-glib/string-array-builder.cpp deleted file mode 100644 index ebad53a..0000000 --- a/c_glib/arrow-glib/string-array-builder.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/string-array-builder.h> -#include <arrow-glib/error.hpp> - -G_BEGIN_DECLS - -/** - * SECTION: string-array-builder - * @short_description: UTF-8 encoded string array builder class - * - * #GArrowStringArrayBuilder is the class to create a new - * #GArrowStringArray. - */ - -G_DEFINE_TYPE(GArrowStringArrayBuilder, - garrow_string_array_builder, - GARROW_TYPE_BINARY_ARRAY_BUILDER) - -static void -garrow_string_array_builder_init(GArrowStringArrayBuilder *builder) -{ -} - -static void -garrow_string_array_builder_class_init(GArrowStringArrayBuilderClass *klass) -{ -} - -/** - * garrow_string_array_builder_new: - * - * Returns: A newly created #GArrowStringArrayBuilder. - */ -GArrowStringArrayBuilder * -garrow_string_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::StringBuilder>(memory_pool); - auto builder = - GARROW_STRING_ARRAY_BUILDER(g_object_new(GARROW_TYPE_STRING_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_string_array_builder_append: - * @builder: A #GArrowStringArrayBuilder. - * @value: A string value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_string_array_builder_append(GArrowStringArrayBuilder *builder, - const gchar *value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::StringBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value, - static_cast<gint32>(strlen(value))); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[string-array-builder][append]"); - return FALSE; - } -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/string-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/string-array-builder.h b/c_glib/arrow-glib/string-array-builder.h deleted file mode 100644 index f370ed9..0000000 --- a/c_glib/arrow-glib/string-array-builder.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/binary-array-builder.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_STRING_ARRAY_BUILDER \ - (garrow_string_array_builder_get_type()) -#define GARROW_STRING_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_STRING_ARRAY_BUILDER, \ - GArrowStringArrayBuilder)) -#define GARROW_STRING_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_STRING_ARRAY_BUILDER, \ - GArrowStringArrayBuilderClass)) -#define GARROW_IS_STRING_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_STRING_ARRAY_BUILDER)) -#define GARROW_IS_STRING_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_STRING_ARRAY_BUILDER)) -#define GARROW_STRING_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_STRING_ARRAY_BUILDER, \ - GArrowStringArrayBuilderClass)) - -typedef struct _GArrowStringArrayBuilder GArrowStringArrayBuilder; -typedef struct _GArrowStringArrayBuilderClass GArrowStringArrayBuilderClass; - -/** - * GArrowStringArrayBuilder: - * - * It wraps `arrow::StringBuilder`. - */ -struct _GArrowStringArrayBuilder -{ - /*< private >*/ - GArrowBinaryArrayBuilder parent_instance; -}; - -struct _GArrowStringArrayBuilderClass -{ - GArrowBinaryArrayBuilderClass parent_class; -}; - -GType garrow_string_array_builder_get_type(void) G_GNUC_CONST; - -GArrowStringArrayBuilder *garrow_string_array_builder_new(void); - -gboolean garrow_string_array_builder_append(GArrowStringArrayBuilder *builder, - const gchar *value, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/struct-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/struct-array-builder.cpp b/c_glib/arrow-glib/struct-array-builder.cpp deleted file mode 100644 index 2453a5b..0000000 --- a/c_glib/arrow-glib/struct-array-builder.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/data-type.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/field.hpp> -#include <arrow-glib/struct-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: struct-array-builder - * @short_description: Struct array builder class - * @include: arrow-glib/arrow-glib.h - * - * #GArrowStructArrayBuilder is the class to create a new - * #GArrowStructArray. - */ - -G_DEFINE_TYPE(GArrowStructArrayBuilder, - garrow_struct_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_struct_array_builder_init(GArrowStructArrayBuilder *builder) -{ -} - -static void -garrow_struct_array_builder_class_init(GArrowStructArrayBuilderClass *klass) -{ -} - -/** - * garrow_struct_array_builder_new: - * @data_type: #GArrowStructDataType for the struct. - * @field_builders: (element-type GArrowArray): #GArrowArrayBuilders - * for fields. - * - * Returns: A newly created #GArrowStructArrayBuilder. - */ -GArrowStructArrayBuilder * -garrow_struct_array_builder_new(GArrowStructDataType *data_type, - GList *field_builders) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - std::vector<std::shared_ptr<arrow::ArrayBuilder>> arrow_field_builders; - for (GList *node = field_builders; node; node = g_list_next(node)) { - auto field_builder = static_cast<GArrowArrayBuilder *>(node->data); - auto arrow_field_builder = garrow_array_builder_get_raw(field_builder); - arrow_field_builders.push_back(arrow_field_builder); - } - - auto arrow_struct_builder = - std::make_shared<arrow::StructBuilder>(memory_pool, - arrow_data_type, - arrow_field_builders); - std::shared_ptr<arrow::ArrayBuilder> arrow_builder = arrow_struct_builder; - auto builder = garrow_array_builder_new_raw(&arrow_builder); - return GARROW_STRUCT_ARRAY_BUILDER(builder); -} - -/** - * garrow_struct_array_builder_append: - * @builder: A #GArrowStructArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - * - * It appends a new struct element. To append a new struct element, - * you need to call this function then append struct element field - * values to all `field_builder`s. `field_value`s are the - * #GArrowArrayBuilder specified to constructor. You can get - * `field_builder` by garrow_struct_array_builder_get_field_builder() - * or garrow_struct_array_builder_get_field_builders(). - * - * |[<!-- language="C" --> - * // TODO - * ]| - */ -gboolean -garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::StructBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[struct-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_struct_array_builder_append_null: - * @builder: A #GArrowStructArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - * - * It appends a new NULL element. - */ -gboolean -garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::StructBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[struct-array-builder][append-null]"); - return FALSE; - } -} - -/** - * garrow_struct_array_builder_get_field_builder: - * @builder: A #GArrowStructArrayBuilder. - * @i: The index of the field in the struct. - * - * Returns: (transfer full): The #GArrowArrayBuilder for the i-th field. - */ -GArrowArrayBuilder * -garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, - gint i) -{ - auto arrow_builder = - static_cast<arrow::StructBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - auto arrow_field_builder = arrow_builder->field_builder(i); - return garrow_array_builder_new_raw(&arrow_field_builder); -} - -/** - * garrow_struct_array_builder_get_field_builders: - * @builder: A #GArrowStructArrayBuilder. - * - * Returns: (element-type GArrowArray) (transfer full): - * The #GArrowArrayBuilder for all fields. - */ -GList * -garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder) -{ - auto arrow_struct_builder = - static_cast<arrow::StructBuilder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - GList *field_builders = NULL; - for (auto arrow_field_builder : arrow_struct_builder->field_builders()) { - auto field_builder = garrow_array_builder_new_raw(&arrow_field_builder); - field_builders = g_list_prepend(field_builders, field_builder); - } - - return g_list_reverse(field_builders); -} - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/struct-array-builder.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/struct-array-builder.h b/c_glib/arrow-glib/struct-array-builder.h deleted file mode 100644 index 237b2b3..0000000 --- a/c_glib/arrow-glib/struct-array-builder.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#pragma once - -#include <arrow-glib/array-builder.h> -#include <arrow-glib/data-type.h> - -G_BEGIN_DECLS - -#define GARROW_TYPE_STRUCT_ARRAY_BUILDER \ - (garrow_struct_array_builder_get_type()) -#define GARROW_STRUCT_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_STRUCT_ARRAY_BUILDER, \ - GArrowStructArrayBuilder)) -#define GARROW_STRUCT_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_STRUCT_ARRAY_BUILDER, \ - GArrowStructArrayBuilderClass)) -#define GARROW_IS_STRUCT_ARRAY_BUILDER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_STRUCT_ARRAY_BUILDER)) -#define GARROW_IS_STRUCT_ARRAY_BUILDER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_STRUCT_ARRAY_BUILDER)) -#define GARROW_STRUCT_ARRAY_BUILDER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_STRUCT_ARRAY_BUILDER, \ - GArrowStructArrayBuilderClass)) - -typedef struct _GArrowStructArrayBuilder GArrowStructArrayBuilder; -typedef struct _GArrowStructArrayBuilderClass GArrowStructArrayBuilderClass; - -/** - * GArrowStructArrayBuilder: - * - * It wraps `arrow::StructBuilder`. - */ -struct _GArrowStructArrayBuilder -{ - /*< private >*/ - GArrowArrayBuilder parent_instance; -}; - -struct _GArrowStructArrayBuilderClass -{ - GArrowArrayBuilderClass parent_class; -}; - -GType garrow_struct_array_builder_get_type(void) G_GNUC_CONST; - -GArrowStructArrayBuilder *garrow_struct_array_builder_new(GArrowStructDataType *data_type, - GList *field_builders); - -gboolean garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, - GError **error); -gboolean garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, - GError **error); - -GArrowArrayBuilder *garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, - gint i); -GList *garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/76dfd987/c_glib/arrow-glib/uint16-array-builder.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/uint16-array-builder.cpp b/c_glib/arrow-glib/uint16-array-builder.cpp deleted file mode 100644 index bfade2d..0000000 --- a/c_glib/arrow-glib/uint16-array-builder.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow-glib/array-builder.hpp> -#include <arrow-glib/error.hpp> -#include <arrow-glib/uint16-array-builder.h> - -G_BEGIN_DECLS - -/** - * SECTION: uint16-array-builder - * @short_description: 16-bit unsigned integer array builder class - * - * #GArrowUInt16ArrayBuilder is the class to create a new - * #GArrowUInt16Array. - */ - -G_DEFINE_TYPE(GArrowUInt16ArrayBuilder, - garrow_uint16_array_builder, - GARROW_TYPE_ARRAY_BUILDER) - -static void -garrow_uint16_array_builder_init(GArrowUInt16ArrayBuilder *builder) -{ -} - -static void -garrow_uint16_array_builder_class_init(GArrowUInt16ArrayBuilderClass *klass) -{ -} - -/** - * garrow_uint16_array_builder_new: - * - * Returns: A newly created #GArrowUInt16ArrayBuilder. - */ -GArrowUInt16ArrayBuilder * -garrow_uint16_array_builder_new(void) -{ - auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::make_shared<arrow::UInt16Builder>(memory_pool, arrow::uint16()); - auto builder = - GARROW_UINT16_ARRAY_BUILDER(g_object_new(GARROW_TYPE_UINT16_ARRAY_BUILDER, - "array-builder", &arrow_builder, - NULL)); - return builder; -} - -/** - * garrow_uint16_array_builder_append: - * @builder: A #GArrowUInt16ArrayBuilder. - * @value: An uint16 value. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_uint16_array_builder_append(GArrowUInt16ArrayBuilder *builder, - guint16 value, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::UInt16Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->Append(value); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[uint16-array-builder][append]"); - return FALSE; - } -} - -/** - * garrow_uint16_array_builder_append_null: - * @builder: A #GArrowUInt16ArrayBuilder. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder, - GError **error) -{ - auto arrow_builder = - static_cast<arrow::UInt16Builder *>( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)).get()); - - auto status = arrow_builder->AppendNull(); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[uint16-array-builder][append-null]"); - return FALSE; - } -} - -G_END_DECLS
