SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::Saveable Class Reference

Interface for saveable objects. More...

#include <sensesp/system/saveable.h>

Inheritance diagram for sensesp::Saveable:
[legend]

Public Member Functions

 Saveable (const String &config_path)
 
virtual bool load ()
 Load and populate the object from a persistent storage.
 
virtual bool refresh ()
 Refresh the object. This may or may not access the persistent storage but is not expected to overwrite the object's state.
 
virtual bool save ()
 Save the object to a persistent storage.
 
virtual bool clear ()
 Delete the data from a persistent storage.
 
const String & get_config_path () const
 

Protected Attributes

const String config_path_
 

Detailed Description

Interface for saveable objects.

Saveable objects can be saved and loaded from a persistent storage.

Definition at line 18 of file saveable.h.

Constructor & Destructor Documentation

◆ Saveable()

sensesp::Saveable::Saveable ( const String & config_path)
inline

Definition at line 20 of file saveable.h.

Member Function Documentation

◆ clear()

virtual bool sensesp::Saveable::clear ( )
inlinevirtual

Delete the data from a persistent storage.

Returns
true
false

Reimplemented in sensesp::FileSystemSaveable.

Definition at line 53 of file saveable.h.

◆ get_config_path()

const String & sensesp::Saveable::get_config_path ( ) const
inline

Definition at line 55 of file saveable.h.

◆ load()

virtual bool sensesp::Saveable::load ( )
inlinevirtual

Load and populate the object from a persistent storage.

Returns
true Object loaded successfully
false

Reimplemented in sensesp::FileSystemSaveable.

Definition at line 28 of file saveable.h.

◆ refresh()

virtual bool sensesp::Saveable::refresh ( )
inlinevirtual

Refresh the object. This may or may not access the persistent storage but is not expected to overwrite the object's state.

This is useful when the object's state may have changed outside of the object's control.

Returns
true Object refreshed successfully
false

Definition at line 39 of file saveable.h.

◆ save()

virtual bool sensesp::Saveable::save ( )
inlinevirtual

Save the object to a persistent storage.

Returns
true
false

Reimplemented in sensesp::FileSystemSaveable.

Definition at line 46 of file saveable.h.

Member Data Documentation

◆ config_path_

const String sensesp::Saveable::config_path_
protected

Definition at line 58 of file saveable.h.


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