Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions matlab/src/cpp/arrow/matlab/proxy/factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ namespace arrow::matlab::proxy {

std::shared_ptr<Proxy> Factory::make_proxy(const ClassName& class_name, const FunctionArguments& constructor_arguments) {

// Register MATLAB Proxy classes for unsigned integer arrays
REGISTER_PROXY(arrow.array.proxy.UInt8Array, arrow::matlab::array::proxy::NumericArray<uint8_t>);
REGISTER_PROXY(arrow.array.proxy.UInt16Array, arrow::matlab::array::proxy::NumericArray<uint16_t>);
REGISTER_PROXY(arrow.array.proxy.UInt32Array, arrow::matlab::array::proxy::NumericArray<uint32_t>);
REGISTER_PROXY(arrow.array.proxy.UInt64Array, arrow::matlab::array::proxy::NumericArray<uint64_t>);

// Register MATLAB Proxy classes with corresponding C++ Proxy classes.
REGISTER_PROXY(arrow.array.proxy.Float32Array, arrow::matlab::array::proxy::NumericArray<float>);
REGISTER_PROXY(arrow.array.proxy.Float64Array, arrow::matlab::array::proxy::NumericArray<double>);
Expand Down
40 changes: 40 additions & 0 deletions matlab/src/matlab/+arrow/+array/UInt16Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
classdef UInt16Array < arrow.array.Array
% arrow.array.UInt16Array

% 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.

properties (Hidden, SetAccess=private)
MatlabArray = uint16([])
end

methods
function obj = UInt16Array(data, opts)
arguments
data
opts.DeepCopy = false
end
validateattributes(data, "uint16", ["2d", "nonsparse", "real"]);
if ~isempty(data), validateattributes(data, "uint16", "vector"); end
obj@arrow.array.Array("Name", "arrow.array.proxy.UInt16Array", "ConstructorArguments", {data, opts.DeepCopy});
% Store a reference to the array if not doing a deep copy
if (~opts.DeepCopy), obj.MatlabArray = data; end
end

function data = uint16(obj)
data = obj.Proxy.toMATLAB();
end
end
end
40 changes: 40 additions & 0 deletions matlab/src/matlab/+arrow/+array/UInt32Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
classdef UInt32Array < arrow.array.Array
% arrow.array.UInt32Array

% 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.

properties (Hidden, SetAccess=private)
MatlabArray = uint32([])
end

methods
function obj = UInt32Array(data, opts)
arguments
data
opts.DeepCopy = false
end
validateattributes(data, "uint32", ["2d", "nonsparse", "real"]);
if ~isempty(data), validateattributes(data, "uint32", "vector"); end
obj@arrow.array.Array("Name", "arrow.array.proxy.UInt32Array", "ConstructorArguments", {data, opts.DeepCopy});
% Store a reference to the array if not doing a deep copy
if (~opts.DeepCopy), obj.MatlabArray = data; end
end

function data = uint32(obj)
data = obj.Proxy.toMATLAB();
end
end
end
40 changes: 40 additions & 0 deletions matlab/src/matlab/+arrow/+array/UInt64Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
classdef UInt64Array < arrow.array.Array
% arrow.array.UInt64Array

% 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.

properties (Hidden, SetAccess=private)
MatlabArray = uint64([])
end

methods
function obj = UInt64Array(data, opts)
arguments
data
opts.DeepCopy = false
end
validateattributes(data, "uint64", ["2d", "nonsparse", "real"]);
if ~isempty(data), validateattributes(data, "uint64", "vector"); end
obj@arrow.array.Array("Name", "arrow.array.proxy.UInt64Array", "ConstructorArguments", {data, opts.DeepCopy});
% Store a reference to the array if not doing a deep copy
if (~opts.DeepCopy), obj.MatlabArray = data; end
end

function data = uint64(obj)
data = obj.Proxy.toMATLAB();
end
end
end
40 changes: 40 additions & 0 deletions matlab/src/matlab/+arrow/+array/UInt8Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
classdef UInt8Array < arrow.array.Array
% arrow.array.UInt8Array

% 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.

properties (Hidden, SetAccess=private)
MatlabArray = uint8([])
end

methods
function obj = UInt8Array(data, opts)
arguments
data
opts.DeepCopy = false
end
validateattributes(data, "uint8", ["2d", "nonsparse", "real"]);
if ~isempty(data), validateattributes(data, "uint8", "vector"); end
obj@arrow.array.Array("Name", "arrow.array.proxy.UInt8Array", "ConstructorArguments", {data, opts.DeepCopy});
% Store a reference to the array if not doing a deep copy
if (~opts.DeepCopy), obj.MatlabArray = data; end
end

function data = uint8(obj)
data = obj.Proxy.toMATLAB();
end
end
end
27 changes: 27 additions & 0 deletions matlab/test/arrow/array/tUInt16Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef tUInt16Array < hNumericArray
% Tests for arrow.array.UInt16Array

% 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.

properties
ArrowArrayClassName = "arrow.array.UInt16Array"
ArrowArrayConstructor = @arrow.array.UInt16Array
MatlabConversionFcn = @uint16 % uint16 method on class
MatlabArrayFcn = @uint16 % uint16 function
MaxValue = intmax("uint16")
MinValue = intmin("uint16")
end
end
27 changes: 27 additions & 0 deletions matlab/test/arrow/array/tUInt32Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef tUInt32Array < hNumericArray
% Tests for arrow.array.UInt32Array

% 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.

properties
ArrowArrayClassName = "arrow.array.UInt32Array"
ArrowArrayConstructor = @arrow.array.UInt32Array
MatlabConversionFcn = @uint32 % uint32 method on class
MatlabArrayFcn = @uint32 % uint32 function
MaxValue = intmax("uint32")
MinValue = intmin("uint32")
end
end
27 changes: 27 additions & 0 deletions matlab/test/arrow/array/tUInt64Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef tUInt64Array < hNumericArray
% Tests for arrow.array.UInt64Array

% 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.

properties
ArrowArrayClassName = "arrow.array.UInt64Array"
ArrowArrayConstructor = @arrow.array.UInt64Array
MatlabConversionFcn = @uint64 % uint64 method on class
MatlabArrayFcn = @uint64 % uint64 function
MaxValue = intmax("uint64")
MinValue = intmin("uint64")
end
end
27 changes: 27 additions & 0 deletions matlab/test/arrow/array/tUInt8Array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef tUInt8Array < hNumericArray
% Tests for arrow.array.UInt8Array

% 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.

properties
ArrowArrayClassName = "arrow.array.UInt8Array"
ArrowArrayConstructor = @arrow.array.UInt8Array
MatlabConversionFcn = @uint8 % uint8 method on class
MatlabArrayFcn = @uint8 % uint8 function
MaxValue = intmax("uint8")
MinValue = intmin("uint8")
end
end