#include <vector>
#include <string>
#include <iostream>
#include "smartpointer.hh"
#include "interval.hh"
Go to the source code of this file.
Classes | |
class | AudioType |
The Root class for all audio data types. More... | |
class | SimpleType |
The type of a simple numeric audio signal. More... | |
class | TableType |
The type of a table of audio data. More... | |
class | TupletType |
The type of a tuplet of data. More... | |
Typedefs | |
typedef P< AudioType > | Type |
Enumerations | |
enum | { kInt = 0, kReal = 1 } |
enum | { kNum = 0, kBool = 1 } |
enum | { kKonst = 0, kBlock = 1, kSamp = 3 } |
enum | { kComp = 0, kInit = 1, kExec = 3 } |
enum | { kVect = 0, kScal = 1, kTrueScal = 3 } |
Functions | |
ostream & | operator<< (ostream &s, const AudioType &n) |
int | mergenature (const vector< Type > &v) |
Return the nature of a vector of types. | |
int | mergevariability (const vector< Type > &v) |
Return the variability of a vector of types. | |
int | mergecomputability (const vector< Type > &v) |
Return the computability of a vector of types. | |
int | mergevectorability (const vector< Type > &v) |
Return the vectorability of a vector of types. | |
int | mergeboolean (const vector< Type > &v) |
Return the booleanity of a vector of types. | |
interval | mergeinterval (const vector< Type > &v) |
Return the interval of a vector of types. | |
Type | intCast (Type t) |
Type | floatCast (Type t) |
Type | sampCast (Type t) |
Type | boolCast (Type t) |
Type | numCast (Type t) |
Type | vecCast (Type t) |
Type | scalCast (Type t) |
Type | truescalCast (Type t) |
Type | castInterval (Type t, const interval &i) |
Type | table (const Type &t) |
Type | operator| (const Type &t1, const Type &t2) |
Type | operator* (const Type &t1, const Type &t2) |
bool | operator== (const Type &t1, const Type &t2) |
bool | operator<= (const Type &t1, const Type &t2) |
bool | operator!= (const Type &t1, const Type &t2) |
bool | operator< (const Type &t1, const Type &t2) |
bool | operator> (const Type &t1, const Type &t2) |
bool | operator>= (const Type &t1, const Type &t2) |
SimpleType * | isSimpleType (AudioType *t) |
TableType * | isTableType (AudioType *t) |
TupletType * | isTupletType (AudioType *t) |
ostream & | operator<< (ostream &dst, const SimpleType &t) |
ostream & | operator<< (ostream &dst, const Type &t) |
ostream & | operator<< (ostream &dst, const TableType &t) |
ostream & | operator<< (ostream &dst, const TupletType &t) |
Type | checkInt (Type t) |
verifie que t est entier | |
Type | checkKonst (Type t) |
verifie que t est constant | |
Type | checkInit (Type t) |
verifie que t est connu a l'initialisation | |
Type | checkIntParam (Type t) |
verifie que t est connu a l'initialisation, constant et entier | |
Type | checkWRTbl (Type tbl, Type wr) |
verifie que wr est compatible avec le contenu de tbl | |
int | checkDelayInterval (Type t) |
Check if the interval of t is appropriate for a delay. | |
string | cType (Type t) |
Variables | |
Type | TINT |
Type | TREAL |
Type | TKONST |
Type | TBLOCK |
Type | TSAMP |
Type | TCOMP |
Type | TINIT |
Type | TEXEC |
Type | TINPUT |
Type | TGUI |
Type | INT_TGUI |
Type | TREC |
Definition at line 71 of file sigtype.hh.
anonymous enum |
anonymous enum |
anonymous enum |
Definition at line 55 of file sigtype.hh.
anonymous enum |
Definition at line 56 of file sigtype.hh.
anonymous enum |
Definition at line 57 of file sigtype.hh.
Definition at line 250 of file sigtype.hh.
References kBool.
00250 { return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kBool, t->getInterval()); }
Definition at line 256 of file sigtype.hh.
Referenced by TanPrim::infereSigType(), SqrtPrim::infereSigType(), SinPrim::infereSigType(), infereSigType(), RintPrim::infereSigType(), RemainderPrim::infereSigType(), PowPrim::infereSigType(), MinPrim::infereSigType(), MaxPrim::infereSigType(), LogPrim::infereSigType(), Log10Prim::infereSigType(), and CosPrim::infereSigType().
00257 { 00258 return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), t->boolean(), i); 00259 }
int checkDelayInterval | ( | Type | t | ) |
Check if the interval of t is appropriate for a delay.
Check if the interval of t is appropriate for a delay.
Definition at line 279 of file sigtype.cpp.
References interval::hi, interval::lo, and interval::valid.
Referenced by OccMarkup::incOcc().
00280 { 00281 interval i = t->getInterval(); 00282 if (i.valid && i.lo >= 0) { 00283 return int(i.hi+0.5); 00284 } else { 00285 //cerr << "checkDelayInterval failed for : " << i << endl; 00286 return -1; 00287 } 00288 }
verifie que t est connu a l'initialisation
Definition at line 249 of file sigtype.cpp.
References kInit.
Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().
00250 { 00251 // verifie que t est connu a l'initialisation 00252 if (t->computability() > kInit) { 00253 cerr << "Error : checkInit failed for type " << t << endl; 00254 exit(1); 00255 } 00256 return t; 00257 }
verifie que t est entier
Definition at line 228 of file sigtype.cpp.
References isSimpleType(), kInt, and AudioType::nature().
Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().
00229 { 00230 // verifie que t est entier 00231 SimpleType* st = isSimpleType(t); 00232 if (st == 0 || st->nature() > kInt) { 00233 cerr << "Error : checkInt failed for type " << t << endl; 00234 exit(1); 00235 } 00236 return t; 00237 }
verifie que t est connu a l'initialisation, constant et entier
Definition at line 259 of file sigtype.cpp.
References checkInit(), checkInt(), and checkKonst().
00260 { 00261 return checkInit(checkKonst(checkInt(t))); 00262 }
verifie que t est constant
Definition at line 239 of file sigtype.cpp.
References kKonst.
Referenced by checkIntParam(), infereDocConstantTblType(), and infereDocWriteTblType().
00240 { 00241 // verifie que t est constant 00242 if (t->variability() > kKonst) { 00243 cerr << "Error : checkKonst failed for type " << t << endl; 00244 exit(1); 00245 } 00246 return t; 00247 }
verifie que wr est compatible avec le contenu de tbl
Definition at line 264 of file sigtype.cpp.
string cType | ( | Type | t | ) |
Definition at line 292 of file sigtype.cpp.
References kInt.
Referenced by ScalarCompiler::generatePrefix(), ScalarCompiler::generateSelect2(), and ScalarCompiler::generateSelect3().
00293 { 00294 return (t->nature() == kInt) ? "int" : "float"; 00295 }
Definition at line 248 of file sigtype.hh.
References kReal.
Referenced by TanPrim::infereSigType(), SqrtPrim::infereSigType(), SinPrim::infereSigType(), infereSigType(), RintPrim::infereSigType(), RemainderPrim::infereSigType(), PowPrim::infereSigType(), LogPrim::infereSigType(), Log10Prim::infereSigType(), FmodPrim::infereSigType(), FloorPrim::infereSigType(), ExpPrim::infereSigType(), CosPrim::infereSigType(), CeilPrim::infereSigType(), AtanPrim::infereSigType(), Atan2Prim::infereSigType(), AsinPrim::infereSigType(), and AcosPrim::infereSigType().
00248 { return new SimpleType(kReal, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
Definition at line 247 of file sigtype.hh.
References kInt.
Referenced by infereSigType().
00247 { return new SimpleType(kInt, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
SimpleType* isSimpleType | ( | AudioType * | t | ) |
Definition at line 219 of file sigtype.cpp.
Referenced by checkInt(), infereReadTableType(), infereSigType(), infereWriteTableType(), operator==(), and operator|().
00219 { return dynamic_cast<SimpleType*>(t); }
Definition at line 220 of file sigtype.cpp.
Referenced by infereReadTableType(), infereWriteTableType(), operator==(), and operator|().
00220 { return dynamic_cast<TableType*>(t); }
TupletType* isTupletType | ( | AudioType * | t | ) |
Definition at line 221 of file sigtype.cpp.
Referenced by infereProjType(), operator==(), and operator|().
00221 { return dynamic_cast<TupletType*>(t); }
int mergeboolean | ( | const vector< Type > & | v | ) | [inline] |
Return the booleanity of a vector of types.
Definition at line 179 of file sigtype.hh.
int mergecomputability | ( | const vector< Type > & | v | ) | [inline] |
Return the computability of a vector of types.
Definition at line 155 of file sigtype.hh.
Return the interval of a vector of types.
Definition at line 191 of file sigtype.hh.
References interval::hi, interval::lo, max(), min(), and interval::valid.
00192 { 00193 if (v.size()==0) { 00194 return interval(); 00195 } else { 00196 double lo=0, hi=0; 00197 for (unsigned int i = 0; i < v.size(); i++) { 00198 interval r = v[i]->getInterval(); 00199 if (!r.valid) return r; 00200 if (i==0) { 00201 lo = r.lo; 00202 hi = r.hi; 00203 } else { 00204 lo = min(lo,r.lo); 00205 hi = max(hi,r.hi); 00206 } 00207 } 00208 return interval(lo, hi); 00209 } 00210 }
int mergenature | ( | const vector< Type > & | v | ) | [inline] |
Return the nature of a vector of types.
Definition at line 131 of file sigtype.hh.
int mergevariability | ( | const vector< Type > & | v | ) | [inline] |
Return the variability of a vector of types.
Definition at line 143 of file sigtype.hh.
int mergevectorability | ( | const vector< Type > & | v | ) | [inline] |
Return the vectorability of a vector of types.
Definition at line 167 of file sigtype.hh.
Definition at line 251 of file sigtype.hh.
References kNum.
00251 { return new SimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kNum, t->getInterval()); }
Definition at line 398 of file sigtype.hh.
Definition at line 193 of file sigtype.cpp.
References TupletType::arity().
00194 { 00195 vector<Type> v; 00196 00197 TupletType* nt1 = dynamic_cast<TupletType*>((AudioType*)t1); 00198 TupletType* nt2 = dynamic_cast<TupletType*>((AudioType*)t2); 00199 00200 if (nt1) { 00201 for (int i=0; i<nt1->arity(); i++) { 00202 v.push_back((*nt1)[i]); 00203 } 00204 } else { 00205 v.push_back(t1); 00206 } 00207 00208 if (nt2) { 00209 for (int i=0; i<nt2->arity(); i++) { 00210 v.push_back((*nt2)[i]); 00211 } 00212 } else { 00213 v.push_back(t2); 00214 } 00215 return new TupletType(v); 00216 }
Definition at line 399 of file sigtype.hh.
ostream& operator<< | ( | ostream & | dst, | |
const TupletType & | t | |||
) |
Definition at line 40 of file sigtype.cpp.
References TupletType::print().
00040 { return t.print(dst); }
ostream& operator<< | ( | ostream & | dst, | |
const TableType & | t | |||
) |
Definition at line 38 of file sigtype.cpp.
References TableType::print().
00038 { return t.print(dst); }
ostream& operator<< | ( | ostream & | dst, | |
const Type & | t | |||
) |
Definition at line 34 of file sigtype.cpp.
ostream& operator<< | ( | ostream & | dst, | |
const SimpleType & | t | |||
) |
Definition at line 36 of file sigtype.cpp.
References SimpleType::print().
00036 { return t.print(dst); }
ostream& operator<< | ( | ostream & | s, | |
const AudioType & | n | |||
) | [inline] |
Definition at line 125 of file sigtype.hh.
References AudioType::print().
00125 { return n.print(s); }
Definition at line 186 of file sigtype.cpp.
Definition at line 162 of file sigtype.cpp.
References TupletType::arity(), AudioType::boolean(), TableType::content(), isSimpleType(), isTableType(), isTupletType(), AudioType::nature(), and AudioType::vectorability().
00163 { 00164 SimpleType *st1, *st2; 00165 TableType *tt1, *tt2; 00166 TupletType *nt1, *nt2; 00167 00168 if (t1->variability() != t2->variability()) return false; 00169 if (t1->computability() != t2->computability()) return false; 00170 00171 if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) ) return (st1->nature() == st2->nature())&&(st1->vectorability() == st2->vectorability())&&(st1->boolean() == st2->boolean()); 00172 if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) ) return tt1->content()== tt2->content(); 00173 if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) { 00174 int a1 = nt1->arity(); 00175 int a2 = nt2->arity(); 00176 if (a1 == a2) { 00177 for (int i=0; i<a1; i++) { if ((*nt1)[i] != (*nt2)[i]) return false; } 00178 return true; 00179 } else { 00180 return false; 00181 } 00182 } 00183 return false; 00184 }
Definition at line 400 of file sigtype.hh.
Definition at line 401 of file sigtype.hh.
achanger
Definition at line 127 of file sigtype.cpp.
References TupletType::arity(), AudioType::boolean(), AudioType::computability(), TableType::content(), isSimpleType(), isTableType(), isTupletType(), min(), AudioType::nature(), AudioType::variability(), and AudioType::vectorability().
00128 { 00129 SimpleType *st1, *st2; 00130 TableType *tt1, *tt2; 00131 TupletType *nt1, *nt2; 00132 00133 if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) ) { 00134 00135 return new SimpleType( st1->nature()|st2->nature(), 00136 st1->variability()|st2->variability(), 00137 st1->computability()|st2->computability(), 00138 st1->vectorability()|st2->vectorability(), 00139 st1->boolean()|st2->boolean(), 00140 interval() 00141 ); 00142 00143 } else if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) ) { 00144 00145 return new TableType( tt1->content() | tt2->content() ); 00146 00147 } else if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) { 00148 00149 vector<Type> v; 00150 int n = min(nt1->arity(), nt2->arity()); 00151 for (int i=0; i<n; i++) { v.push_back( (*nt1)[i] | (*nt2)[i]); } 00152 return new TupletType( v ); 00153 00154 } else { 00155 00156 cerr << "Error : trying to combine incompatible types, " << t1 << " and " << t2 << endl; 00157 exit(1); 00158 return 0; 00159 } 00160 }
Definition at line 249 of file sigtype.hh.
References kSamp.
Referenced by infereSigType().
00249 { return new SimpleType(t->nature(), kSamp, t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
Definition at line 253 of file sigtype.hh.
References kScal.
00253 { return new SimpleType(t->nature(), t->variability(), t->computability(), kScal, t->boolean(), t->getInterval()); }
Definition at line 254 of file sigtype.hh.
References kTrueScal.
00254 { return new SimpleType(t->nature(), t->variability(), t->computability(), kTrueScal, t->boolean(), t->getInterval()); }
Definition at line 252 of file sigtype.hh.
References kVect.
Referenced by infereProjType().
00252 { return new SimpleType(t->nature(), t->variability(), t->computability(), kVect, t->boolean(), t->getInterval()); }
Definition at line 122 of file sigtype.cpp.
Definition at line 111 of file sigtype.cpp.
Definition at line 114 of file sigtype.cpp.
Definition at line 116 of file sigtype.cpp.
Definition at line 121 of file sigtype.cpp.
Referenced by infereSigType().
Definition at line 115 of file sigtype.cpp.
Definition at line 120 of file sigtype.cpp.
Definition at line 107 of file sigtype.cpp.
Definition at line 110 of file sigtype.cpp.
Definition at line 108 of file sigtype.cpp.
Definition at line 124 of file sigtype.cpp.
Referenced by initialRecType().
Definition at line 112 of file sigtype.cpp.