IndexedForm Class Reference

Form describing IndexedArray (with OPTION = false). More...

#include <IndexedArray.h>

Inheritance diagram for IndexedForm:
Form

Public Member Functions

 IndexedForm (bool has_identities, const util::Parameters &parameters, const FormKey &form_key, Index::Form index, const FormPtr &content)
 Creates a IndexedForm. See IndexedArray for documentation. More...
 
Index::Form index () const
 
const FormPtr content () const
 
const TypePtr type (const util::TypeStrs &typestrs) const override
 High-level Type describing this Form. More...
 
void tojson_part (ToJson &builder, bool verbose) const override
 Internal function to produce a JSON representation one node at a time. More...
 
const FormPtr shallow_copy () const override
 Copies this node without copying any nodes hierarchically nested within it. More...
 
const FormPtr with_form_key (const FormKey &form_key) const override
 Copies this node, adding or replacing a form_key. More...
 
const std::string purelist_parameter (const std::string &key) const override
 The parameter associated with key at the first level that has a non-null value, descending only as deep as the first RecordForm. More...
 
bool purelist_isregular () const override
 Returns true if all nested lists down to the first RecordForm are RegularForm nodes; false otherwise. More...
 
int64_t purelist_depth () const override
 The list-depth of this array, not counting any contained within a RecordForm. More...
 
bool dimension_optiontype () const override
 Returns true if this dimension has option-type; false otherwise. More...
 
const std::pair< int64_t, int64_t > minmax_depth () const override
 Returns (a) the minimum list-depth and (b) the maximum list-depth of the array, which can differ if this array "branches" (differs when followed through different fields of a RecordForm or UnionForm). More...
 
const std::pair< bool, int64_t > branch_depth () const override
 Returns (a) whether the list-depth of this array "branches," or differs when followed through different fields of a RecordForm or UnionForm and (b) the minimum list-depth. More...
 
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 RecordForm. More...
 
int64_t fieldindex (const std::string &key) const override
 The position of a tuple or record key name if this array contains a RecordForm. More...
 
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.g. "0", "1", "2") if a tuple. More...
 
bool haskey (const std::string &key) const override
 Returns true if the array contains a RecordForm with the specified key; false otherwise. More...
 
const std::vector< std::string > keys () const override
 A list of RecordArray keys or an empty list if this array does not contain a RecordArray. More...
 
bool istuple () const override
 Returns true if the outermost RecordArray is a tuple. More...
 
bool equal (const FormPtr &other, bool check_identities, bool check_parameters, bool check_form_key, bool compatibility_check) const override
 Returns true if this Form is equal to the other Form; false otherwise. More...
 
const FormPtr getitem_field (const std::string &key) const override
 Returns the Form that would result from a field-slice. More...
 
const FormPtr getitem_fields (const std::vector< std::string > &keys) const override
 Returns the Form that would result from a fields-slice. More...
 
const FormPtr simplify_optiontype () const
 
- Public Member Functions inherited from Form
 Form (bool has_identities, const util::Parameters &parameters, const FormKey &form_key)
 Called by subclass constructors; assigns has_identities, parameters, and form_key upon construction. More...
 
virtual ~Form ()
 Empty destructor; required for some C++ reason. More...
 
bool form_key_equals (const FormKey &other_form_key) const
 Returns true if this Form has the same form_key as the other. More...
 
bool parameter_equals (const std::string &key, const std::string &value) const
 Returns true if the parameter associated with key exists and is equal to value; false otherwise. More...
 
const FormKey form_key () const
 An optional string associated with this Form, usually specifying where an array may be fetched. More...
 
virtual const std::string tostring () const
 Returns a string representation of this Form (tojson with pretty = true and verbose = false). More...
 
virtual const std::string tojson (bool pretty, bool verbose) const
 Returns a JSON representation of this array. More...
 
bool has_identities () const
 Returns true if the corresponding array has associated Identities. More...
 
const util::Parameters parameters () const
 String-to-JSON map that augments the meaning of this Form. More...
 
const std::string parameter (const std::string &key) const
 Get one parameter from this Form. More...
 
void identities_tojson (ToJson &builder, bool verbose) const
 Internal function for adding identities in tojson. More...
 
void parameters_tojson (ToJson &builder, bool verbose) const
 Internal function for adding parameters in tojson. More...
 
void form_key_tojson (ToJson &builder, bool verbose) const
 Internal function for adding form_key in tojson. More...
 
virtual const FormPtr getitem_range () const
 Returns the Form that would result from a range-slice. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Form
static FormPtr fromnumpy (char kind, int64_t itemsize, const std::vector< int64_t > &inner_shape)
 
static FormPtr fromjson (const std::string &data)
 
- Protected Attributes inherited from Form
bool has_identities_
 See has_identities. More...
 
util::Parameters parameters_
 See parameters. More...
 
FormKey form_key_
 See form_key. More...
 

Detailed Description

