MCPcopy Create free account
hub / github.com/apache/arrow / BuilderPtr

Class BuilderPtr

cpp/src/arrow/json/parser.cc:137–165  ·  view source on GitHub ↗

\brief packed pointer to a RawArrayBuilder RawArrayBuilders are stored in HandlerBase, which allows storage of their indices (uint32_t) instead of a full pointer. BuilderPtr is also tagged with the json kind and nullable properties so those can be accessed before dereferencing the builder.

Source from the content-addressed store, hash-verified

135/// BuilderPtr is also tagged with the json kind and nullable properties
136/// so those can be accessed before dereferencing the builder.
137struct BuilderPtr {
138 BuilderPtr() : BuilderPtr(BuilderPtr::null) {}
139 BuilderPtr(Kind::type k, uint32_t i, bool n) : index(i), kind(k), nullable(n) {}
140
141 BuilderPtr(const BuilderPtr&) = default;
142 BuilderPtr& operator=(const BuilderPtr&) = default;
143 BuilderPtr(BuilderPtr&&) = default;
144 BuilderPtr& operator=(BuilderPtr&&) = default;
145
146 // index of builder in its arena
147 // OR the length of that builder if kind == Kind::kNull
148 // (we don't allocate an arena for nulls since they're trivial)
149 uint32_t index;
150 Kind::type kind;
151 bool nullable;
152
153 bool operator==(BuilderPtr other) const {
154 return kind == other.kind && index == other.index;
155 }
156
157 bool operator!=(BuilderPtr other) const { return !(other == *this); }
158
159 operator bool() const { return *this != null; }
160
161 bool operator!() const { return *this == null; }
162
163 // The static BuilderPtr for null type data
164 static const BuilderPtr null;
165};
166
167const BuilderPtr BuilderPtr::null(Kind::kNull, 0, true);
168

Callers 2

MakeBuilderMethod · 0.85
KeyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected