DPsim
Public Types | Public Member Functions | List of all members
CPS::AttributePointer< T > Class Template Reference

#include <Attribute.h>

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.


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