save memory by moving allowReset and nvsName into vtable
This commit is contained in:
1 parent
50d24f0d25
commit
2ec9d89594
4 files changed
+43
-54
No files matched your search
@@ -13,9 +13,6 @@
|
||||
#include "cppmacros.h"
|
||||
|
||||
namespace espconfig {
|
||||
enum class AllowReset { NoReset, DoReset };
|
||||
constexpr auto NoReset = AllowReset::NoReset;
|
||||
constexpr auto DoReset = AllowReset::DoReset;
|
||||
|
||||
using ConfigStatusReturnType = tl::expected<void, std::string>;
|
||||
|
||||
@@ -24,7 +21,7 @@ class ConfigWrapperInterface
|
||||
CPP_DISABLE_COPY_MOVE(ConfigWrapperInterface)
|
||||
|
||||
public:
|
||||
ConfigWrapperInterface(AllowReset allowReset, const char *nvsName);
|
||||
ConfigWrapperInterface() = default;
|
||||
virtual ~ConfigWrapperInterface() = default;
|
||||
|
||||
virtual const char *type() const = 0;
|
||||
@@ -36,14 +33,12 @@ public:
|
||||
virtual ConfigStatusReturnType reset(nvs_handle_t nvsHandle) = 0;
|
||||
virtual ConfigStatusReturnType forceReset(nvs_handle_t nvsHandle) = 0;
|
||||
|
||||
bool allowReset() const { return m_allowReset; }
|
||||
const char *nvsName() const { return m_nvsName; }
|
||||
virtual bool allowReset() const = 0;
|
||||
virtual const char *nvsName() const = 0;
|
||||
bool touched() const { return m_touched; }
|
||||
bool loaded() const { return m_loaded; }
|
||||
|
||||
protected:
|
||||
const bool m_allowReset;
|
||||
const char * const m_nvsName;
|
||||
bool m_touched{};
|
||||
bool m_loaded{};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user