μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
unchecked_reference< T, Dims > Class Template Reference

Proxy class providing unsafe, unchecked const access to array data. More...

#include </builds/ipbus/ipbus-software/uhal/python/pybind11-python2/include/pybind11/numpy.h>

Inheritance diagram for unchecked_reference< T, Dims >:
[legend]

Public Member Functions

template<typename... Ix>
const T & operator() (Ix... index) const
 Unchecked const reference access to data at the given indices. More...
 
template<ssize_t D = Dims, typename = enable_if_t<D == 1 || Dynamic>>
const T & operator[] (ssize_t index) const
 Unchecked const reference access to data; this operator only participates if the reference is to a 1-dimensional array. More...
 
template<typename... Ix>
const T * data (Ix... ix) const
 Pointer access to the data at the given indices. More...
 
ssize_t shape (ssize_t dim) const
 Returns the shape (i.e. size) of dimension dim More...
 
ssize_t ndim () const
 Returns the number of dimensions of the array. More...
 
template<bool Dyn = Dynamic>
enable_if_t<!Dyn, ssize_tsize () const
 Returns the total number of elements in the referenced array, i.e. More...
 
template<bool Dyn = Dynamic>
enable_if_t< Dyn, ssize_tsize () const
 
ssize_t nbytes () const
 Returns the total number of bytes used by the referenced data. More...
 
template<typename... Ix>
const T & operator() (Ix... index) const
 Unchecked const reference access to data at the given indices. More...
 
template<ssize_t D = Dims, typename = enable_if_t<D == 1 || Dynamic>>
const T & operator[] (ssize_t index) const
 Unchecked const reference access to data; this operator only participates if the reference is to a 1-dimensional array. More...
 
template<typename... Ix>
const T * data (Ix... ix) const
 Pointer access to the data at the given indices. More...
 
ssize_t shape (ssize_t dim) const
 Returns the shape (i.e. size) of dimension dim More...
 
ssize_t ndim () const
 Returns the number of dimensions of the array. More...
 
template<bool Dyn = Dynamic>
enable_if_t<!Dyn, ssize_tsize () const
 Returns the total number of elements in the referenced array, i.e. More...
 
template<bool Dyn = Dynamic>
enable_if_t< Dyn, ssize_tsize () const
 
ssize_t nbytes () const
 Returns the total number of bytes used by the referenced data. More...
 

Static Public Member Functions

static constexpr ssize_t itemsize ()
 Returns the item size, i.e. sizeof(T) More...
 
static constexpr ssize_t itemsize ()
 Returns the item size, i.e. sizeof(T) More...
 

Protected Member Functions

template<bool Dyn = Dynamic>
 unchecked_reference (const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t<!Dyn, ssize_t >)
 
template<bool Dyn = Dynamic>
 unchecked_reference (const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t< Dyn, ssize_t > dims)
 
template<bool Dyn = Dynamic>
 unchecked_reference (const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t<!Dyn, ssize_t >)
 
template<bool Dyn = Dynamic>
 unchecked_reference (const void *data, const ssize_t *shape, const ssize_t *strides, enable_if_t< Dyn, ssize_t > dims)
 

Protected Attributes

const unsigned char * data_
 
conditional_t< Dynamic, const ssize_t *, std::array< ssize_t,(size_t) Dims > > shape_
 
conditional_t< Dynamic, const ssize_t *, std::array< ssize_t,(size_t) Dims > > strides_
 
const ssize_t dims_
 

Static Protected Attributes

static constexpr bool Dynamic = Dims < 0
 

Friends

class pybind11::array
 

Detailed Description

template<typename T, ssize_t Dims>
class unchecked_reference< T, Dims >

Proxy class providing unsafe, unchecked const access to array data.

This is constructed through the unchecked<T, N>() method of array or the unchecked<N>() method of array_t<T>. Dims will be -1 for dimensions determined at runtime.

Definition at line 409 of file numpy.h.

Constructor & Destructor Documentation

