3 #ifndef AWKWARD_CONTENT_H_ 4 #define AWKWARD_CONTENT_H_ 19 using FormKey = std::shared_ptr<std::string>;
44 const std::vector<int64_t>& inner_shape);
46 fromjson(
const std::string& data);
50 Form(
bool has_identities,
67 tojson_part(
ToJson& builder,
bool verbose)
const = 0;
72 shallow_copy()
const = 0;
76 with_form_key(
const FormKey& form_key)
const = 0;
93 bool check_identities,
94 bool check_parameters,
96 bool compatibility_check)
const = 0;
100 form_key_equals(
const FormKey& other_form_key)
const;
105 virtual const std::string
106 purelist_parameter(
const std::string&
key)
const = 0;
124 purelist_isregular()
const = 0;
132 purelist_depth()
const = 0;
137 dimension_optiontype()
const = 0;
148 virtual const std::pair<int64_t, int64_t>
149 minmax_depth()
const = 0;
157 virtual const std::pair<bool, int64_t>
158 branch_depth()
const = 0;
163 numfields()
const = 0;
174 virtual const std::string
180 haskey(
const std::string& key)
const = 0;
184 virtual const std::vector<std::string>
193 virtual const std::string
200 virtual const std::string
201 tojson(
bool pretty,
bool verbose)
const;
206 has_identities()
const;
225 parameter(
const std::string& key)
const;
231 identities_tojson(
ToJson& builder,
bool verbose)
const;
237 parameters_tojson(
ToJson& builder,
bool verbose)
const;
243 form_key_tojson(
ToJson& builder,
bool verbose)
const;
249 getitem_range()
const;
255 getitem_field(
const std::string& key)
const = 0;
261 getitem_fields(
const std::vector<std::string>&
keys)
const = 0;
311 virtual const std::string
312 classname()
const = 0;
357 form(
bool materialize)
const = 0;
369 caches(std::vector<ArrayCachePtr>& out)
const = 0;
377 virtual const std::string
378 tostring_part(
const std::string& indent,
379 const std::string& pre,
380 const std::string& post)
const = 0;
385 tojson_part(
ToJson& builder,
bool include_beginendlist)
const = 0;
397 nbytes_part(std::map<size_t, int64_t>& largest)
const = 0;
408 shallow_copy()
const = 0;
424 deep_copy(
bool copyarrays,
426 bool copyidentities)
const = 0;
431 check_for_iteration()
const = 0;
436 getitem_nothing()
const = 0;
444 getitem_at(int64_t at)
const = 0;
451 getitem_at_nowrap(int64_t at)
const = 0;
465 getitem_range(int64_t start, int64_t stop)
const = 0;
475 getitem_range_nowrap(int64_t start, int64_t stop)
const = 0;
480 getitem_field(
const std::string&
key)
const = 0;
483 getitem_field(
const std::string& key,
484 const Slice& only_fields)
const = 0;
489 getitem_fields(
const std::vector<std::string>&
keys)
const = 0;
492 getitem_fields(
const std::vector<std::string>& keys,
493 const Slice& only_fields)
const = 0;
498 getitem(
const Slice& where)
const;
515 const Index64& advanced)
const;
527 getitem_next_jagged(
const Index64& slicestarts,
530 const Slice& tail)
const;
558 carry(
const Index64& carry,
bool allow_lazy)
const = 0;
563 virtual const std::string
564 purelist_parameter(
const std::string& key)
const;
569 purelist_isregular()
const;
574 dimension_optiontype()
const;
585 purelist_depth()
const = 0;
591 virtual const std::pair<int64_t, int64_t>
592 minmax_depth()
const = 0;
600 virtual const std::pair<bool, int64_t>
601 branch_depth()
const = 0;
606 numfields()
const = 0;
617 virtual const std::string
623 haskey(
const std::string& key)
const = 0;
627 virtual const std::vector<std::string>
636 virtual const std::string
637 validityerror(
const std::string& path)
const = 0;
647 shallow_simplify()
const = 0;
661 num(int64_t axis, int64_t depth)
const = 0;
676 virtual const std::pair<Index64, ContentPtr>
677 offsets_and_flattened(int64_t axis, int64_t depth)
const = 0;
689 mergeable(
const ContentPtr& other,
bool mergebool)
const = 0;
696 referentially_equal(
const ContentPtr& other)
const = 0;
719 virtual const std::pair<ContentPtrVec, ContentPtrVec>
767 rpad(int64_t target, int64_t axis, int64_t depth)
const = 0;
783 rpad_and_clip(int64_t target, int64_t axis, int64_t depth)
const = 0;
815 reduce_next(
const Reducer& reducer,
822 bool keepdims)
const = 0;
844 sort_next(int64_t negaxis,
849 bool stable)
const = 0;
874 argsort_next(int64_t negaxis,
880 bool stable)
const = 0;
897 localindex(int64_t axis, int64_t depth)
const = 0;
970 int64_t depth)
const = 0;
1001 tojson(
bool pretty, int64_t maxdecimals,
1002 const char* nan_string =
nullptr,
1003 const char* infinity_string =
nullptr,
1004 const char* minus_infinity_string =
nullptr,
1005 const char* complex_real_string =
nullptr,
1006 const char* complex_imag_string =
nullptr)
const;
1029 tojson(FILE* destination,
1031 int64_t maxdecimals,
1033 const char* nan_string =
nullptr,
1034 const char* infinity_string =
nullptr,
1035 const char* minus_infinity_string =
nullptr,
1036 const char* complex_real_string =
nullptr,
1037 const char* complex_imag_string =
nullptr)
const;
1062 reduce(
const Reducer& reducer,
1065 bool keepdims)
const;
1080 sort(int64_t axis,
bool ascending,
bool stable)
const;
1096 argsort(int64_t axis,
bool ascending,
bool stable)
const;
1128 parameter(
const std::string& key)
const;
1141 setparameter(
const std::string& key,
const std::string& value);
1192 merge_as_union(
const ContentPtr& other)
const;
1204 rpad_axis0(int64_t target,
bool clip)
const;
1211 localindex_axis0()
const;
1235 combinations_axis0(int64_t n,
1245 getitem_next(
const SliceAt& at,
1247 const Index64& advanced)
const = 0;
1256 const Index64& advanced)
const = 0;
1265 const Index64& advanced)
const;
1274 const Index64& advanced)
const;
1283 const Index64& advanced)
const = 0;
1292 const Index64& advanced)
const;
1301 const Index64& advanced)
const;
1310 const Index64& advanced)
const;
1319 const Index64& advanced)
const = 0;
1326 getitem_next_jagged(
const Index64& slicestarts,
1329 const Slice& tail)
const = 0;
1336 getitem_next_jagged(
const Index64& slicestarts,
1339 const Slice& tail)
const = 0;
1346 getitem_next_jagged(
const Index64& slicestarts,
1349 const Slice& tail)
const = 0;
1366 axis_wrap_if_negative(int64_t axis)
const;
1376 numbers_to_type(
const std::string&
name)
const = 0;
1380 is_unique()
const = 0;
1389 is_subrange_equal(
const Index64& start,
const Index64& stop)
const = 0;
1395 validityerror_parameters(
const std::string& path)
const;
1403 getitem_next_array_wrap(
const ContentPtr& outcontent,
1404 const std::vector<int64_t>& shape)
const;
1414 parameters_tostring(
const std::string& indent,
1415 const std::string& pre,
1416 const std::string& post)
const;
1430 #endif // AWKWARD_CONTENT_H_ Produces a pretty JSON-formatted file.
Definition: json.h:266
Abstract superclass of cache for VirtualArray, defining the interface.
Definition: ArrayCache.h:17
bool parameter_isstring(const Parameters ¶meters, const std::string &key)
Returns true if the parameter associated with key is a string; false otherwise.
const std::string parameter_asstring(const Parameters ¶meters, const std::string &key)
Returns the parameter associated with key as a string if parameter_isstring; raises an error otherwis...
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:276
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
Represents NumPy's newaxis marker (a.k.a. None), which prompts __getitem__ to insert a length-1 regul...
Definition: Slice.h:197
std::string name(Mapping a, V value)
Definition: datetime_util.h:39
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
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.
std::shared_ptr< ArrayCache > ArrayCachePtr
Definition: Content.h:21
Produces a JSON-formatted string.
Definition: json.h:73
util::Parameters parameters_
See parameters.
Definition: Content.h:1426
std::shared_ptr< std::string > FormKey
Definition: Content.h:19
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
IdentitiesPtr identities_
See identities.
Definition: Content.h:1424
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
Produces a pretty JSON-formatted string.
Definition: json.h:137
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's __getitem__.
Definition: Slice.h:585
Represents a Python Ellipsis object (usual syntax: array[...]).
Definition: Slice.h:169
bool parameter_equals(const Parameters ¶meters, const std::string &key, const std::string &value)
Returns true if the value associated with a key in parameters is equal to the specified value...
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
bool parameters_equal(const Parameters &self, const Parameters &other, bool check_all)
Returns true if all key-value pairs in self is equal to all key-value pairs in other.
virtual ~Content()
Empty destructor; required for some C++ reason.
Definition: Content.h:284
bool parameter_isname(const Parameters ¶meters, const std::string &key)
Returns true if the parameter associated with key is a string that matches [A-Za-z_][A-Za-z_0-9]*; fa...
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
Produces a JSON-formatted file.
Definition: json.h:201
std::shared_ptr< SliceItem > SliceItemPtr
Definition: Slice.h:15
lib
Definition: kernel-dispatch.h:20