Form describing IndexedArray (with OPTION = false).

Constructor & Destructor Documentation

◆ IndexedForm()

IndexedForm ( bool  has_identities,
const util::Parameters parameters,
const FormKey form_key,
Index::Form  index,
const FormPtr content 
)

Creates a IndexedForm. See IndexedArray for documentation.

Member Function Documentation

◆ branch_depth()

const std::pair<bool, int64_t> branch_depth ( ) const
overridevirtual

Returns (a) whether the list-depth of this array "branches," or differs when followed through different fields of a RecordForm or UnionForm and (b) the minimum list-depth.

If the array does not contain any records or heterogeneous data, the first element is always true and the second is simply the depth.

Implements Form.

◆ content()

const FormPtr content ( ) const

◆ dimension_optiontype()

bool dimension_optiontype ( ) const
overridevirtual

Returns true if this dimension has option-type; false otherwise.

Implements Form.

◆ equal()

bool equal ( const FormPtr other,
bool  check_identities,
bool  check_parameters,
bool  check_form_key,
bool  compatibility_check 
) const
overridevirtual

Returns true if this Form is equal to the other Form; false otherwise.

Parameters
check_identitiesIf true, Forms are not equal unless they both has_identities.
check_parametersIf true, Forms are not equal unless they have the same parameters.
check_form_keyIf true, Forms are not equal unless they have the same form_key.
compatibility_checkIf true, this is part of a compatibility check between an expected Form (this) and a generated array's Form (other). When the expected Form is a VirtualForm, it's allowed to be less specific than the other VirtualForm.

Implements Form.

◆ fieldindex()

int64_t fieldindex ( const std::string &  key) const
overridevirtual

The position of a tuple or record key name if this array contains a RecordForm.

Implements Form.

◆ getitem_field()

const FormPtr getitem_field ( const std::string &  key) const
overridevirtual

Returns the Form that would result from a field-slice.

Matches the operation of Content::getitem_field.

Implements Form.

◆ getitem_fields()

const FormPtr getitem_fields ( const std::vector< std::string > &  keys) const
overridevirtual

Returns the Form that would result from a fields-slice.

Matches the operation of Content::getitem_fields.

Implements Form.

◆ haskey()

bool haskey ( const std::string &  key) const
overridevirtual

Returns true if the array contains a RecordForm with the specified key; false otherwise.

Implements Form.

◆ index()

Index::Form index ( ) const

◆ istuple()

bool istuple ( ) const
overridevirtual

Returns true if the outermost RecordArray is a tuple.

Implements Form.

◆ key()

const std::string key ( int64_t  fieldindex) const
overridevirtual

The record name associated with a given field index or the tuple index as a string (e.g. "0", "1", "2") if a tuple.

Raises an error if the array does not contain a RecordForm.

Implements Form.

◆ keys()

const std::vector<std::string> keys ( ) const
overridevirtual

A list of RecordArray keys or an empty list if this array does not contain a RecordArray.

Implements Form.

◆ minmax_depth()

const std::pair<int64_t, int64_t> minmax_depth ( ) const
overridevirtual

Returns (a) the minimum list-depth and (b) the maximum list-depth of the array, which can differ if this array "branches" (differs when followed through different fields of a RecordForm or UnionForm).

Implements Form.

◆ numfields()

int64_t numfields ( ) const
overridevirtual

The number of fields in the first nested tuple or records or -1 if this array does not contain a RecordForm.

Implements Form.

◆ purelist_depth()

int64_t purelist_depth ( ) const
overridevirtual

The list-depth of this array, not counting any contained within a RecordForm.

If this array contains a UnionForm with different depths, the return value is -1.

Implements Form.

◆ purelist_isregular()

bool purelist_isregular ( ) const
overridevirtual

Returns true if all nested lists down to the first RecordForm are RegularForm nodes; false otherwise.

Implements Form.

◆ purelist_parameter()

const std::string purelist_parameter ( const std::string &  key) const
overridevirtual

The parameter associated with key at the first level that has a non-null value, descending only as deep as the first RecordForm.

Implements Form.

◆ shallow_copy()

const FormPtr shallow_copy ( ) const
overridevirtual

Copies this node without copying any nodes hierarchically nested within it.

Implements Form.

◆ simplify_optiontype()

const FormPtr simplify_optiontype ( ) const

◆ tojson_part()

void tojson_part ( ToJson builder,
bool  verbose 
) const
overridevirtual

Internal function to produce a JSON representation one node at a time.

Implements Form.

◆ type()

const TypePtr type ( const util::TypeStrs typestrs) const
overridevirtual

High-level Type describing this Form.

Parameters
typestrsA mapping from "__record__" parameters to string representations of those types, to override the derived strings.

Implements Form.

◆ with_form_key()

const FormPtr with_form_key ( const FormKey form_key) const
overridevirtual

Copies this node, adding or replacing a form_key.

Implements Form.


The documentation for this class was generated from the following file: