DPsim
Loading...
Searching...
No Matches
CPS::AttributePointer< T > Class Template Reference

#include <Attribute.h>

Inheritance diagram for CPS::AttributePointer< T >:
[legend]

Public Types

using element_type = T
 

Public Member Functions

 AttributePointer (const AttributePointer &r)=default
 
 AttributePointer (std::shared_ptr< T > ptr)
 
 AttributePointer (std::nullptr_t ptr)
 
 AttributePointer (T *ptr)
 
template<class U>
 AttributePointer (AttributePointer< U > ptr)
 
template<class U>
 AttributePointer (std::shared_ptr< U > ptr)
 
AttributePointeroperator= (const AttributePointer &r) noexcept
 
template<class U>
AttributePointeroperator= (const AttributePointer< U > &r) noexcept
 
AttributePointeroperator= (AttributePointer &&r)
 
template<class U>
AttributePointeroperator= (AttributePointer< U > &&r)
 
T & operator* () const noexcept
 
T * operator-> () const noexcept
 
T * get () const
 
std::shared_ptr< T > getPtr () const
 
bool isNull () const
 

Detailed Description

template<class T>
class CPS::AttributePointer< T >

Custom pointer class for storing attributes as member variables and in the mAttributes attribute map. Using this type over the normal std::shared_ptr allows for disabling certain operator overloads, e.g. the comparison with the nullptr / the number 0 that is possible with shared ptrs. Since attribute pointers rarely need to be compared with the nullptr, disabling the implicit comparison allows for detecting more errors at compile time. Explicit comparison still remains possible via the getPtr method.

Definition at line 46 of file Attribute.h.

Member Typedef Documentation

◆ element_type

template<class T>
using CPS::AttributePointer< T >::element_type = T

Definition at line 48 of file Attribute.h.

Constructor & Destructor Documentation

◆ AttributePointer() [1/6]

template<class T>
CPS::AttributePointer< T >::AttributePointer ( )
inline

Definition at line 50 of file Attribute.h.

◆ AttributePointer() [2/6]

template<class T>
CPS::AttributePointer< T >::AttributePointer ( std::shared_ptr< T > ptr)
inline

Definition at line 52 of file Attribute.h.

◆ AttributePointer() [3/6]

template<class T>
CPS::AttributePointer< T >::AttributePointer ( std::nullptr_t ptr)
inline

Definition at line 53 of file Attribute.h.

◆ AttributePointer() [4/6]

template<class T>
CPS::AttributePointer< T >::AttributePointer ( T * ptr)
inlineexplicit

Definition at line 54 of file Attribute.h.

◆ AttributePointer() [5/6]

template<class T>
template<class U>
CPS::AttributePointer< T >::AttributePointer ( AttributePointer< U > ptr)
inline

Definition at line 56 of file Attribute.h.

◆ AttributePointer() [6/6]

template<class T>
template<class U>
CPS::AttributePointer< T >::AttributePointer ( std::shared_ptr< U > ptr)
inline

Definition at line 60 of file Attribute.h.

Member Function Documentation

◆ get()

template<class T>
T * CPS::AttributePointer< T >::get ( ) const
inline

Definition at line 87 of file Attribute.h.

◆ getPtr()

template<class T>
std::shared_ptr< T > CPS::AttributePointer< T >::getPtr ( ) const
inline

Definition at line 89 of file Attribute.h.

◆ isNull()

template<class T>
bool CPS::AttributePointer< T >::isNull ( ) const
inline

Definition at line 91 of file Attribute.h.

◆ operator*()

template<class T>
T & CPS::AttributePointer< T >::operator* ( ) const
inlinenoexcept

Definition at line 83 of file Attribute.h.

◆ operator->()

template<class T>
T * CPS::AttributePointer< T >::operator-> ( ) const
inlinenoexcept

Definition at line 85 of file Attribute.h.

◆ operator=() [1/4]

template<class T>
AttributePointer & CPS::AttributePointer< T >::operator= ( AttributePointer< T > && r)
inline

Definition at line 73 of file Attribute.h.

◆ operator=() [2/4]

template<class T>
template<class U>
AttributePointer & CPS::AttributePointer< T >::operator= ( AttributePointer< U > && r)
inline

Definition at line 78 of file Attribute.h.

◆ operator=() [3/4]

template<class T>
AttributePointer & CPS::AttributePointer< T >::operator= ( const AttributePointer< T > & r)
inlinenoexcept

Definition at line 62 of file Attribute.h.

◆ operator=() [4/4]

template<class T>
template<class U>
AttributePointer & CPS::AttributePointer< T >::operator= ( const AttributePointer< U > & r)
inlinenoexcept

Definition at line 68 of file Attribute.h.


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