Open Ephys GUI
 All Classes Functions Variables Pages
Parameter.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __PARAMETER_H_62922AE5__
25 #define __PARAMETER_H_62922AE5__
26 
27 #include "../../JuceLibraryCode/JuceHeader.h"
28 // #include "Editors/GenericEditor.h"
29 // #include "GenericProcessor.h"
30 // #include "../AccessClass.h"
31 
32 #include <stdio.h>
33 
34 /**
35 
36  Class for holding user-definable processor parameters.
37 
38  @see GenericProcessor, GenericEditor
39 
40 */
41 
42 class Parameter
43 {
44 public:
45 
46  Parameter(const String& name_, bool defaultVal, int ID);
47  Parameter(const String& name_, float low, float high, float defaultVal, int ID);
48  Parameter(const String& name_, Array<var> a, int defaultVal, int ID);
49 
50  ~Parameter() {}
51 
52  const String& getName() {return name;}
53  const String& getDescription() {return description;}
54  void addDescription(const String& desc) {description = desc;}
55 
56  var getDefaultValue() {return defaultValue;}
57 
58  int getID() {return parameterId;}
59 
60  Array<var> getPossibleValues() {return possibleValues;}
61  void setValue(float val, int chan);
62 
63  var operator[](int chan) {return values[chan];}
64  Parameter& operator=(const Parameter& other);
65 
66  bool isBoolean() {return isBool;}
67  bool isContinuous() {return isCont;}
68  bool isDiscrete() {return isDisc;}
69 
70 private:
71 
72 
73  const String name;
74  String description;
75 
76  int parameterId;
77 
78  bool isBool, isCont, isDisc;
79 
80  var defaultValue;
81  Array<var> values;
82  Array<var> possibleValues;
83 
84 };
85 
86 // class BooleanParameter : public Parameter
87 // {
88 // public:
89 // BooleanParameter(const String name_, bool defaultVal);
90 // ~BooleanParameter() {}
91 
92 // Array<var> getPossibleValues();
93 // void setValue(float val, int chan);
94 // void* operator[](int chan);
95 
96 // bool isBoolean() {return true;}
97 
98 // bool defaultValue;
99 
100 // Array<bool> values;
101 
102 // };
103 
104 // class ContinuousParameter : public Parameter
105 // {
106 // public:
107 // ContinuousParameter(const String name_, float low, float high, float defaultVal);
108 // ~ContinuousParameter() {}
109 
110 // Array<var> getPossibleValues();
111 // void setValue(float val, int chan);
112 // void* operator[](int chan);
113 
114 // bool isContinuous() {return true;}
115 
116 // float low, high, defaultValue;
117 
118 // Array<float> values;
119 
120 // };
121 
122 
123 // class DiscreteParameter : public Parameter
124 // {
125 // public:
126 // DiscreteParameter(const String name_, Array<var> a, int defaultVal);
127 // ~DiscreteParameter() {}
128 
129 // Array<var> getPossibleValues();
130 // void setValue(float val, int chan);
131 // void* operator[](int chan);
132 
133 // bool isDiscrete() {return true;}
134 
135 // Array<var> possibleValues;
136 // Array<var> values;
137 
138 // int defaultValue;
139 // };
140 
141 
142 // template <class Type>
143 
144 // class Parameter
145 // {
146 // public:
147 // Parameter(const String& name_,
148 // Type defaultVal,
149 // Array<var> possibleVals = Array<var>()) :
150 // name(name_), defaultValue(defaultVal), possibleValues(possibleVals)
151 // {
152 
153 // }
154 
155 // Type operator[](int chan) {return values[chan];}
156 
157 // private:
158 
159 // const String name;
160 // Type defaultValue;
161 // Array<Type> values;
162 // Array<var> possibleValues;
163 
164 // };
165 
166 
167 #endif // __PARAMETER_H_62922AE5__