blob: 501f4374249d0dbff9d19a6721901fa11a820a4c [file] [log] [blame] [raw]
#pragma once
#include <cstdio>
#include "types.h"
class SaveState :
public LinkedList<SaveState>
{
public:
SaveState();
~SaveState();
static bool openSnapshot(char *fname, bool isWrite);
void setId(const char *id);
char *getId() { return componentName; }
static SaveState *findId(const char *id);
protected:
virtual void dumpState() = 0;
virtual void readState() = 0;
static void saveVar(void *p, size_t size);
static size_t readVar(void *p, size_t size);
private:
static void closeSnapshot();
static FILE *ssfp;
char componentName[8];
};