Mercurial > hg > tweakathon2ios
diff presetManager.h @ 18:36cdb73691da
PIMPL speed compile?
eventlogger now just saves as it goes
more refactoring
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Oct 2014 15:00:14 +0100 |
parents | 2a7320a8cbed |
children | bd23c1b922be |
line wrap: on
line diff
--- a/presetManager.h Tue Oct 21 18:58:25 2014 +0100 +++ b/presetManager.h Wed Oct 22 15:00:14 2014 +0100 @@ -35,7 +35,7 @@ unsigned long long creationTime; // datetime that preset was created milliseconds string imageFileName; vector<int> CCValues; // the actual data - bool isFilled; + //bool isFilled; PresetIconView* iconView; // from save button press Preset(vector<int> aCCValues, @@ -45,12 +45,12 @@ unsigned int uid, string imageFile = ""){ CCValues = aCCValues; - if (CCValues.size()){ - isFilled = true; - - }else{ - isFilled = false; - } +// if (CCValues.size()){ +// isFilled = true; +// +// }else{ +// isFilled = false; +// } name = aname; creatorUserName = un; @@ -115,16 +115,14 @@ vector<int> getValues(){ return CCValues; } - void setValues(vector<int> v){ + + void overwriteValues(vector<int> v){ + if (v.size() != CCValues.size()){ + cout << "ERROR: wrong size for vector of CCValues" << endl; + } CCValues = v; double timemsd = [NSDate timeIntervalSinceReferenceDate]; creationTime = (unsigned long long)(timemsd*1000); - if (CCValues.size()){ - isFilled = true; - - }else{ - isFilled = false; - } } }; @@ -133,26 +131,19 @@ class PresetManager{ public: PresetManager(); + void savePreset(Preset * aPreset); void savePreset(string name, vector<int> stuff); void generatePresetSlot(const string name, const string imagefn); void saveFilledSlotToFile(); - vector<int> recallPreset(int presetID); - vector<int> recallPreset(string name); + vector<int> getPresetValuesForID(int presetID); + vector<int> getPresetValuesForName(string name); void startLoadAll(); // load everything from the json file void exitAndSaveAll(); // save stuff to the json file void printAll(); void clearAll(); - Preset* getPresetAtIndex(int index){ - - if (index >= thePresets.size()){ - cout << "ERROR: index " << index << " exceeds number of presets " << thePresets.size() << endl; - return NULL; - }else{ - return thePresets[index]; - - } - }; + Preset* getPresetAtIndex(int index); + int getNumberOfPresets(){return thePresets.size();}; protected: string presetFileName; int nextID;