UnionType.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_UNIONTYPE_H_
4 #define AWKWARD_UNIONTYPE_H_
5 
6 #include <vector>
7 
8 #include "awkward/common.h"
9 #include "awkward/util.h"
10 #include "awkward/type/Type.h"
11 
12 namespace awkward {
19  public:
27  UnionType(const util::Parameters& parameters,
28  const std::string& typestr,
29  const std::vector<TypePtr>& types);
30 
32  const std::vector<TypePtr>
33  types() const;
34 
36  int64_t
37  numtypes() const;
38 
40  const TypePtr
41  type(int64_t index) const;
42 
43  std::string
44  tostring_part(const std::string& indent,
45  const std::string& pre,
46  const std::string& post) const override;
47 
48  const TypePtr
49  shallow_copy() const override;
50 
51  bool
52  equal(const TypePtr& other, bool check_parameters) const override;
53 
54  int64_t
55  numfields() const override;
56 
57  int64_t
58  fieldindex(const std::string& key) const override;
59 
60  const std::string
61  key(int64_t fieldindex) const override;
62 
63  bool
64  haskey(const std::string& key) const override;
65 
66  const std::vector<std::string>
67  keys() const override;
68 
69  const ContentPtr
70  empty() const override;
71 
72  private:
74  const std::vector<TypePtr> types_;
75  };
76 }
77 
78 #endif // AWKWARD_OPTIONTYPE_H_
#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...
Definition: BitMaskedArray.h:15
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
Describes the high level type of heterogeneous data.
Definition: UnionType.h:18
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::map< std::string, std::string > Parameters
Definition: util.h:165
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...
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< Content > ContentPtr
Definition: ArrayBuilder.h:16