Fixed namespace issues

This commit is contained in:
2021-10-03 18:38:40 +02:00
parent 08e62500ea
commit 8af9f032cc
13 changed files with 14 additions and 45 deletions

View File

@@ -13,10 +13,12 @@
#include "espchrono.h"
#define INSTANTIATE_CONFIGMANAGER_TEMPLATES(Type) \
namespace espconfig { \
template esp_err_t ConfigManager<Type>::init(); \
/* template bool ConfigManager<Type>::erase(); */ \
template ConfigStatusReturnType ConfigManager<Type>::reset(); \
template ConfigWrapperInterface *ConfigManager<Type>::findConfigByKey(std::string_view key);
template ConfigWrapperInterface *ConfigManager<Type>::findConfigByKey(std::string_view key); \
} // namespace espconfig
namespace espconfig {
namespace {

View File

@@ -4,10 +4,10 @@
#include "configutils_priv_enum.h"
#include "espchrono.h"
namespace espconfig {
IMPLEMENT_NVS_GET_SET_ENUM(espchrono::DayLightSavingMode)
namespace espconfig {
#define IMPLEMENT_NVS_GET_SET_CHRONO(Name) \
inline esp_err_t nvs_get(nvs_handle handle, const char* key, Name* out_value) \
{ \

View File

@@ -4,8 +4,4 @@
#include "configutils_priv_enum.h"
#include "taskutils.h"
namespace espconfig {
IMPLEMENT_NVS_GET_SET_ENUM(espcpputils::CoreAffinity)
} // namespace espconfig

View File

@@ -10,6 +10,7 @@
#include "configutils_base.h"
#define IMPLEMENT_NVS_GET_SET_ENUM(Name) \
namespace espconfig { \
inline esp_err_t nvs_get(nvs_handle handle, const char* key, Name* out_value) \
{ \
std::underlying_type_t<Name> temp; \
@@ -22,4 +23,5 @@
inline esp_err_t nvs_set(nvs_handle handle, const char* key, Name value) \
{ \
return nvs_set(handle, key, std::underlying_type_t<Name>(value)); \
}
} \
} // namespace espconfig

View File

@@ -6,8 +6,4 @@
// local includes
#include "configutils_priv_enum.h"
namespace espconfig {
IMPLEMENT_NVS_GET_SET_ENUM(sntp_sync_mode_t)
} // namespace espconfig

View File

@@ -3,8 +3,6 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::cpputils::toString;
#include "configwrapper_priv.h"
namespace espconfig {
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(bool)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(uint8_t)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(int8_t)
@@ -17,5 +15,3 @@ INSTANTIATE_CONFIGWRAPPER_TEMPLATES(int64_t)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(float)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(double)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::string)
} // namespace espconfig

View File

@@ -2,7 +2,4 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::cpputils::toString;
#include "configwrapper_priv.h"
namespace espconfig {
using ColorHelper = cpputils::ColorHelper;
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(ColorHelper)
} // namespace espconfig
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(cpputils::ColorHelper)

View File

@@ -2,18 +2,8 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::espchrono::toString;
#include "configwrapper_priv.h"
namespace espconfig {
using DayLightSavingMode = espchrono::DayLightSavingMode;
using milliseconds32 = espchrono::milliseconds32;
using seconds32 = espchrono::seconds32;
using minutes32 = espchrono::minutes32;
using hours32 = espchrono::hours32;
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espchrono::DayLightSavingMode)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espchrono::milliseconds32)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espchrono::seconds32)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espchrono::minutes32)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espchrono::hours32)
} // namespace espconfig

View File

@@ -2,7 +2,4 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::espcpputils::toString;
#include "configwrapper_priv.h"
namespace espconfig {
using CoreAffinity = espcpputils::CoreAffinity;
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(CoreAffinity)
} // namespace espconfig
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(espcpputils::CoreAffinity)

View File

@@ -2,7 +2,4 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::wifi_stack::toString;
#include "configwrapper_priv.h"
namespace espconfig {
using ip_address_t = wifi_stack::ip_address_t;
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(ip_address_t)
} // namespace espconfig
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(wifi_stack::ip_address_t)

View File

@@ -3,8 +3,6 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::cpputils::toString;
#include "configwrapper_priv.h"
namespace espconfig {
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<int8_t>)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<uint8_t>)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<int16_t>)
@@ -15,5 +13,3 @@ INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<int64_t>)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<uint64_t>)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<float>)
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(std::optional<double>)
} // namespace espconfig

View File

@@ -18,6 +18,7 @@
#include "cpputils.h"
#define INSTANTIATE_CONFIGWRAPPER_TEMPLATES(TYPE) \
namespace espconfig { \
template ConfigWrapper<TYPE>::ConfigWrapper(const TYPE &defaultValue, AllowReset allowReset, ConstraintCallback constraintCallback, const char *nvsName); \
template ConfigWrapper<TYPE>::ConfigWrapper(TYPE &&defaultValue, AllowReset allowReset, ConstraintCallback constraintCallback, const char *nvsName); \
template ConfigWrapper<TYPE>::ConfigWrapper(const ConfigWrapper<TYPE> &factoryConfig, ConstraintCallback constraintCallback, const char *nvsName); \
@@ -31,7 +32,8 @@
template ConfigStatusReturnType ConfigWrapper<TYPE>::reset(nvs_handle_t nvsHandle); \
template ConfigStatusReturnType ConfigWrapper<TYPE>::forceReset(nvs_handle_t nvsHandle); \
template ConfigConstraintReturnType ConfigWrapper<TYPE>::checkValue(value_t value) const; \
template ConfigStatusReturnType ConfigWrapper<TYPE>::writeToFlash(nvs_handle_t nvsHandle, value_t value);
template ConfigStatusReturnType ConfigWrapper<TYPE>::writeToFlash(nvs_handle_t nvsHandle, value_t value); \
} // namespace espconfig
namespace espconfig {
namespace {

View File

@@ -3,6 +3,4 @@
#define CONFIGWRAPPER_TOSTRING_USINGS using ::espcpputils::toString;
#include "configwrapper_priv.h"
namespace espconfig {
INSTANTIATE_CONFIGWRAPPER_TEMPLATES(sntp_sync_mode_t)
} // namespace espconfig