1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

add some memory diagnostics

This commit is contained in:
andreas
2021-10-30 12:01:50 +02:00
parent 56aaf595b4
commit e7b2c6e756
14 changed files with 54 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
#include "GwBoatData.h"
GwBoatData::GwBoatData(GwLog *logger){
this->logger=logger;
}
GwBoatData::~GwBoatData(){
GwBoatItemBase::GwBoatItemMap::iterator it;

View File

@@ -63,13 +63,14 @@ template<class T> class GwBoatItem : public GwBoatItemBase{
(*doc)[name]=getData(true);
}
private:
static GwBoatItem<T> *findOrCreate(GwBoatItemMap *values, String name,bool doCreate=true,
static GwBoatItem<T> *findOrCreate(GwLog *logger,GwBoatItemMap *values, String name,bool doCreate=true,
long invalidTime=GwBoatItemBase::INVALID_TIME, Formatter fmt=NULL){
GwBoatItemMap::iterator it;
if ((it=values->find(name)) != values->end()){
return (GwBoatItem<T> *)it->second;
}
if (! doCreate) return NULL;
LOG_DEBUG(GwLog::DEBUG,"creating boat data item %s",name.c_str());
GwBoatItem<T> *ni=new GwBoatItem<T>(invalidTime,fmt);
(*values)[name]=ni;
return ni;
@@ -83,7 +84,7 @@ template<class T> class GwBoatItem : public GwBoatItemBase{
* */
#define GWBOATDATA_IMPL_ITEM(type,name) GwBoatItem<type> *get##name##Item(String iname,bool doCreate=true, \
long invalidTime=GwBoatItemBase::INVALID_TIME, GwBoatItem<type>::Formatter fmt=NULL){ \
return GwBoatItem<type>::findOrCreate(&values,iname, doCreate, \
return GwBoatItem<type>::findOrCreate(logger,&values,iname, doCreate, \
invalidTime,fmt);\
}