Represents a Python slice
object (usual syntax: array[start:stop:step]
).
More...
#include <Slice.h>
Public Member Functions | |
SliceRange (int64_t start, int64_t stop, int64_t step) | |
Creates a SliceRange from a full set of parameters. | |
int64_t | start () const |
The inclusive starting position. | |
int64_t | stop () const |
The exclusive stopping position. | |
int64_t | step () const |
The step size, which may be negative but must not be zero. | |
bool | hasstart () const |
Returns true if start is not Slice::none ; false otherwise. | |
bool | hasstop () const |
Returns true if stop is not Slice::none ; false otherwise. | |
const SliceItemPtr | shallow_copy () const override |
Copies this node without copying any associated arrays. | |
const std::string | tostring () const override |
Returns a string representation of this slice item (single-line custom format). | |
bool | preserves_type (const Index64 &advanced) const override |
Returns true if this slice would preserve an array's slice and therefore should pass on Content::parameters . | |
virtual bool | referentially_equal (const SliceItemPtr &other) const override |
Returns true if this slice item has all the same buffers and parameters as other ; false otherwise. | |
![]() | |
virtual | ~SliceItem () |
Virtual destructor acts as a first non-inline virtual function that determines a specific translation unit in which vtable shall be emitted. | |
virtual const SliceItemPtr | shallow_copy () const =0 |
Copies this node without copying any associated arrays. | |
virtual const std::string | tostring () const =0 |
Returns a string representation of this slice item (single-line custom format). | |
virtual bool | preserves_type (const Index64 &advanced) const =0 |
Returns true if this slice would preserve an array's slice and therefore should pass on Content::parameters . | |
virtual bool | referentially_equal (const SliceItemPtr &other) const =0 |
Returns true if this slice item has all the same buffers and parameters as other ; false otherwise. | |
Represents a Python slice
object (usual syntax: array[start:stop:step]
).
SliceRange | ( | int64_t | start, |
int64_t | stop, | ||
int64_t | step | ||
) |
Creates a SliceRange from a full set of parameters.
start | The inclusive starting position. |
stop | The exclusive stopping position. |
step | The step size, which may be negative but must not be zero. |
Any start, stop, or step may be Slice::none
. Appropriate values are derived from an array's length
the same way they are in Python.
bool hasstart | ( | ) | const |
Returns true
if start is not Slice::none
; false
otherwise.
bool hasstop | ( | ) | const |
Returns true
if stop is not Slice::none
; false
otherwise.
|
overridevirtual |
Returns true
if this slice would preserve an array's slice and therefore should pass on Content::parameters
.
advanced | The index that is passed through Content::getitem_next . |
Always true
for SliceRange.
Implements SliceItem.
|
overridevirtual |
Returns true
if this slice item has all the same buffers and parameters as other
; false
otherwise.
other | The slice item to compare this with. |
Implements SliceItem.
|
overridevirtual |
Copies this node without copying any associated arrays.
Implements SliceItem.
int64_t start | ( | ) | const |
The inclusive starting position.
This value may be Slice::none
; if so, the value used would be derived from an array's length
the same way they are in Python.
int64_t step | ( | ) | const |
The step size, which may be negative but must not be zero.
This value may be Slice::none
; if so, the value used would be derived from an array's length
the same way they are in Python.
int64_t stop | ( | ) | const |
The exclusive stopping position.
This value may be Slice::none
; if so, the value used would be derived from an array's length
the same way they are in Python.
|
overridevirtual |
Returns a string representation of this slice item (single-line custom format).
Implements SliceItem.