3#ifndef AWKWARD_RECORDTYPE_H_
4#define AWKWARD_RECORDTYPE_H_
34 const std::string& typestr,
35 const std::vector<TypePtr>& types,
43 const std::string& typestr,
44 const std::vector<TypePtr>& types);
47 const std::vector<TypePtr>
64 const std::string& pre,
65 const std::string& post)
const override;
80 key(int64_t fieldindex)
const override;
83 haskey(
const std::string& key)
const override;
85 const std::vector<std::string>
95 field(int64_t fieldindex)
const;
101 field(
const std::string& key)
const;
106 const std::vector<TypePtr>
110 const std::vector<std::pair<std::string, TypePtr>>
120 const std::vector<TypePtr> types_;
Describes the high level type of data containing tuples or records.
Definition: RecordType.h:20
const std::vector< TypePtr > types() const
The Type of each field (in order).
const TypePtr field(int64_t fieldindex) const
Returns the field at a given index.
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.
const std::vector< std::pair< std::string, TypePtr > > fielditems() const
Returns key, field pairs for all fields.
const TypePtr shallow_copy() const override
Copies this Type without copying any hierarchically nested types.
const std::vector< TypePtr > fields() const
Returns all the fields.
const util::RecordLookupPtr recordlookup() const
A std::shared_ptr<std::vector<std::string>> optional list of key names.
int64_t fieldindex(const std::string &key) const override
The position of a tuple or record key name if this array contains a RecordType.
const ContentPtr empty() const override
Returns an empty array (Content) with this type.
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.
RecordType(const util::Parameters ¶meters, const std::string &typestr, const std::vector< TypePtr > &types, const util::RecordLookupPtr &recordlookup)
Create an RecordArray with a full set of parameters.
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....
const TypePtr astuple() const
Returns this RecordType without recordlookup, converting any records into tuples.
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...
RecordType(const util::Parameters ¶meters, const std::string &typestr, const std::vector< TypePtr > &types)
Creates a RecordArray without a recordlookup (set it to nullptr).
bool istuple() const
Returns true if recordlookup is nullptr; false otherwise.
bool haskey(const std::string &key) const override
Returns true if the type contains a RecordType with the specified key; false otherwise.
bool equal(const TypePtr &other, bool check_parameters) const override
Returns true if this type is equal to other; false otherwise.
const TypePtr field(const std::string &key) const
Returns the field with a given key name.
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
std::map< std::string, std::string > Parameters
Definition: util.h:165
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:130
Definition: BitMaskedArray.h:15
std::shared_ptr< Content > ContentPtr
Definition: Content.h:15
std::shared_ptr< Type > TypePtr
Definition: Content.h:23