You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
#ifndef __STORAGE_PROVIDER_HEADERS__
|
|
#define __STORAGE_PROVIDER_HEADERS__
|
|
|
|
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../components/base/basicFunctionality.h"
|
|
#include "../../components/base/basicLogCollection.h"
|
|
#include "../../alg/generic/md5.h"
|
|
|
|
#ifdef __linux__
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
#define STORAGE_DIR_MODE 0x1FF
|
|
#define STORAGE_FILE_MODE 0x1B6
|
|
#else
|
|
#include <direct.h>
|
|
#endif
|
|
|
|
|
|
class storageProvider{
|
|
private:
|
|
basicLogCollection *m_pLog;
|
|
CSTR m_pCWD;
|
|
CSTR m_pSeriesBase;
|
|
CSTR m_pEntryFolder;
|
|
U32 m_nSeriesCounter;
|
|
CSTR m_pBasePath;
|
|
basicMutex m_mCounterProtectorMutex;
|
|
public:
|
|
// Method to fetch singleton instance.
|
|
static storageProvider* getInstance(CSTR Base = "data/storage");
|
|
~storageProvider();
|
|
bool startNewSeries(void);
|
|
bool startNewEntry(void);
|
|
CSTR getCurrentFilePath(void);
|
|
CSTR getNewFileName(CSTR JustFileName = NULL);
|
|
CSTR getStorageBase(void) { return m_pBasePath; };
|
|
protected:
|
|
// Constructor - protected so users cannot call it.
|
|
explicit storageProvider(CSTR BasePath);
|
|
private:
|
|
// private static member referencing the single instance of the object
|
|
// TODO: Replace basicEventHeap with the type of object you want to
|
|
// return the single instance of
|
|
static storageProvider* _instance;
|
|
};
|
|
|
|
#endif
|
|
|