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

Loading...
Searching...
No Matches
RecordType.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_RECORDTYPE_H_
4#define AWKWARD_RECORDTYPE_H_
5
6#include <vector>
7#include <string>
8
9#include "awkward/common.h"
10#include "awkward/util.h"
11#include "awkward/type/Type.h"
12
13namespace awkward {
20 class LIBAWKWARD_EXPORT_SYMBOL RecordType: public Type {
21 public:
33 RecordType(const util::Parameters& parameters,
34 const std::string& typestr,
35 const std::vector<TypePtr>& types,
36 const util::RecordLookupPtr& recordlookup);
37
42 RecordType(const util::Parameters& parameters,
43 const std::string& typestr,
44 const std::vector<TypePtr>& types);
45
47 const std::vector<TypePtr>
48 types() const;
49
55 const util::RecordLookupPtr
56 recordlookup() const;
57
59 bool
60 istuple() const;
61
62 std::string
63 tostring_part(const std::string& indent,
64 const std::string& pre,
65 const std::string& post) const override;
66
67 const TypePtr
68 shallow_copy() const override;
69
70 bool
71 equal(const TypePtr& other, bool check_parameters) const override;
72
73 int64_t
74 numfields() const override;
75
76 int64_t
77 fieldindex(const std::string& key) const override;
78
79 const std::string
80 key(int64_t fieldindex) const override;
81
82 bool
83 haskey(const std::string& key) const override;
84
85 const std::vector<std::string>
86 keys() const override;
87
88 const ContentPtr
89 empty() const override;
90
94 const TypePtr
95 field(int64_t fieldindex) const;
96
100 const TypePtr
101 field(const std::string& key) const;
102
106 const std::vector<TypePtr>
107 fields() const;
108
110 const std::vector<std::pair<std::string, TypePtr>>
111 fielditems() const;
112
115 const TypePtr
116 astuple() const;
117
118 private:
120 const std::vector<TypePtr> types_;
122 const util::RecordLookupPtr recordlookup_;
123 };
124}
125
126#endif // AWKWARD_RECORDTYPE_H_
Type.h
awkward::RecordType
Describes the high level type of data containing tuples or records.
Definition: RecordType.h:20
awkward::RecordType::types
const std::vector< TypePtr > types() const
The Type of each field (in order).
awkward::RecordType::field
const TypePtr field(int64_t fieldindex) const
Returns the field at a given index.
awkward::RecordType::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::RecordType::fielditems
const std::vector< std::pair< std::string, TypePtr > > fielditems() const
Returns key, field pairs for all fields.
awkward::RecordType::shallow_copy
const TypePtr shallow_copy() const override
Copies this Type without copying any hierarchically nested types.
awkward::RecordType::fields
const std::vector< TypePtr > fields() const
Returns all the fields.
awkward::RecordType::recordlookup
const util::RecordLookupPtr recordlookup() const
A std::shared_ptr<std::vector<std::string>> optional list of key names.
awkward::RecordType::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::RecordType::empty
const ContentPtr empty() const override
Returns an empty array (Content) with this type.
awkward::RecordType::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::RecordType::RecordType
RecordType(const util::Parameters &parameters, const std::string &typestr, const std::vector< TypePtr > &types, const util::RecordLookupPtr &recordlookup)
Create an RecordArray with a full set of parameters.
awkward::RecordType::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::RecordType::astuple
const TypePtr astuple() const
Returns this RecordType without recordlookup, converting any records into tuples.
awkward::RecordType::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::RecordType::RecordType
RecordType(const util::Parameters &parameters, const std::string &typestr, const std::vector< TypePtr > &types)
Creates a RecordArray without a recordlookup (set it to nullptr).
awkward::RecordType::istuple
bool istuple() const
Returns true if recordlookup is nullptr; false otherwise.
awkward::RecordType::haskey
bool haskey(const std::string &key) const override
Returns true if the type contains a RecordType with the specified key; false otherwise.
awkward::RecordType::equal
bool equal(const TypePtr &other, bool check_parameters) const override
Returns true if this type is equal to other; false otherwise.
awkward::RecordType::field
const TypePtr field(const std::string &key) const
Returns the field with a given key name.
awkward::Type
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
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::util::RecordLookupPtr
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:130
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