103
107
int vectorability() const { return fVectorability;} ///< returns when a signal can be vectorized
104
108
int boolean() const { return fBoolean; } ///< returns when a signal stands for a boolean value
106
interval getInterval() const { return fInterval; } ///< returns the interval (min dn max values) of a signal
110
interval getInterval() const { return fInterval; } ///< returns the interval (min dn max values) of a signal
112
void setCode(Tree code) { fCode = code; } ///< returns the interval (min dn max values) of a signal
113
Tree getCode() { return fCode; } ///< returns the interval (min dn max values) of a signal
109
116
virtual AudioType* promoteNature(int n) = 0; ///< promote the nature of a type
110
virtual AudioType* promoteVariability(int n) = 0; ///< promote the variability of a type
111
virtual AudioType* promoteComputability(int n) = 0; ///< promote the computability of a type
112
virtual AudioType* promoteVectorability(int n) = 0; ///< promote the vectorability of a type
117
virtual AudioType* promoteVariability(int n) = 0; ///< promote the variability of a type
118
virtual AudioType* promoteComputability(int n) = 0; ///< promote the computability of a type
119
virtual AudioType* promoteVectorability(int n) = 0; ///< promote the vectorability of a type
113
120
virtual AudioType* promoteBoolean(int n) = 0; ///< promote the booleanity of a type
114
121
//virtual AudioType* promoteInterval(const interval& i) = 0; ///< promote the interval of a type
117
virtual ostream& print(ostream& dst) const = 0; ///< print nicely a type
124
virtual ostream& print(ostream& dst) const = 0; ///< print nicely a type
125
virtual bool isMaximal() const = 0; ///< true when type is maximal (and therefore can't change depending of hypothesis)
120
128
void setInterval(const interval& r) { fInterval = r;}
225
241
SimpleType(int n, int v, int c, int vec, int b, const interval& i) : AudioType(n,v,c,vec,b,i) {
226
242
//cerr << "new simple type " << i << " -> " << *this << endl;
227
243
} ///< constructs a SimpleType from a nature a variability and a computability
229
245
virtual ostream& print(ostream& dst) const; ///< print a SimpleType
231
virtual AudioType* promoteNature(int n) { return new SimpleType(n|fNature, fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the nature of a type
232
virtual AudioType* promoteVariability(int v) { return new SimpleType(fNature, v|fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the variability of a type
233
virtual AudioType* promoteComputability(int c) { return new SimpleType(fNature, fVariability, c|fComputability, fVectorability, fBoolean, fInterval); } ///< promote the computability of a type
234
virtual AudioType* promoteVectorability(int vec) { return new SimpleType(fNature, fVariability, fComputability, vec|fVectorability, fBoolean, fInterval); } ///< promote the vectorability of a type
235
virtual AudioType* promoteBoolean(int b) { return new SimpleType(fNature, fVariability, fComputability, fVectorability, b|fBoolean, fInterval); } ///< promote the booleanity of a type
249
virtual AudioType* promoteNature(int n) { return makeSimpleType(n|fNature, fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the nature of a type
250
virtual AudioType* promoteVariability(int v) { return makeSimpleType(fNature, v|fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the variability of a type
251
virtual AudioType* promoteComputability(int c) { return makeSimpleType(fNature, fVariability, c|fComputability, fVectorability, fBoolean, fInterval); } ///< promote the computability of a type
252
virtual AudioType* promoteVectorability(int vec) { return makeSimpleType(fNature, fVariability, fComputability, vec|fVectorability, fBoolean, fInterval); } ///< promote the vectorability of a type
253
virtual AudioType* promoteBoolean(int b) { return makeSimpleType(fNature, fVariability, fComputability, fVectorability, b|fBoolean, fInterval); } ///< promote the booleanity of a type
236
254
// virtual AudioType* promoteInterval(const interval& i) {
237
255
// cerr << "promote to Interval " << i << endl;
238
256
// cerr << "for type : " << *this << endl;
239
// Type t = new SimpleType(fNature, fVariability, fComputability, fVectorability, fBoolean, i); ///< promote the interval of a type
257
// Type t = makeSimpleType(fNature, fVariability, fComputability, fVectorability, fBoolean, i); ///< promote the interval of a type
240
258
// cerr << "gives type " << *t << endl;
263
virtual bool isMaximal() const; ///< true when type is maximal (and therefore can't change depending of hypothesis)
247
inline Type intCast (Type t) { return new SimpleType(kInt, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
248
inline Type floatCast (Type t) { return new SimpleType(kReal, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
249
inline Type sampCast (Type t) { return new SimpleType(t->nature(), kSamp, t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
250
inline Type boolCast (Type t) { return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kBool, t->getInterval()); }
251
inline Type numCast (Type t) { return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kNum, t->getInterval()); }
252
inline Type vecCast (Type t) { return new SimpleType(t->nature(), t->variability(), t->computability(), kVect, t->boolean(), t->getInterval()); }
253
inline Type scalCast (Type t) { return new SimpleType(t->nature(), t->variability(), t->computability(), kScal, t->boolean(), t->getInterval()); }
254
inline Type truescalCast (Type t){ return new SimpleType(t->nature(), t->variability(), t->computability(), kTrueScal, t->boolean(), t->getInterval()); }
269
inline Type intCast (Type t) { return makeSimpleType(kInt, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
270
inline Type floatCast (Type t) { return makeSimpleType(kReal, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
271
inline Type sampCast (Type t) { return makeSimpleType(t->nature(), kSamp, t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
272
inline Type boolCast (Type t) { return makeSimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kBool, t->getInterval()); }
273
inline Type numCast (Type t) { return makeSimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kNum, t->getInterval()); }
274
inline Type vecCast (Type t) { return makeSimpleType(t->nature(), t->variability(), t->computability(), kVect, t->boolean(), t->getInterval()); }
275
inline Type scalCast (Type t) { return makeSimpleType(t->nature(), t->variability(), t->computability(), kScal, t->boolean(), t->getInterval()); }
276
inline Type truescalCast (Type t){ return makeSimpleType(t->nature(), t->variability(), t->computability(), kTrueScal, t->boolean(), t->getInterval()); }
256
278
inline Type castInterval (Type t, const interval& i)
258
return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), t->boolean(), i);
280
return makeSimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), t->boolean(), i);
281
303
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability(), t->boolean()),
282
304
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability and computability
284
TableType(const Type& t, int n, int v, int c, int vec) :
285
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability()|vec, t->boolean()),
286
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability, computability and vectorability
288
306
TableType(const Type& t, int n, int v, int c, int vec, int b) :
289
307
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability()|vec, t->boolean()|b),
290
308
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability, computability, vectorability and booleanity
292
TableType(const Type& t, int n, int v, int c, int vec, int b, const interval& i) :
293
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability()|vec, t->boolean()|b, i),
294
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability, computability, vectorability and booleanity
311
TableType(const Type& t, int n, int v, int c, int vec, int b, const interval& i) :
312
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability()|vec, t->boolean()|b, i),
313
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability, computability, vectorability and booleanity
315
TableType(const Type& t, int n, int v, int c, int vec) :
316
AudioType(t->nature()|n, t->variability()|v, t->computability()|c, t->vectorability()|vec, t->boolean()),
317
fContent(t) {} ///< construct a TableType with a content of a type t, promoting nature, variability, computability and vectorability
298
320
Type content() const { return fContent; } ///< return the type of data store in the table
299
321
virtual ostream& print(ostream& dst) const; ///< print a TableType
301
virtual AudioType* promoteNature(int n) { return new TableType(fContent, n|fNature, fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the nature of a type
302
virtual AudioType* promoteVariability(int v) { return new TableType(fContent, fNature, v|fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the variability of a type
303
virtual AudioType* promoteComputability(int c) { return new TableType(fContent, fNature, fVariability, c|fComputability, fVectorability, fBoolean, fInterval); } ///< promote the computability of a type
304
virtual AudioType* promoteVectorability(int vec) { return new TableType(fContent, fNature, fVariability, fComputability, vec|fVectorability, fBoolean, fInterval);}///< promote the vectorability of a type
305
virtual AudioType* promoteBoolean(int b) { return new TableType(fContent, fNature, fVariability, fComputability, fVectorability, b|fBoolean, fInterval); } ///< promote the booleanity of a type
306
//virtual AudioType* promoteInterval(const interval& i) { return new TableType(fContent, fNature, fVariability, fComputability, fVectorability, fBoolean, i); } ///< promote the interval of a type
323
virtual AudioType* promoteNature(int n) { return makeTableType(fContent, n|fNature, fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the nature of a type
324
virtual AudioType* promoteVariability(int v) { return makeTableType(fContent, fNature, v|fVariability, fComputability, fVectorability, fBoolean, fInterval); } ///< promote the variability of a type
325
virtual AudioType* promoteComputability(int c) { return makeTableType(fContent, fNature, fVariability, c|fComputability, fVectorability, fBoolean, fInterval); } ///< promote the computability of a type
326
virtual AudioType* promoteVectorability(int vec) { return makeTableType(fContent, fNature, fVariability, fComputability, vec|fVectorability, fBoolean, fInterval);}///< promote the vectorability of a type
327
virtual AudioType* promoteBoolean(int b) { return makeTableType(fContent, fNature, fVariability, fComputability, fVectorability, b|fBoolean, fInterval); } ///< promote the booleanity of a type
328
//virtual AudioType* promoteInterval(const interval& i) { return makeTableType(fContent, fNature, fVariability, fComputability, fVectorability, fBoolean, i); } ///< promote the interval of a type
330
virtual bool isMaximal() const; ///< true when type is maximal (and therefore can't change depending of hypothesis)
320
343
vector<Type> fComponents;
323
TupletType(const vector<Type>& vt) :
324
AudioType(mergenature(vt),mergevariability(vt),mergecomputability(vt),mergevectorability(vt),mergeboolean(vt), mergeinterval(vt)),
327
TupletType(const vector<Type>& vt, int n, int v, int c) :
328
AudioType(n|mergenature(vt), v|mergevariability(vt), c|mergecomputability(vt),mergevectorability(vt),mergeboolean(vt), interval()),
331
TupletType(const vector<Type>& vt, int n, int v, int c, int vec) :
332
AudioType(n|mergenature(vt), v|mergevariability(vt), c|mergecomputability(vt), vec|mergevectorability(vt), mergeboolean(vt), interval()),
350
TupletType(const vector<Type>& vt) :
351
AudioType(mergenature(vt),mergevariability(vt),mergecomputability(vt),mergevectorability(vt),mergeboolean(vt), mergeinterval(vt)),
335
354
TupletType(const vector<Type>& vt, int n, int v, int c, int vec, int b, const interval& i) :
336
355
AudioType(n|mergenature(vt), v|mergevariability(vt), c|mergecomputability(vt), vec|mergevectorability(vt), b|mergeboolean(vt), i),