SOFA API  cd4ffb93
Open source framework for multi-physics simuation
sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr > Class Template Reference

#include <Link.h>

Class to hold 0-or-1 pointer. The interface is similar to std::vector (size/[]/begin/end), plus an automatic conversion to one pointer. More...

Detailed Description

template<class T, class TDestPtr, class TPtr = T*>
class sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >

Class to hold 0-or-1 pointer. The interface is similar to std::vector (size/[]/begin/end), plus an automatic conversion to one pointer.

Protected Attributes

bool isEmpty {true}
 
TPtr elems [1]
 

Public Member Functions

 SinglePtr ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
std::size_t size () const
 
void resize (size_t size)
 
bool empty () const
 
void clear ()
 
const TPtr & get () const
 
TPtr & get ()
 
void add (TDestPtr v)
 
void addBegin (TDestPtr v)
 
const TPtr & operator[] (std::size_t i) const
 
TPtr & operator[] (std::size_t i)
 
const TPtr & operator() (std::size_t i) const
 
TPtr & operator() (std::size_t i)
 
 operator T* () const
 
T * operator-> () const
 

Attribute details

◆ elems

template<class T , class TDestPtr , class TPtr = T*>
TPtr sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::elems[1]
protected

◆ isEmpty

template<class T , class TDestPtr , class TPtr = T*>
bool sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::isEmpty {true}
protected

Constructor details

◆ SinglePtr()

template<class T , class TDestPtr , class TPtr = T*>
sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::SinglePtr ( )
inline

Function details

◆ add()

template<class T , class TDestPtr , class TPtr = T*>
void sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::add ( TDestPtr  v)
inline

◆ addBegin()

template<class T , class TDestPtr , class TPtr = T*>
void sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::addBegin ( TDestPtr  v)
inline

◆ begin()

template<class T , class TDestPtr , class TPtr = T*>
const_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::begin ( ) const
inline

◆ cbegin()

template<class T , class TDestPtr , class TPtr = T*>
const_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::cbegin ( ) const
inline

◆ cend()

template<class T , class TDestPtr , class TPtr = T*>
const_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::cend ( ) const
inline

◆ clear()

template<class T , class TDestPtr , class TPtr = T*>
void sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::clear ( )
inline

◆ crbegin()

template<class T , class TDestPtr , class TPtr = T*>
const_reverse_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::crbegin ( ) const
inline

◆ crend()

template<class T , class TDestPtr , class TPtr = T*>
const_reverse_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::crend ( ) const
inline

◆ empty()

template<class T , class TDestPtr , class TPtr = T*>
bool sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::empty ( ) const
inline

◆ end()

template<class T , class TDestPtr , class TPtr = T*>
const_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::end ( ) const
inline

◆ get() [1/2]

template<class T , class TDestPtr , class TPtr = T*>
TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::get ( )
inline

◆ get() [2/2]

template<class T , class TDestPtr , class TPtr = T*>
const TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::get ( ) const
inline

◆ operator T*()

template<class T , class TDestPtr , class TPtr = T*>
sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator T* ( ) const
inline

◆ operator()() [1/2]

template<class T , class TDestPtr , class TPtr = T*>
TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator() ( std::size_t  i)
inline

◆ operator()() [2/2]

template<class T , class TDestPtr , class TPtr = T*>
const TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator() ( std::size_t  i) const
inline

◆ operator->()

template<class T , class TDestPtr , class TPtr = T*>
T* sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator-> ( ) const
inline

◆ operator[]() [1/2]

template<class T , class TDestPtr , class TPtr = T*>
TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator[] ( std::size_t  i)
inline

◆ operator[]() [2/2]

template<class T , class TDestPtr , class TPtr = T*>
const TPtr& sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::operator[] ( std::size_t  i) const
inline

◆ rbegin()

template<class T , class TDestPtr , class TPtr = T*>
const_reverse_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::rbegin ( ) const
inline

◆ rend()

template<class T , class TDestPtr , class TPtr = T*>
const_reverse_iterator sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::rend ( ) const
inline

◆ resize()

template<class T , class TDestPtr , class TPtr = T*>
void sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::resize ( size_t  size)
inline

◆ size()

template<class T , class TDestPtr , class TPtr = T*>
std::size_t sofa::core::objectmodel::SinglePtr< T, TDestPtr, TPtr >::size ( ) const
inline