EepromSecureData
CRC-controlled EEPROM memory storage
EepromSecureData< T >

CRC-controlled EEPROM memory storage template class. More...

#include <EepromSecureData.h>

Collaboration diagram for EepromSecureData< T >:

Public Member Functions

 EepromSecureData ()
 Construct a new Eeprom Secure Data object. More...
 
 EepromSecureData (const T &data)
 Construct a new Eeprom Secure Data object with initial data. More...
 
 ~EepromSecureData ()
 Destroy the Eeprom Secure Data object. More...
 
bool save ()
 Save data to EEPROM memory with CRC. More...
 
bool load (const T &defaultData=T())
 Load data from EEPROM memory with CRC check. More...
 
uint16_t size () const
 Get the size of the object with CRC.
 
T & data ()
 Get the data object.
 
const T & data () const
 Get the data object as const.
 
 operator T& ()
 Overloaded cast operator to T &. More...
 
 operator const T & () const
 Overloaded cast operator to const T &. More...
 
T * operator& ()
 Overloaded cast operator to T *. More...
 
const T * operator& () const
 Overloaded cast operator to const T. More...
 
T & operator= (const T &t)
 Overloaded assignment operator from T.
 
EepromSecureDataoperator= (const EepromSecureData &rhs)
 Overloaded assignment operator from EepromSecureData.
 
bool operator== (const EepromSecureData &rhs) const
 Overloaded equality operator.
 
bool operator!= (const EepromSecureData &rhs) const
 Overloaded not-equality operator.
 

Detailed Description

template<class T>
class EepromSecureData< T >

CRC-controlled EEPROM memory storage template class.

Template Parameters
Tdata type

Definition at line 17 of file EepromSecureData.h.

Constructor & Destructor Documentation

◆ EepromSecureData() [1/2]

template<class T >
EepromSecureData< T >::EepromSecureData ( )
inline

Construct a new Eeprom Secure Data object.

EEPROM memory is allocated automatically, EepromBase::counter is updated with the size of the object

Definition at line 25 of file EepromSecureData.h.

References EepromSecureData< T >::size().

Here is the call graph for this function:

◆ EepromSecureData() [2/2]

template<class T >
EepromSecureData< T >::EepromSecureData ( const T &  data)
inline

Construct a new Eeprom Secure Data object with initial data.

Parameters
datainitial data

Definition at line 35 of file EepromSecureData.h.

References EepromSecureData< T >::data().

Here is the call graph for this function:

◆ ~EepromSecureData()

template<class T >
EepromSecureData< T >::~EepromSecureData ( )
inline

Destroy the Eeprom Secure Data object.

EEPROM memory is saved automatically

Definition at line 44 of file EepromSecureData.h.

References EepromSecureData< T >::save().

Here is the call graph for this function:

Member Function Documentation

◆ load()

template<class T >
bool EepromSecureData< T >::load ( const T &  defaultData = T())
inline

Load data from EEPROM memory with CRC check.

Parameters
defaultDatadefault data if CRC check failed
Returns
true if CRC check passed, data restored from EEPROM memory
false if CRC check failed, data restored from defaultData

Definition at line 72 of file EepromSecureData.h.

References EepromSecureData< T >::save().

Here is the call graph for this function:

◆ operator const T &()

template<class T >
EepromSecureData< T >::operator const T & ( ) const
inline

Overloaded cast operator to const T &.

Returns
the data object

Definition at line 122 of file EepromSecureData.h.

◆ operator T&()

template<class T >
EepromSecureData< T >::operator T& ( )
inline

Overloaded cast operator to T &.

Returns
the data object

Definition at line 113 of file EepromSecureData.h.

◆ operator&() [1/2]

template<class T >
T* EepromSecureData< T >::operator& ( )
inline

Overloaded cast operator to T *.

Returns
pointer to the data object

Definition at line 131 of file EepromSecureData.h.

◆ operator&() [2/2]

template<class T >
const T* EepromSecureData< T >::operator& ( ) const
inline

Overloaded cast operator to const T.

Returns
pointer to the data object

Definition at line 140 of file EepromSecureData.h.

◆ save()

template<class T >
bool EepromSecureData< T >::save ( )
inline

Save data to EEPROM memory with CRC.

Returns
true

Definition at line 53 of file EepromSecureData.h.

Referenced by EepromSecureData< T >::load(), and EepromSecureData< T >::~EepromSecureData().