Specification of the slice indices which is used for partial loading of serialized data. More...
#include <Slice.h>
Classes | |
| struct | Empty |
Public Member Functions | |
| Slice (int start=0, int stop=-1, int step=1) noexcept | |
| Initialize the slice of the first dimension. More... | |
| Slice (Empty) | |
| Slice (const Slice &)=default | |
| Slice (Slice &&)=default | |
| Slice & | operator= (const Slice &)=default |
| Slice & | operator= (Slice &&)=default |
| Slice & | operator() (int start=0, int stop=-1, int step=1) noexcept |
Append a slice to the i-th dimension where i is the current size() of the sliceTriples vector. More... | |
| bool | empty () const noexcept |
| Check if slice is empty. | |
| void | swap (Slice &other) noexcept |
Swap with other | |
| std::vector< SliceTriple > & | sliceTriples () noexcept |
| Get slice triples. | |
| const std::vector< SliceTriple > & | sliceTriples () const noexcept |
Specification of the slice indices which is used for partial loading of serialized data.
The syntax follows closely the slicing syntax used in Python, the equivalent of [start1:stop1:step1, ... ,startN:stopN:stepN] is Slice(start1, stop1, step1) ... (startN, stopN, stepN) with one notable exception: The full dimension [:] is represented as Slice(0, -1) this means [:-1] corresponds to Slice(0, -2).
Consider the follwoing examples:
| Python | C++ |
|---|---|
[5] | Slice(5, 6) |
[:] | Slice(0, -1, 1) or Slice() |
[0:3, 0:3] | Slice(0, 3)(0, 3) |
[1:10:2] | Slice(1, 10, 2) |
[:, 1:5:2, 1:-2] | Slice()(1, 5, 2)(1, -3) |
|
inlinenoexcept |
Initialize the slice of the first dimension.
The default arguments correspond to the full dimension (i.e no slicing in the first dimension).
The python equivalent would be [start:stop:step].
| start | Starting index of the slice |
| stop | Stopping index of the slice (index stop is not included) |
| step | Step of the slice |
|
inlinenoexcept |
Append a slice to the i-th dimension where i is the current size() of the sliceTriples vector.
The default arguments correspond to the full dimension (i.e no slicing in the i-th dimension).
The python equivalent would be [start:stop:step].
| start | Starting index of the slice |
| stop | Stopping index of the slice (index stop is not included) |
| step | Step of the slice |