annotate presetManager.h @ 3:43df75088d85

fixed sticking scroll more file fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 03 Dec 2012 18:29:07 +0000
parents 307e5fb699fb
children 7541aeaebcdc
rev   line source
rt300@0 1 //
rt300@0 2 // presetManager.h
rt300@0 3 // oscSenderExample
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 07/11/2012.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9 #ifndef __oscSenderExample__presetManager__
rt300@0 10 #define __oscSenderExample__presetManager__
rt300@0 11
rt300@0 12 #include <iostream>
rt300@0 13 #include "ofMain.h"
rt300@0 14 #include "ofxiPhone.h"
rt300@0 15 #include "ofxiPhoneExtras.h"
rt300@0 16 #include "2dvector.h"
rt300@3 17 #include "grid.h"
rt300@3 18
rt300@0 19
rt300@0 20 //---------------------------------------------------------------------------
rt300@0 21 class Preset{
rt300@3 22 public:
rt300@0 23
rt300@0 24 int presetID;
rt300@0 25 string name;
rt300@0 26 TwoVector coordinates;
rt300@3 27
rt300@0 28 Preset(TwoVector acoord, string aname,int aID){
rt300@0 29 coordinates = acoord;
rt300@0 30 name = aname;
rt300@0 31 presetID = aID;
rt300@3 32
rt300@3 33 };
rt300@3 34 Preset(int aID){
rt300@3 35 coordinates.setCoord(0.0,0.0);
rt300@3 36 name = "Blank";
rt300@3 37 presetID = aID;
rt300@0 38
rt300@0 39 };
rt300@3 40
rt300@0 41 };
rt300@3 42
rt300@3 43
rt300@3 44 //---------------------------------------------------------------------------
rt300@3 45 inline ostream& operator<<(ostream & os, const Preset& p)
rt300@3 46 {
rt300@3 47 os << "Name:" << p.name << "|";
rt300@3 48 os << "Coord:" << p.coordinates << "\n";
rt300@3 49
rt300@3 50 return(os);
rt300@3 51 }
rt300@3 52 //---------------------------------------------------------------------------
rt300@3 53 inline istream& operator>>(istream & is, Preset& p)
rt300@3 54 {
rt300@3 55 //um
rt300@3 56 return(is);
rt300@3 57 }
rt300@0 58 //---------------------------------------------------------------------------
rt300@0 59 class PresetManager{
rt300@0 60 public:
rt300@0 61 int nextID;
rt300@3 62 int timesOpened;
rt300@0 63 // names values
rt300@0 64 // check if already there
rt300@0 65 // find and return all(?) presets within a certain coordinate range
rt300@0 66 vector<Preset *> thePresets; // we want vector ? or list? pointers using new?
rt300@0 67
rt300@0 68 int addPreset(TwoVector coord, string name); // returns id or negative error number
rt300@0 69 TwoVector recallPreset(int presetID); // by name ? id?
rt300@0 70 TwoVector recallPreset(string name); // by name ? id?
rt300@0 71 vector<TwoVector > getPresetsInRange(TwoVector min, TwoVector max);
rt300@0 72
rt300@0 73 void startupLoadAll(); // get stuff from XML
rt300@0 74 void exitAndSaveAll(); // save to XML, delete presets array (?)
rt300@0 75
rt300@0 76 PresetManager();
rt300@0 77 };
rt300@0 78
rt300@0 79 #endif /* defined(__oscSenderExample__presetManager__) */