HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Common::Pointer< T > Class Template Reference

Simple raw pointer wrapper. More...

#include <common.h>

+ Collaboration diagram for HF::Common::Pointer< T >:

Public Member Functions

 Pointer (T *_pointer=nullptr, bool _owner=false)
 Constructor. More...
 
 Pointer (T &_pointer)
 Constructor. More...
 
 Pointer (Pointer< T > &&other)
 Move constructor. More...
 
 Pointer (Pointer< T > &other)
 Copy constructor. More...
 
Pointer< T > & operator= (Pointer< T > &&other)
 Assignment move operator. More...
 

Detailed Description

template<typename T>
class HF::Common::Pointer< T >

Simple raw pointer wrapper.

Definition at line 1178 of file inc/hanfun/common.h.

Constructor & Destructor Documentation

◆ Pointer() [1/4]

template<typename T>
HF::Common::Pointer< T >::Pointer ( T *  _pointer = nullptr,
bool  _owner = false 
)
inline

Constructor.

Parameters
[in]_pointerpointer to wrap.
[in]_ownerboolean indicating if the underling pointer should be deleted when this object is deleted.

Definition at line 1193 of file inc/hanfun/common.h.

1193  :
1194  pointer(_pointer), owner(_owner)
1195  {}

◆ Pointer() [2/4]

template<typename T>
HF::Common::Pointer< T >::Pointer ( T &  _pointer)
inline

Constructor.

Parameters
[in]_pointerpointer to wrap.

Definition at line 1202 of file inc/hanfun/common.h.

1202  :
1203  pointer(&_pointer), owner(false)
1204  {}

◆ Pointer() [3/4]

template<typename T>
HF::Common::Pointer< T >::Pointer ( Pointer< T > &&  other)
inline

Move constructor.

Parameters
[in]otheroriginal object.

Definition at line 1211 of file inc/hanfun/common.h.

1211  : pointer(nullptr), owner(false)
1212  {
1213  std::swap(this->pointer, other.pointer);
1214  std::swap(this->owner, other.owner);
1215  }

◆ Pointer() [4/4]

template<typename T>
HF::Common::Pointer< T >::Pointer ( Pointer< T > &  other)
inline

Copy constructor.

Parameters
[in]otheroriginal object.

Definition at line 1222 of file inc/hanfun/common.h.

1222  : pointer(other.pointer), owner(other.owner)
1223  {
1224  other.owner = false;
1225  }

Member Function Documentation

◆ operator=()

template<typename T>
Pointer<T>& HF::Common::Pointer< T >::operator= ( Pointer< T > &&  other)
inline

Assignment move operator.

Parameters
[in]otherobject to move from.
Returns
reference to this object.

Definition at line 1282 of file inc/hanfun/common.h.

1283  {
1284  if (this->owner)
1285  {
1286  delete this->pointer;
1287  }
1288 
1289  this->pointer = other.pointer;
1290  this->owner = other.owner;
1291 
1292  other.owner = false;
1293 
1294  return *this;
1295  }

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