Awkward Array: Slice Class Reference

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Slice Class Reference

A sequence of SliceItem objects representing a tuple passed to Python's `__getitem__`. More...

`#include <Slice.h>`

## Public Member Functions
| Slice (const std::vector< SliceItemPtr > &items, bool sealed)
| Creates a Slice with a full set of parameters. More...
| Slice (const std::vector< SliceItemPtr > &items)
| Creates an "unsealed" Slice, to which we can still add SliceItem objects (with append). More...
| Slice ()
| Creates an empty Slice. More...
const std::vector< SliceItemPtr > | items () const
| The SliceItem objects in this Slice. More...
bool | sealed () const
| If `true`, the Slice is immutable and append will fail. Otherwise, the items may be appended to. More...
int64_t | length () const
| The number of SliceItem objects in items. More...
int64_t | dimlength () const
| The number of SliceAt, SliceRange, and SliceArrayOf objects in the items. More...
const SliceItemPtr | head () const
| Returns a pointer to the first SliceItem. More...
const Slice | tail () const
| Returns a Slice representing all but the first SliceItem. More...
const Slice | only_fields () const
| Returns a Slice containing only SliceField and SliceFields. More...
const Slice | not_fields () const
| Returns a Slice without any SliceField or SliceFields. More...
const std::string | tostring () const
| Returns a string representation of this slice item (single-line custom format). More...
const Slice | prepended (const SliceItemPtr &item) const
| Returns a new Slice with `item` prepended. More...
void | append (const SliceItemPtr &item)
| Inserts a SliceItem in-place at the end of the items. More...
void | append (const SliceAt &item)
| Inserts a SliceAt in-place at the end of the items. More...
void | append (const SliceRange &item)
| Inserts a SliceRange in-place at the end of the items. More...
void | append (const SliceEllipsis &item)
| Inserts a SliceEllipsis in-place at the end of the items. More...
void | append (const SliceNewAxis &item)
| Inserts a SliceNewAxis in-place at the end of the items. More...
void | append (const SliceArray64 &item)
| Inserts a `SliceArray64` in-place at the end of the items. More...
void | append (const SliceField &item)
| Inserts a SliceField in-place at the end of the items. More...
void | append (const SliceFields &item)
| Inserts a SliceFields in-place at the end of the items. More...
void | append (const SliceMissing64 &item)
| Inserts a `SliceMissing64` in-place at the end of the items. More...
void | append (const SliceJagged64 &item)
| Inserts a `SliceJagged64` in-place at the end of the items. More...
void | become_sealed ()
| Seal this Slice so that it is no longer open to append. More...
bool | isadvanced () const
| Returns `true` if the Slice contains SliceArrayOf; `false` otherwise. More...
bool | referentially_equal (const Slice &other) const
| Returns `true` if this slice has all the same buffers and parameters as `other`; `false` otherwise. More...

## Static Public Member Functions
static int64_t | none ()
| Represents a missing `start`, `stop`, or `step` in a SliceRange. More...

## Detailed Description

A sequence of SliceItem objects representing a tuple passed to Python's `__getitem__`.

## Constructor & Destructor Documentation

## ◆ Slice() [1/3]

Slice | ( | const std::vector< SliceItemPtr > & | items,
|  | bool | sealed
| ) |  |

Creates a Slice with a full set of parameters.

Parameters

  items | The SliceItem objects in this Slice.
  sealed | If `true`, the Slice is immutable and append will fail. Otherwise, the items may be appended to.

## ◆ Slice() [2/3]

Slice | ( | const std::vector< SliceItemPtr > & | items | ) |

Creates an "unsealed" Slice, to which we can still add SliceItem objects (with append).

Parameters

  items | The SliceItem objects in this Slice.

## ◆ Slice() [3/3]

Slice | ( |  | ) |

Creates an empty Slice.

## Member Function Documentation

## ◆ append() [1/10]

void append | ( | const SliceArray64 & | item | ) |

Inserts a `SliceArray64` in-place at the end of the items.

## ◆ append() [2/10]

void append | ( | const SliceAt & | item | ) |

Inserts a SliceAt in-place at the end of the items.

## ◆ append() [3/10]

void append | ( | const SliceEllipsis & | item | ) |

Inserts a SliceEllipsis in-place at the end of the items.

## ◆ append() [4/10]

void append | ( | const SliceField & | item | ) |

Inserts a SliceField in-place at the end of the items.

## ◆ append() [5/10]

void append | ( | const SliceFields & | item | ) |

Inserts a SliceFields in-place at the end of the items.

## ◆ append() [6/10]

void append | ( | const SliceItemPtr & | item | ) |

Inserts a SliceItem in-place at the end of the items.

## ◆ append() [7/10]

void append | ( | const SliceJagged64 & | item | ) |

Inserts a `SliceJagged64` in-place at the end of the items.

## ◆ append() [8/10]

void append | ( | const SliceMissing64 & | item | ) |

Inserts a `SliceMissing64` in-place at the end of the items.

## ◆ append() [9/10]

void append | ( | const SliceNewAxis & | item | ) |

Inserts a SliceNewAxis in-place at the end of the items.

## ◆ append() [10/10]

void append | ( | const SliceRange & | item | ) |

Inserts a SliceRange in-place at the end of the items.

## ◆ become_sealed()

void become_sealed | ( |  | ) |

Seal this Slice so that it is no longer open to append.

## ◆ dimlength()

int64_t dimlength | ( |  | ) | const

The number of SliceAt, SliceRange, and SliceArrayOf objects in the items.

## ◆ head()

const SliceItemPtr head | ( |  | ) | const

Returns a pointer to the first SliceItem.

## ◆ isadvanced()

bool isadvanced | ( |  | ) | const

Returns `true` if the Slice contains SliceArrayOf; `false` otherwise.

This function can only be called when the Slice is sealed (see Slice and become_sealed).

## ◆ items()

const std::vector< SliceItemPtr > items | ( |  | ) | const

The SliceItem objects in this Slice.

## ◆ length()

int64_t length | ( |  | ) | const

The number of SliceItem objects in items.

## ◆ none()

static int64_t none | ( |  | ) |
| static

Represents a missing `start`, `stop`, or `step` in a SliceRange.

## ◆ not_fields()

const Slice not_fields | ( |  | ) | const

Returns a Slice without any SliceField or SliceFields.

## ◆ only_fields()

const Slice only_fields | ( |  | ) | const

Returns a Slice containing only SliceField and SliceFields.

## ◆ prepended()

const Slice prepended | ( | const SliceItemPtr & | item | ) | const

Returns a new Slice with `item` prepended.

## ◆ referentially_equal()

bool referentially_equal | ( | const Slice & | other | ) | const

Returns `true` if this slice has all the same buffers and parameters as `other`; `false` otherwise.

Parameters

  other | The slice to compare this with.

## ◆ sealed()

bool sealed | ( |  | ) | const

If `true`, the Slice is immutable and append will fail. Otherwise, the items may be appended to.

## ◆ tail()

const Slice tail | ( |  | ) | const

Returns a Slice representing all but the first SliceItem.

## ◆ tostring()

const std::string tostring | ( |  | ) | const

Returns a string representation of this slice item (single-line custom format).

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

- include/awkward/Slice.h