#ifndef CCACHE #define CCACHE #include #include #include #include "safe_vector.hpp" #include "disc.h" //#include "gecko.h" using namespace std; const char io[4][5] = { "wb", "rb", "ab", "wb", }; enum CMode { SAVE, LOAD, ADD, REMOVE }; template class CCache { public: CCache(T &tmp, string path, u32 index, CMode mode); /* Load/Save One */ CCache(safe_vector &list, string path, CMode mode); /* Load/Save All */ CCache(safe_vector &list, string path, T tmp, CMode mode); /* Add One */ CCache(safe_vector &list, string path, u32 index, CMode mode); /* Remove One */ ~CCache(); private: void SaveAll(safe_vector list); void SaveOne(T tmp, u32 index); void LoadAll(safe_vector &list); void LoadOne(T &tmp, u32 index); void AddOne(safe_vector &list, T tmp); void RemoveOne(safe_vector &list, u32 index); FILE *cache; string filename; }; #endif