Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PLMD::TypesafePtr Class Reference

#include <TypesafePtr.h>

Public Member Functions

 TypesafePtr ()
 
 TypesafePtr (const TypesafePtr &other)=delete
 
 TypesafePtr (std::nullptr_t)
 
 TypesafePtr (TypesafePtr &&other)
 
 TypesafePtr (void *ptr, std::size_t nelem, const std::size_t *shape, std::size_t flags)
 
 ~TypesafePtr ()
 Here we create all the required instances 1: void 3: integral 4: floating 5: FILE 0x100: unsigned. More...
 
TypesafePtr copy () const
 
template<typename T >
std::enable_if< std::is_pointer< T >::value, T >::type get () const
 
template<typename T >
std::enable_if<!std::is_pointer< T >::value, T >::type get () const
 
template<typename T >
get (std::initializer_list< std::size_t > shape) const
 
template<typename T >
get (std::size_t nelem) const
 
std::size_t getFlags () const noexcept
 
std::size_t getNelem () const noexcept
 
void * getRaw () const noexcept
 
const std::size_t * getShape () const noexcept
 
 operator bool () const noexcept
 
TypesafePtroperator= (const TypesafePtr &other)=delete
 
TypesafePtroperator= (TypesafePtr &&other)
 
template<typename T >
void set (T val) const
 
std::string type_str () const
 

Static Public Member Functions

static TypesafePtr fromSafePtr (void *safe)
 
static TypesafePtr setNelemAndShape (const TypesafePtr &other, std::size_t nelem, const std::size_t *shape)
 
static TypesafePtr unchecked (const void *ptr)
 

Static Public Attributes

static constexpr unsigned short is_file =5
 
static constexpr unsigned short is_floating_point =4
 
static constexpr unsigned short is_integral =3
 
static const unsigned maxrank =4
 

Private Member Functions

template<typename T >
T * get_priv (std::size_t nelem, const std::size_t *shape, bool byvalue) const
 
void init_shape (const std::size_t *shape)
 

Static Private Member Functions

static std::string extra_msg ()
 

Private Attributes

std::array< char, 32 > buffer
 
std::size_t flags =0
 
std::size_t nelem =0
 
void * ptr =nullptr
 
std::array< std::size_t, maxrank+1 > shape
 

Detailed Description

Class to deal with propoagation of typesafe pointers.

Constructor & Destructor Documentation

◆ TypesafePtr() [1/5]

PLMD::TypesafePtr::TypesafePtr ( void *  ptr,
std::size_t  nelem,
const std::size_t *  shape,
std::size_t  flags 
)
inline

◆ TypesafePtr() [2/5]

PLMD::TypesafePtr::TypesafePtr ( )
inline

◆ TypesafePtr() [3/5]

PLMD::TypesafePtr::TypesafePtr ( std::nullptr_t  )
inline

◆ ~TypesafePtr()

PLMD::TypesafePtr::~TypesafePtr ( )
inline

Here we create all the required instances 1: void 3: integral 4: floating 5: FILE 0x100: unsigned.

◆ TypesafePtr() [4/5]

PLMD::TypesafePtr::TypesafePtr ( const TypesafePtr other)
delete

◆ TypesafePtr() [5/5]

PLMD::TypesafePtr::TypesafePtr ( TypesafePtr &&  other)
inline

Member Function Documentation

◆ copy()

TypesafePtr PLMD::TypesafePtr::copy ( ) const

◆ extra_msg()

std::string PLMD::TypesafePtr::extra_msg ( )
staticprivate

◆ fromSafePtr()

TypesafePtr PLMD::TypesafePtr::fromSafePtr ( void *  safe)
static

◆ get() [1/4]

template<typename T >
std::enable_if<std::is_pointer<T>::value,T>::type PLMD::TypesafePtr::get ( ) const
inline

◆ get() [2/4]

template<typename T >
std::enable_if<!std::is_pointer<T>::value,T>::type PLMD::TypesafePtr::get ( ) const
inline

◆ get() [3/4]

template<typename T >
T PLMD::TypesafePtr::get ( std::initializer_list< std::size_t >  shape) const
inline

◆ get() [4/4]

template<typename T >
T PLMD::TypesafePtr::get ( std::size_t  nelem) const
inline

◆ get_priv()

template<typename T >
T* PLMD::TypesafePtr::get_priv ( std::size_t  nelem,
const std::size_t *  shape,
bool  byvalue 
) const
inlineprivate

◆ getFlags()

std::size_t PLMD::TypesafePtr::getFlags ( ) const
inlinenoexcept

◆ getNelem()

std::size_t PLMD::TypesafePtr::getNelem ( ) const
inlinenoexcept

◆ getRaw()

void* PLMD::TypesafePtr::getRaw ( ) const
inlinenoexcept

◆ getShape()

const std::size_t* PLMD::TypesafePtr::getShape ( ) const
inlinenoexcept

◆ init_shape()

void PLMD::TypesafePtr::init_shape ( const std::size_t *  shape)
inlineprivate

◆ operator bool()

PLMD::TypesafePtr::operator bool ( ) const
inlinenoexcept

◆ operator=() [1/2]

TypesafePtr& PLMD::TypesafePtr::operator= ( const TypesafePtr other)
delete

◆ operator=() [2/2]

TypesafePtr& PLMD::TypesafePtr::operator= ( TypesafePtr &&  other)
inline

◆ set()

template<typename T >
void PLMD::TypesafePtr::set ( val) const
inline

◆ setNelemAndShape()

static TypesafePtr PLMD::TypesafePtr::setNelemAndShape ( const TypesafePtr other,
std::size_t  nelem,
const std::size_t *  shape 
)
inlinestatic

◆ type_str()

std::string PLMD::TypesafePtr::type_str ( ) const
inline

◆ unchecked()

static TypesafePtr PLMD::TypesafePtr::unchecked ( const void *  ptr)
inlinestatic

Member Data Documentation

◆ buffer

std::array<char,32> PLMD::TypesafePtr::buffer
private

◆ flags

std::size_t PLMD::TypesafePtr::flags =0
private

◆ is_file

constexpr unsigned short PLMD::TypesafePtr::is_file =5
staticconstexpr

◆ is_floating_point

constexpr unsigned short PLMD::TypesafePtr::is_floating_point =4
staticconstexpr

◆ is_integral

constexpr unsigned short PLMD::TypesafePtr::is_integral =3
staticconstexpr

◆ maxrank

const unsigned PLMD::TypesafePtr::maxrank =4
static

◆ nelem

std::size_t PLMD::TypesafePtr::nelem =0
private

◆ ptr

void* PLMD::TypesafePtr::ptr =nullptr
private

◆ shape

std::array<std::size_t,maxrank+1> PLMD::TypesafePtr::shape
private

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