view 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
line wrap: on
line source
//
//  presetManager.h
//  oscSenderExample
//
//  Created by Robert Tubb on 07/11/2012.
//
//

#ifndef __oscSenderExample__presetManager__
#define __oscSenderExample__presetManager__

#include <iostream>
#include "ofMain.h"
#include "ofxiPhone.h"
#include "ofxiPhoneExtras.h"
#include "2dvector.h"
#include "grid.h"


//---------------------------------------------------------------------------
class Preset{
public:

    int presetID;
    string name;
    TwoVector coordinates;
    
    Preset(TwoVector acoord, string aname,int aID){
        coordinates = acoord;
        name = aname;
        presetID = aID;

    };
    Preset(int aID){
        coordinates.setCoord(0.0,0.0);
        name = "Blank";
        presetID = aID;
        
    };

};


//---------------------------------------------------------------------------
inline ostream& operator<<(ostream & os, const Preset& p)
{
    os << "Name:" << p.name << "|";
    os << "Coord:" << p.coordinates << "\n";
    
    return(os);
}
//---------------------------------------------------------------------------
inline istream& operator>>(istream & is, Preset& p)
{
    //um
    return(is);
}
//---------------------------------------------------------------------------
class PresetManager{
public:
    int nextID;
    int timesOpened;
    // names values
    // check if already there
    // find and return all(?) presets within a certain coordinate range
    vector<Preset *> thePresets; // we want vector ? or list? pointers using new?
    
    int addPreset(TwoVector coord, string name); // returns id or negative error number
    TwoVector recallPreset(int presetID); // by name ? id?
    TwoVector recallPreset(string name); // by name ? id?
    vector<TwoVector > getPresetsInRange(TwoVector min, TwoVector max);
    
    void startupLoadAll();  // get stuff from XML
    void exitAndSaveAll();  // save to XML, delete presets array (?)
    
    PresetManager();
};

#endif /* defined(__oscSenderExample__presetManager__) */