◆ unchecked_reference() [1/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
unchecked_reference< T, Dims >::unchecked_reference ( const void *  data,
const ssize_t shape,
const ssize_t strides,
enable_if_t<!Dyn, ssize_t  
)
inlineprotected

◆ unchecked_reference() [2/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
unchecked_reference< T, Dims >::unchecked_reference ( const void *  data,
const ssize_t shape,
const ssize_t strides,
enable_if_t< Dyn, ssize_t dims 
)
inlineprotected

Definition at line 433 of file numpy.h.

◆ unchecked_reference() [3/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
unchecked_reference< T, Dims >::unchecked_reference ( const void *  data,
const ssize_t shape,
const ssize_t strides,
enable_if_t<!Dyn, ssize_t  
)
inlineprotected

◆ unchecked_reference() [4/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
unchecked_reference< T, Dims >::unchecked_reference ( const void *  data,
const ssize_t shape,
const ssize_t strides,
enable_if_t< Dyn, ssize_t dims 
)
inlineprotected

Definition at line 431 of file numpy.h.

Member Function Documentation

◆ data() [1/2]

template<typename T , ssize_t Dims>
template<typename... Ix>
const T * unchecked_reference< T, Dims >::data ( Ix...  ix) const
inline

Pointer access to the data at the given indices.

Definition at line 464 of file numpy.h.

References unchecked_reference< T, Dims >::operator()().

◆ data() [2/2]

template<typename T , ssize_t Dims>
template<typename... Ix>
const T * unchecked_reference< T, Dims >::data ( Ix...  ix) const
inline

Pointer access to the data at the given indices.

Definition at line 462 of file numpy.h.

References unchecked_reference< T, Dims >::operator()().

◆ itemsize() [1/2]

template<typename T , ssize_t Dims>
static constexpr ssize_t unchecked_reference< T, Dims >::itemsize ( )
inlinestaticconstexpr

Returns the item size, i.e. sizeof(T)

Definition at line 469 of file numpy.h.

Referenced by unchecked_reference< T, Dims >::nbytes().

◆ itemsize() [2/2]

template<typename T , ssize_t Dims>
static constexpr ssize_t unchecked_reference< T, Dims >::itemsize ( )
inlinestaticconstexpr

Returns the item size, i.e. sizeof(T)

Definition at line 467 of file numpy.h.

◆ nbytes() [1/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::nbytes ( ) const
inline

Returns the total number of bytes used by the referenced data.

Note that the actual span in memory may be larger if the referenced array has non-contiguous strides (e.g. for a slice).

Definition at line 492 of file numpy.h.

References unchecked_reference< T, Dims >::itemsize(), and unchecked_reference< T, Dims >::size().

◆ nbytes() [2/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::nbytes ( ) const
inline

Returns the total number of bytes used by the referenced data.

Note that the actual span in memory may be larger if the referenced array has non-contiguous strides (e.g. for a slice).

Definition at line 490 of file numpy.h.

References unchecked_reference< T, Dims >::itemsize(), and unchecked_reference< T, Dims >::size().

◆ ndim() [1/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::ndim ( ) const
inline

Returns the number of dimensions of the array.

Definition at line 475 of file numpy.h.

References unchecked_reference< T, Dims >::dims_.

Referenced by unchecked_reference< T, Dims >::size().

◆ ndim() [2/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::ndim ( ) const
inline

Returns the number of dimensions of the array.

Definition at line 473 of file numpy.h.

References unchecked_reference< T, Dims >::dims_.

◆ operator()() [1/2]

template<typename T , ssize_t Dims>
template<typename... Ix>
const T & unchecked_reference< T, Dims >::operator() ( Ix...  index) const
inline

Unchecked const reference access to data at the given indices.

For a compile-time known number of dimensions, this requires the correct number of arguments; for run-time dimensionality, this is not checked (and so is up to the caller to use safely).

Definition at line 447 of file numpy.h.

References byte_offset_unsafe(), unchecked_reference< T, Dims >::data_, unchecked_reference< T, Dims >::Dynamic, and unchecked_reference< T, Dims >::strides_.

Referenced by unchecked_reference< T, Dims >::data(), unchecked_mutable_reference< T, Dims >::operator()(), and unchecked_reference< T, Dims >::operator[]().

◆ operator()() [2/2]

template<typename T , ssize_t Dims>
template<typename... Ix>
const T & unchecked_reference< T, Dims >::operator() ( Ix...  index) const
inline

Unchecked const reference access to data at the given indices.

For a compile-time known number of dimensions, this requires the correct number of arguments; for run-time dimensionality, this is not checked (and so is up to the caller to use safely).

Definition at line 445 of file numpy.h.

References byte_offset_unsafe(), unchecked_reference< T, Dims >::data_, unchecked_reference< T, Dims >::Dynamic, and unchecked_reference< T, Dims >::strides_.

◆ operator[]() [1/2]

template<typename T , ssize_t Dims>
template<ssize_t D = Dims, typename = enable_if_t<D == 1 || Dynamic>>
const T & unchecked_reference< T, Dims >::operator[] ( ssize_t  index) const
inline

Unchecked const reference access to data; this operator only participates if the reference is to a 1-dimensional array.

When present, this is exactly equivalent to obj(index).

Definition at line 458 of file numpy.h.

References unchecked_reference< T, Dims >::operator()().

◆ operator[]() [2/2]

template<typename T , ssize_t Dims>
template<ssize_t D = Dims, typename = enable_if_t<D == 1 || Dynamic>>
const T & unchecked_reference< T, Dims >::operator[] ( ssize_t  index) const
inline

Unchecked const reference access to data; this operator only participates if the reference is to a 1-dimensional array.

When present, this is exactly equivalent to obj(index).

Definition at line 456 of file numpy.h.

References unchecked_reference< T, Dims >::operator()().

◆ shape() [1/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::shape ( ssize_t  dim) const
inline

Returns the shape (i.e. size) of dimension dim

Definition at line 472 of file numpy.h.

References unchecked_reference< T, Dims >::shape_.

Referenced by unchecked_reference< T, Dims >::unchecked_reference().

◆ shape() [2/2]

template<typename T , ssize_t Dims>
ssize_t unchecked_reference< T, Dims >::shape ( ssize_t  dim) const
inline

Returns the shape (i.e. size) of dimension dim

Definition at line 470 of file numpy.h.

References unchecked_reference< T, Dims >::shape_.

◆ size() [1/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
enable_if_t<!Dyn, ssize_t > unchecked_reference< T, Dims >::size ( ) const
inline

Returns the total number of elements in the referenced array, i.e.

the product of the shapes

Definition at line 480 of file numpy.h.

References unchecked_reference< T, Dims >::shape_.

Referenced by unchecked_reference< T, Dims >::nbytes().

◆ size() [2/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
enable_if_t< Dyn, ssize_t > unchecked_reference< T, Dims >::size ( ) const
inline

◆ size() [3/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
enable_if_t<!Dyn, ssize_t > unchecked_reference< T, Dims >::size ( ) const
inline

Returns the total number of elements in the referenced array, i.e.

the product of the shapes

Definition at line 478 of file numpy.h.

References unchecked_reference< T, Dims >::shape_.

◆ size() [4/4]

template<typename T , ssize_t Dims>
template<bool Dyn = Dynamic>
enable_if_t< Dyn, ssize_t > unchecked_reference< T, Dims >::size ( ) const
inline

Friends And Related Function Documentation

◆ pybind11::array

template<typename T , ssize_t Dims>
pybind11::array
friend

Definition at line 418 of file numpy.h.

Member Data Documentation

◆ data_

template<typename T , ssize_t Dims>
const unsigned char * unchecked_reference< T, Dims >::data_
protected

Definition at line 412 of file numpy.h.

Referenced by unchecked_reference< T, Dims >::operator()().

◆ dims_

template<typename T , ssize_t Dims>
const ssize_t unchecked_reference< T, Dims >::dims_
protected

◆ Dynamic

template<typename T , ssize_t Dims>
static constexpr bool unchecked_reference< T, Dims >::Dynamic = Dims < 0
staticconstexprprotected

Definition at line 411 of file numpy.h.

Referenced by unchecked_reference< T, Dims >::operator()().

◆ shape_

template<typename T , ssize_t Dims>
conditional_t< Dynamic, const ssize_t *, std::array< ssize_t,(size_t) Dims > > unchecked_reference< T, Dims >::shape_
protected

◆ strides_

template<typename T , ssize_t Dims>
conditional_t< Dynamic, const ssize_t *, std::array< ssize_t,(size_t) Dims > > unchecked_reference< T, Dims >::strides_
protected

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