Record.h
Go to the documentation of this file.
1 // BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2 
3 #ifndef AWKWARD_RECORD_H_
4 #define AWKWARD_RECORD_H_
5 
6 #include "awkward/common.h"
8 
9 namespace awkward {
17  public:
24  Record(const std::shared_ptr<const RecordArray> array, int64_t at);
25 
28  const std::shared_ptr<const RecordArray>
29  array() const;
30 
33  int64_t
34  at() const;
35 
41  const ContentPtrVec
42  contents() const;
43 
47  recordlookup() const;
48 
50  bool
51  istuple() const;
52 
56  bool
57  isscalar() const override;
58 
60  const std::string
61  classname() const override;
62 
63  const IdentitiesPtr
64  identities() const override;
65 
67  void
68  setidentities() override;
69 
71  void
72  setidentities(const IdentitiesPtr& identities) override;
73 
74  const TypePtr
75  type(const util::TypeStrs& typestrs) const override;
76 
77  const FormPtr
78  form(bool materialize) const override;
79 
81  kernels() const override;
82 
83  void
84  caches(std::vector<ArrayCachePtr>& out) const override;
85 
86  const std::string
87  tostring_part(const std::string& indent,
88  const std::string& pre,
89  const std::string& post) const override;
90 
91  void
92  tojson_part(ToJson& builder, bool include_beginendlist) const override;
93 
94  void
95  nbytes_part(std::map<size_t, int64_t>& largest) const override;
96 
97  int64_t
98  length() const override;
99 
100  const ContentPtr
101  shallow_copy() const override;
102 
103  const ContentPtr
104  deep_copy(bool copyarrays,
105  bool copyindexes,
106  bool copyidentities) const override;
107 
108  void
109  check_for_iteration() const override;
110 
112  const ContentPtr
113  getitem_nothing() const override;
114 
116  const ContentPtr
117  getitem_at(int64_t at) const override;
118 
120  const ContentPtr
121  getitem_at_nowrap(int64_t at) const override;
122 
124  const ContentPtr
125  getitem_range(int64_t start, int64_t stop) const override;
126 
128  const ContentPtr
129  getitem_range_nowrap(int64_t start, int64_t stop) const override;
130 
131  const ContentPtr
132  getitem_field(const std::string& key) const override;
133 
134  const ContentPtr
135  getitem_field(const std::string& key,
136  const Slice& only_fields) const override;
137 
138  const ContentPtr
139  getitem_fields(const std::vector<std::string>& keys) const override;
140 
141  const ContentPtr
142  getitem_fields(const std::vector<std::string>& keys,
143  const Slice& only_fields) const override;
144 
146  const ContentPtr
147  carry(const Index64& carry, bool allow_lazy) const override;
148 
149  bool
150  dimension_optiontype() const override;
151 
152  int64_t
153  purelist_depth() const override;
154 
155  const std::pair<int64_t, int64_t>
156  minmax_depth() const override;
157 
158  const std::pair<bool, int64_t>
159  branch_depth() const override;
160 
161  int64_t
162  numfields() const override;
163 
164  int64_t
165  fieldindex(const std::string& key) const override;
166 
167  const std::string
168  key(int64_t fieldindex) const override;
169 
170  bool
171  haskey(const std::string& key) const override;
172 
173  const std::vector<std::string>
174  keys() const override;
175 
176  // operations
177  const std::string
178  validityerror(const std::string& path) const override;
179 
181  const ContentPtr
182  shallow_simplify() const override;
183 
184  const ContentPtr
185  num(int64_t axis, int64_t depth) const override;
186 
188  const std::pair<Index64, ContentPtr>
189  offsets_and_flattened(int64_t axis, int64_t depth) const override;
190 
192  bool
193  mergeable(const ContentPtr& other, bool mergebool) const override;
194 
195  bool
196  referentially_equal(const ContentPtr& other) const override;
197 
199  const ContentPtr
200  mergemany(const ContentPtrVec& others) const override;
201 
203  const SliceItemPtr
204  asslice() const override;
205 
206  const ContentPtr
207  fillna(const ContentPtr& value) const override;
208 
210  const ContentPtr
211  rpad(int64_t target, int64_t axis, int64_t depth) const override;
212 
214  const ContentPtr
215  rpad_and_clip(int64_t target,
216  int64_t axis,
217  int64_t depth) const override;
218 
219  const ContentPtr
220  reduce_next(const Reducer& reducer,
221  int64_t negaxis,
222  const Index64& starts,
223  const Index64& shifts,
224  const Index64& parents,
225  int64_t outlength,
226  bool mask,
227  bool keepdims) const override;
228 
229  const ContentPtr
230  sort_next(int64_t negaxis,
231  const Index64& starts,
232  const Index64& parents,
233  int64_t outlength,
234  bool ascending,
235  bool stable) const override;
236 
237  const ContentPtr
238  argsort_next(int64_t negaxis,
239  const Index64& starts,
240  const Index64& shifts,
241  const Index64& parents,
242  int64_t outlength,
243  bool ascending,
244  bool stable) const override;
245 
246  const ContentPtr
247  localindex(int64_t axis, int64_t depth) const override;
248 
249  const ContentPtr
250  combinations(int64_t n,
251  bool replacement,
252  const util::RecordLookupPtr& recordlookup,
253  const util::Parameters& parameters,
254  int64_t axis,
255  int64_t depth) const override;
256 
260  const ContentPtr
261  field(int64_t fieldindex) const;
262 
266  const ContentPtr
267  field(const std::string& key) const;
268 
272  const ContentPtrVec
273  fields() const;
274 
276  const std::vector<std::pair<std::string, ContentPtr>>
277  fielditems() const;
278 
281  const std::shared_ptr<Record>
282  astuple() const;
283 
284  const ContentPtr
285  getitem(const Slice& where) const override;
286 
288  const ContentPtr
289  getitem_next(const SliceAt& at,
290  const Slice& tail,
291  const Index64& advanced) const override;
292 
294  const ContentPtr
295  getitem_next(const SliceRange& range,
296  const Slice& tail,
297  const Index64& advanced) const override;
298 
300  const ContentPtr
301  getitem_next(const SliceArray64& array,
302  const Slice& tail,
303  const Index64& advanced) const override;
304 
306  const ContentPtr
307  getitem_next(const SliceField& field,
308  const Slice& tail,
309  const Index64& advanced) const override;
310 
312  const ContentPtr
313  getitem_next(const SliceFields& fields,
314  const Slice& tail,
315  const Index64& advanced) const override;
316 
318  const ContentPtr
319  getitem_next(const SliceJagged64& jagged,
320  const Slice& tail,
321  const Index64& advanced) const override;
322 
324  const ContentPtr
325  getitem_next_jagged(const Index64& slicestarts,
326  const Index64& slicestops,
327  const SliceArray64& slicecontent,
328  const Slice& tail) const override;
329 
331  const ContentPtr
332  getitem_next_jagged(const Index64& slicestarts,
333  const Index64& slicestops,
334  const SliceMissing64& slicecontent,
335  const Slice& tail) const override;
336 
338  const ContentPtr
339  getitem_next_jagged(const Index64& slicestarts,
340  const Index64& slicestops,
341  const SliceJagged64& slicecontent,
342  const Slice& tail) const override;
343 
344  const ContentPtr
345  copy_to(kernel::lib ptr_lib) const override;
346 
347  const ContentPtr
348  numbers_to_type(const std::string& name) const override;
349 
351  bool
352  is_unique() const override;
353 
355  const ContentPtr
356  unique() const override;
357 
359  bool
360  is_subrange_equal(const Index64& start, const Index64& stop) const override;
361 
362  private:
364  const std::shared_ptr<const RecordArray> array_;
366  int64_t at_;
367  };
368 }
369 
370 #endif // AWKWARD_RECORD_H_
Represents a tuple or record, a scalar value from RecordArray.
Definition: Record.h:16
Represents a Python slice object (usual syntax: array[start:stop:step]).
Definition: Slice.h:93
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
const std::string key(const RecordLookupPtr &recordlookup, int64_t fieldindex, int64_t numfields)
Returns the key associated with a field index, given a RecordLookup and a number of fields...
Abstract superclass of all array node types (flat hierarchy). Any Content can be nested within any ot...
Definition: Content.h:272
Definition: json.h:20
Definition: BitMaskedArray.h:15
A contiguous, one-dimensional array of integers used to represent data structures, rather than numerical data in the arrays themselves.
Definition: Index.h:16
std::string name(Mapping a, V value)
Definition: datetime_util.h:39
Definition: Slice.h:384
Represents a SliceArrayOf, SliceMissingOf, or SliceJaggedOf with missing values: None (no equivalent ...
Definition: Slice.h:431
Represents a single string in a slice tuple, indicating that a RecordArray should be replaced by one ...
Definition: Slice.h:340
Abstract class for all reducer algorithms.
Definition: Reducer.h:20
ERROR combinations(kernel::lib ptr_lib, T *toindex, int64_t n, bool replacement, int64_t singlelen)
const std::vector< std::string > keys(const RecordLookupPtr &recordlookup, int64_t numfields)
Returns a given RecordLookup as keys or generate anonymous ones form a number of fields.
ERROR unique(kernel::lib ptr_lib, T *toptr, int64_t length, int64_t *tolength)
Represents an array of integers in a slice (possibly converted from an array of booleans).
Definition: Slice.h:225
std::map< std::string, std::string > Parameters
Definition: util.h:165
ERROR copy_to(kernel::lib to_lib, kernel::lib from_lib, void *to_ptr, void *from_ptr, int64_t bytelength)
Internal Function an array buffer from library FROM to library TO, usually between main memory and a ...
std::shared_ptr< Form > FormPtr
Definition: Content.h:18
int64_t fieldindex(const RecordLookupPtr &recordlookup, const std::string &key, int64_t numfields)
Returns the field index associated with a key, given a RecordLookup and a number of fields...
Represents an array of nested lists, where the content may be SliceArrayOf, SliceMissingOf, or SliceJaggedOf (no equivalent in NumPy).
Definition: Slice.h:511
std::vector< std::shared_ptr< Content > > ContentPtrVec
Definition: Content.h:16
Mapping::value_type::value_type value(Mapping a, const std::string &name)
Definition: datetime_util.h:49
A sequence of SliceItem objects representing a tuple passed to Python&#39;s __getitem__.
Definition: Slice.h:585
bool haskey(const RecordLookupPtr &recordlookup, const std::string &key, int64_t numfields)
Returns true if a RecordLookup has a given key; false otherwise.
std::shared_ptr< Type > TypePtr
Definition: Content.h:23
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:130
Represents an integer in a tuple of slices passed to __getitem__ in Python.
Definition: Slice.h:58
std::map< std::string, std::string > TypeStrs
Definition: util.h:215
std::shared_ptr< Identities > IdentitiesPtr
Definition: Identities.h:16
std::shared_ptr< Content > ContentPtr
Definition: ArrayBuilder.h:16
std::shared_ptr< SliceItem > SliceItemPtr
Definition: Slice.h:15
lib
Definition: kernel-dispatch.h:20