4141 )
4242)
4343
44- construct <- function (class , xp ) {
45- if (! xptr_is_null(xp )) class $ new(xp )
44+ shared_ptr <- function (class , xp ) {
45+ if (! shared_ptr_is_null(xp )) class $ new(xp )
46+ }
47+
48+ unique_ptr <- function (class , xp ) {
49+ if (! unique_ptr_is_null(xp )) class $ new(xp )
4650}
4751
4852# ' @export
@@ -67,7 +71,7 @@ construct <- function(class, xp) {
6771 DataType__num_children(self )
6872 },
6973 children = function () {
70- map(DataType__children_pointer(self ), construct , class = `arrow::Field` )
74+ map(DataType__children_pointer(self ), shared_ptr , class = `arrow::Field` )
7175 },
7276 id = function (){
7377 DataType__id(self )
@@ -91,23 +95,23 @@ construct <- function(class, xp) {
9195 BINARY = stop(" Type BINARY not implemented yet" ),
9296 DATE32 = date32(),
9397 DATE64 = date64(),
94- TIMESTAMP = construct (`arrow::Timestamp` ,self $ pointer()),
95- TIME32 = construct (`arrow::Time32` ,self $ pointer()),
96- TIME64 = construct (`arrow::Time64` ,self $ pointer()),
98+ TIMESTAMP = shared_ptr (`arrow::Timestamp` ,self $ pointer()),
99+ TIME32 = shared_ptr (`arrow::Time32` ,self $ pointer()),
100+ TIME64 = shared_ptr (`arrow::Time64` ,self $ pointer()),
97101 INTERVAL = stop(" Type INTERVAL not implemented yet" ),
98- DECIMAL = construct (`arrow::Decimal128Type` , self $ pointer()),
99- LIST = construct (`arrow::ListType` , self $ pointer()),
100- STRUCT = construct (`arrow::StructType` , self $ pointer()),
102+ DECIMAL = shared_ptr (`arrow::Decimal128Type` , self $ pointer()),
103+ LIST = shared_ptr (`arrow::ListType` , self $ pointer()),
104+ STRUCT = shared_ptr (`arrow::StructType` , self $ pointer()),
101105 UNION = stop(" Type UNION not implemented yet" ),
102- DICTIONARY = construct (`arrow::DictionaryType` , self $ pointer()),
106+ DICTIONARY = shared_ptr (`arrow::DictionaryType` , self $ pointer()),
103107 MAP = stop(" Type MAP not implemented yet" )
104108 )
105109 }
106110 )
107111)
108112
109113`arrow::DataType` $ dispatch <- function (xp ){
110- construct (`arrow::DataType` , xp )$ ..dispatch()
114+ shared_ptr (`arrow::DataType` , xp )$ ..dispatch()
111115}
112116
113117# ----- metadata
@@ -240,88 +244,88 @@ construct <- function(class, xp) {
240244# '
241245# ' @rdname DataType
242246# ' @export
243- int8 <- function () construct (`arrow::Int8` , Int8__initialize())
247+ int8 <- function () shared_ptr (`arrow::Int8` , Int8__initialize())
244248
245249# ' @rdname DataType
246250# ' @export
247- int16 <- function () construct (`arrow::Int16` , Int16__initialize())
251+ int16 <- function () shared_ptr (`arrow::Int16` , Int16__initialize())
248252
249253# ' @rdname DataType
250254# ' @export
251- int32 <- function () construct (`arrow::Int32` , Int32__initialize())
255+ int32 <- function () shared_ptr (`arrow::Int32` , Int32__initialize())
252256
253257# ' @rdname DataType
254258# ' @export
255- int64 <- function () construct (`arrow::Int64` , Int64__initialize())
259+ int64 <- function () shared_ptr (`arrow::Int64` , Int64__initialize())
256260
257261# ' @rdname DataType
258262# ' @export
259- uint8 <- function () construct (`arrow::UInt8` , UInt8__initialize())
263+ uint8 <- function () shared_ptr (`arrow::UInt8` , UInt8__initialize())
260264
261265# ' @rdname DataType
262266# ' @export
263- uint16 <- function () construct (`arrow::UInt16` , UInt16__initialize())
267+ uint16 <- function () shared_ptr (`arrow::UInt16` , UInt16__initialize())
264268
265269# ' @rdname DataType
266270# ' @export
267- uint32 <- function () construct (`arrow::UInt32` , UInt32__initialize())
271+ uint32 <- function () shared_ptr (`arrow::UInt32` , UInt32__initialize())
268272
269273# ' @rdname DataType
270274# ' @export
271- uint64 <- function () construct (`arrow::UInt64` , UInt64__initialize())
275+ uint64 <- function () shared_ptr (`arrow::UInt64` , UInt64__initialize())
272276
273277# ' @rdname DataType
274278# ' @export
275- float16 <- function () construct (`arrow::Float16` , Float16__initialize())
279+ float16 <- function () shared_ptr (`arrow::Float16` , Float16__initialize())
276280
277281# ' @rdname DataType
278282# ' @export
279- float32 <- function () construct (`arrow::Float32` , Float32__initialize())
283+ float32 <- function () shared_ptr (`arrow::Float32` , Float32__initialize())
280284
281285# ' @rdname DataType
282286# ' @export
283- float64 <- function () construct (`arrow::Float64` , Float64__initialize())
287+ float64 <- function () shared_ptr (`arrow::Float64` , Float64__initialize())
284288
285289# ' @rdname DataType
286290# ' @export
287- boolean <- function () construct (`arrow::Boolean` , Boolean__initialize())
291+ boolean <- function () shared_ptr (`arrow::Boolean` , Boolean__initialize())
288292
289293# ' @rdname DataType
290294# ' @export
291- utf8 <- function () construct (`arrow::Utf8` , Utf8__initialize())
295+ utf8 <- function () shared_ptr (`arrow::Utf8` , Utf8__initialize())
292296
293297# ' @rdname DataType
294298# ' @export
295- date32 <- function () construct (`arrow::Date32` , Date32__initialize())
299+ date32 <- function () shared_ptr (`arrow::Date32` , Date32__initialize())
296300
297301# ' @rdname DataType
298302# ' @export
299- date64 <- function () construct (`arrow::Date64` , Date64__initialize())
303+ date64 <- function () shared_ptr (`arrow::Date64` , Date64__initialize())
300304
301305# ' @rdname DataType
302306# ' @export
303- time32 <- function (unit ) construct (`arrow::Time32` , Time32__initialize(unit ))
307+ time32 <- function (unit ) shared_ptr (`arrow::Time32` , Time32__initialize(unit ))
304308
305309# ' @rdname DataType
306310# ' @export
307- time64 <- function (unit ) construct (`arrow::Time64` , Time64__initialize(unit ))
311+ time64 <- function (unit ) shared_ptr (`arrow::Time64` , Time64__initialize(unit ))
308312
309313# ' @rdname DataType
310314# ' @export
311- null <- function () construct (`arrow::Null` , Null__initialize())
315+ null <- function () shared_ptr (`arrow::Null` , Null__initialize())
312316
313317# ' @rdname DataType
314318# ' @export
315319timestamp <- function (unit , timezone ) {
316320 if (missing(timezone )) {
317- construct (`arrow::Timestamp` , Timestamp__initialize1(unit ))
321+ shared_ptr (`arrow::Timestamp` , Timestamp__initialize1(unit ))
318322 } else {
319- construct (`arrow::Timestamp` , Timestamp__initialize2(unit , timezone ))
323+ shared_ptr (`arrow::Timestamp` , Timestamp__initialize2(unit , timezone ))
320324 }
321325}
322326
323327# ' @rdname DataType
324328# ' @export
325- decimal <- function (precision , scale ) construct (`arrow::Decimal128Type` , Decimal128Type__initialize(precision , scale ))
329+ decimal <- function (precision , scale ) shared_ptr (`arrow::Decimal128Type` , Decimal128Type__initialize(precision , scale ))
326330
327331`arrow::NestedType` <- R6Class(" arrow::NestedType" , inherit = `arrow::DataType` )
0 commit comments