Awkward Array: include/awkward/type/UnionType.h Source File

Loading...
Searching...
No Matches
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
12namespace awkward {
18 class LIBAWKWARD_EXPORT_SYMBOL UnionType: public Type {
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_
Type.h
awkward::Type
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
awkward::UnionType
Describes the high level type of heterogeneous data.
Definition: UnionType.h:18
awkward::UnionType::types
const std::vector< TypePtr > types() const
The Type of each possibility.
awkward::UnionType::tostring_part
std::string tostring_part(const std::string &indent, const std::string &pre, const std::string &post) const override
Internal function to build an output string for tostring.
awkward::UnionType::numtypes
int64_t numtypes() const
The number of possible types.
awkward::UnionType::shallow_copy
const TypePtr shallow_copy() const override
Copies this Type without copying any hierarchically nested types.
awkward::UnionType::UnionType
UnionType(const util::Parameters &parameters, const std::string &typestr, const std::vector< TypePtr > &types)
Create an UnionArray with a full set of parameters.
awkward::UnionType::type
const TypePtr type(int64_t index) const
Returns the type at a given index.
awkward::UnionType::fieldindex
int64_t fieldindex(const std::string &key) const override
The position of a tuple or record key name if this array contains a RecordType.
awkward::UnionType::empty
const ContentPtr empty() const override
Returns an empty array (Content) with this type.
awkward::UnionType::keys
const std::vector< std::string > keys() const override
A list of RecordType keys or an empty list if this type does not contain a RecordType.
awkward::UnionType::key
const std::string key(int64_t fieldindex) const override
The record name associated with a given field index or the tuple index as a string (e....
awkward::UnionType::numfields
int64_t numfields() const override
The number of fields in the first nested tuple or records or -1 if this array does not contain a Reco...
awkward::UnionType::haskey
bool haskey(const std::string &key) const override
Returns true if the type contains a RecordType with the specified key; false otherwise.
awkward::UnionType::equal
bool equal(const TypePtr &other, bool check_parameters) const override
Returns true if this type is equal to other; false otherwise.
common.h
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward::util::Parameters
std::map< std::string, std::string > Parameters
Definition: util.h:165
awkward
Definition: BitMaskedArray.h:15
awkward::ContentPtr
std::shared_ptr< Content > ContentPtr
Definition: Content.h:15
awkward::TypePtr
std::shared_ptr< Type > TypePtr
Definition: Content.h:23
util.h