FAUST compiler  0.9.9.6b8
Classes | Typedefs | Enumerations | Functions | Variables
sigtype.hh File Reference
#include <vector>
#include <string>
#include <iostream>
#include "tree.hh"
#include "smartpointer.hh"
#include "interval.hh"
Include dependency graph for sigtype.hh:
This graph shows which files directly or indirectly include this file:

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< AudioTypeType
 

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. More...
 
int mergevariability (const vector< Type > &v)
 Return the variability of a vector of types. More...
 
int mergecomputability (const vector< Type > &v)
 Return the computability of a vector of types. More...
 
int mergevectorability (const vector< Type > &v)
 Return the vectorability of a vector of types. More...
 
int mergeboolean (const vector< Type > &v)
 Return the booleanity of a vector of types. More...
 
interval mergeinterval (const vector< Type > &v)
 Return the interval of a vector of types. More...
 
AudioTypemakeSimpleType (int n, int v, int c, int vec, int b, const interval &i)
 
AudioTypemakeTableType (const Type &ct)
 
AudioTypemakeTableType (const Type &ct, int n, int v, int c, int vec)
 
AudioTypemakeTableType (const Type &ct, int n, int v, int c, int vec, int b, const interval &i)
 
AudioTypemakeTupletType (const vector< Type > &vt)
 
AudioTypemakeTupletType (const vector< Type > &vt, int n, int v, int c, int vec, int b, const interval &i)
 
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)
 
SimpleTypeisSimpleType (AudioType *t)
 
TableTypeisTableType (AudioType *t)
 
TupletTypeisTupletType (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 More...
 
Type checkKonst (Type t)
 verifie que t est constant More...
 
Type checkInit (Type t)
 verifie que t est connu a l'initialisation More...
 
Type checkIntParam (Type t)
 verifie que t est connu a l'initialisation, constant et entier More...
 
Type checkWRTbl (Type tbl, Type wr)
 verifie que wr est compatible avec le contenu de tbl More...
 
int checkDelayInterval (Type t)
 Check if the interval of t is appropriate for a delay. More...
 
string cType (Type t)
 
Tree codeAudioType (AudioType *t)
 Code an audio type as a tree (memoization) More...
 

Variables

Type TINT
 
Type TREAL
 
Type TKONST
 
Type TBLOCK
 
Type TSAMP
 
Type TCOMP
 
Type TINIT
 
Type TEXEC
 
Type TINPUT
 
Type TGUI
 
Type TGUI01
 
Type INT_TGUI
 
Type TREC
 

Typedef Documentation

typedef P<AudioType> Type

Definition at line 72 of file sigtype.hh.

Enumeration Type Documentation

anonymous enum
Enumerator
kInt 
kReal 

Definition at line 54 of file sigtype.hh.

54 { kInt = 0, kReal = 1 };
Definition: sigtype.hh:54
Definition: sigtype.hh:54
anonymous enum
Enumerator
kNum 
kBool 

Definition at line 55 of file sigtype.hh.

55 { kNum = 0 , kBool = 1};
Definition: sigtype.hh:55
Definition: sigtype.hh:55
anonymous enum
Enumerator
kKonst 
kBlock 
kSamp 

Definition at line 56 of file sigtype.hh.

56 { kKonst = 0, kBlock = 1, kSamp = 3 };
Definition: sigtype.hh:56
anonymous enum
Enumerator
kComp 
kInit 
kExec 

Definition at line 57 of file sigtype.hh.

57 { kComp = 0, kInit = 1, kExec = 3 };
Definition: sigtype.hh:57
Definition: sigtype.hh:57
Definition: sigtype.hh:57
anonymous enum
Enumerator
kVect 
kScal 
kTrueScal 

Definition at line 58 of file sigtype.hh.

58 { kVect = 0, kScal = 1, kTrueScal = 3/*, kIndex = 4*/};
Definition: sigtype.hh:58
Definition: sigtype.hh:58

Function Documentation

Type boolCast ( Type  t)
inline

Definition at line 272 of file sigtype.hh.

References kBool, kInt, and makeSimpleType().

Referenced by infereSigType().

272 { return makeSimpleType(kInt, t->variability(), t->computability(), t->vectorability(), kBool, t->getInterval()); }
Definition: sigtype.hh:54
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421
Definition: sigtype.hh:55

Here is the call graph for this function:

Here is the caller graph for this function:

Type castInterval ( Type  t,
const interval i 
)
inline

Definition at line 278 of file sigtype.hh.

References makeSimpleType().

Referenced by CosPrim::infereSigType(), LogPrim::infereSigType(), SinPrim::infereSigType(), PowPrim::infereSigType(), TanPrim::infereSigType(), RintPrim::infereSigType(), RemainderPrim::infereSigType(), Log10Prim::infereSigType(), SqrtPrim::infereSigType(), MinPrim::infereSigType(), AbsPrim::infereSigType(), MaxPrim::infereSigType(), and infereSigType().

279 {
280  return makeSimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), t->boolean(), i);
281 }
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns
-1 if not appropriate, mxd (max delay) if appropriate

Definition at line 327 of file sigtype.cpp.

References interval::hi, interval::lo, and interval::valid.

Referenced by OccMarkup::incOcc().

328 {
329  interval i = t->getInterval();
330  if (i.valid && i.lo >= 0) {
331  return int(i.hi+0.5);
332  } else {
333  //cerr << "checkDelayInterval failed for : " << i << endl;
334  return -1;
335  }
336 }
bool valid
true if it is a valid interval
Definition: interval.hh:38
double lo
minimal value
Definition: interval.hh:39
double hi
maximal value
Definition: interval.hh:40

Here is the caller graph for this function:

Type checkInit ( Type  t)

verifie que t est connu a l'initialisation

Definition at line 297 of file sigtype.cpp.

References kInit.

Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().

298 {
299  // verifie que t est connu a l'initialisation
300  if (t->computability() > kInit) {
301  cerr << "Error : checkInit failed for type " << t << endl;
302  exit(1);
303  }
304  return t;
305 }
Definition: sigtype.hh:57

Here is the caller graph for this function:

Type checkInt ( Type  t)

verifie que t est entier

Definition at line 276 of file sigtype.cpp.

References isSimpleType(), kInt, and AudioType::nature().

Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().

277 {
278  // verifie que t est entier
279  SimpleType* st = isSimpleType(t);
280  if (st == 0 || st->nature() > kInt) {
281  cerr << "Error : checkInt failed for type " << t << endl;
282  exit(1);
283  }
284  return t;
285 }
Definition: sigtype.hh:54
The type of a simple numeric audio signal.
Definition: sigtype.hh:237
int nature() const
returns the kind of values (integre or floating point)
Definition: sigtype.hh:104
SimpleType * isSimpleType(AudioType *t)
Definition: sigtype.cpp:267

Here is the call graph for this function:

Here is the caller graph for this function:

Type checkIntParam ( Type  t)

verifie que t est connu a l'initialisation, constant et entier

Definition at line 307 of file sigtype.cpp.

References checkInit(), checkInt(), and checkKonst().

308 {
309  return checkInit(checkKonst(checkInt(t)));
310 }
Type checkInit(Type t)
verifie que t est connu a l'initialisation
Definition: sigtype.cpp:297
Type checkKonst(Type t)
verifie que t est constant
Definition: sigtype.cpp:287
Type checkInt(Type t)
verifie que t est entier
Definition: sigtype.cpp:276

Here is the call graph for this function:

Type checkKonst ( Type  t)

verifie que t est constant

Definition at line 287 of file sigtype.cpp.

References kKonst.

Referenced by checkIntParam(), infereDocConstantTblType(), and infereDocWriteTblType().

288 {
289  // verifie que t est constant
290  if (t->variability() > kKonst) {
291  cerr << "Error : checkKonst failed for type " << t << endl;
292  exit(1);
293  }
294  return t;
295 }

Here is the caller graph for this function:

Type checkWRTbl ( Type  tbl,
Type  wr 
)

verifie que wr est compatible avec le contenu de tbl

Definition at line 312 of file sigtype.cpp.

313 {
314  // verifie que wr est compatible avec le contenu de tbl
315  if (wr->nature() > tbl->nature()) {
316  cerr << "Error : checkWRTbl failed, the content of " << tbl << " is incompatible with " << wr << endl;
317  exit(1);
318  }
319  return tbl;
320 }
Tree codeAudioType ( AudioType t)

Code an audio type as a tree (memoization)

Code an audio type as a tree (memoization)

Definition at line 374 of file sigtype.cpp.

References codeSimpleType(), codeTableType(), codeTupletType(), AudioType::getCode(), isSimpleType(), isTableType(), isTupletType(), and CTree::setType().

Referenced by codeTableType(), codeTupletType(), makeSimpleType(), makeTableType(), and makeTupletType().

375 {
376  SimpleType *st;
377  TableType *tt;
378  TupletType *nt;
379 
380  Tree r;
381 
382  if ((r=t->getCode())) return r;
383 
384  if ((st = isSimpleType(t))) {
385  r = codeSimpleType(st);
386  } else if ((tt = isTableType(t))) {
387  r = codeTableType(tt);
388  } else if ((nt = isTupletType(t))) {
389  r = codeTupletType(nt);
390  } else {
391  cerr << "ERROR in codeAudioType() : invalide pointer " << t << endl;
392  exit(1);
393  }
394 
395  r->setType(t);
396  return r;
397 
398 }
static Tree codeSimpleType(SimpleType *st)
Code a simple audio type as a tree in order to benefit of memoization.
Definition: sigtype.cpp:404
The type of a tuplet of data.
Definition: sigtype.hh:340
Tree getCode()
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:113
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
void setType(void *t)
Definition: tree.hh:157
The type of a table of audio data.
Definition: sigtype.hh:288
static Tree codeTupletType(TupletType *st)
Code a tuplet type as a tree in order to benefit of memoization.
Definition: sigtype.cpp:504
static Tree codeTableType(TableType *st)
Code a table type as a tree in order to benefit of memoization.
Definition: sigtype.cpp:443
The type of a simple numeric audio signal.
Definition: sigtype.hh:237
TableType * isTableType(AudioType *t)
Definition: sigtype.cpp:268
TupletType * isTupletType(AudioType *t)
Definition: sigtype.cpp:269
SimpleType * isSimpleType(AudioType *t)
Definition: sigtype.cpp:267

Here is the call graph for this function:

Here is the caller graph for this function:

string cType ( Type  t)

Definition at line 340 of file sigtype.cpp.

References kInt.

Referenced by ScalarCompiler::generatePrefix().

341 {
342  return (t->nature() == kInt) ? "int" : "float";
343 }
Definition: sigtype.hh:54

Here is the caller graph for this function:

Type floatCast ( Type  t)
inline

Definition at line 270 of file sigtype.hh.

References kReal, and makeSimpleType().

Referenced by AcosPrim::infereSigType(), TanPrim::infereSigType(), AsinPrim::infereSigType(), SinPrim::infereSigType(), AtanPrim::infereSigType(), FloorPrim::infereSigType(), FmodPrim::infereSigType(), CeilPrim::infereSigType(), LogPrim::infereSigType(), Atan2Prim::infereSigType(), CosPrim::infereSigType(), ExpPrim::infereSigType(), Log10Prim::infereSigType(), RemainderPrim::infereSigType(), RintPrim::infereSigType(), SqrtPrim::infereSigType(), and infereSigType().

270 { return makeSimpleType(kReal, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421
Definition: sigtype.hh:54

Here is the call graph for this function:

Here is the caller graph for this function:

Type intCast ( Type  t)
inline

Definition at line 269 of file sigtype.hh.

References kInt, and makeSimpleType().

Referenced by infereSigType().

269 { return makeSimpleType(kInt, t->variability(), t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
Definition: sigtype.hh:54
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421

Here is the call graph for this function:

Here is the caller graph for this function:

SimpleType* isSimpleType ( AudioType t)

Definition at line 267 of file sigtype.cpp.

Referenced by checkInt(), codeAudioType(), infereReadTableType(), infereSigType(), infereWriteTableType(), operator==(), and operator|().

267 { return dynamic_cast<SimpleType*>(t); }
The type of a simple numeric audio signal.
Definition: sigtype.hh:237

Here is the caller graph for this function:

TableType* isTableType ( AudioType t)

Definition at line 268 of file sigtype.cpp.

Referenced by codeAudioType(), infereReadTableType(), infereWriteTableType(), operator==(), and operator|().

268 { return dynamic_cast<TableType*>(t); }
The type of a table of audio data.
Definition: sigtype.hh:288

Here is the caller graph for this function:

TupletType* isTupletType ( AudioType t)

Definition at line 269 of file sigtype.cpp.

Referenced by codeAudioType(), infereProjType(), operator==(), and operator|().

269 { return dynamic_cast<TupletType*>(t); }
The type of a tuplet of data.
Definition: sigtype.hh:340

Here is the caller graph for this function:

AudioType* makeSimpleType ( int  n,
int  v,
int  c,
int  vec,
int  b,
const interval i 
)

Definition at line 421 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

Referenced by boolCast(), castInterval(), floatCast(), infereFConstType(), infereFFType(), infereFVarType(), infereSigType(), infereWaveformType(), intCast(), numCast(), operator|(), SimpleType::promoteBoolean(), SimpleType::promoteComputability(), SimpleType::promoteNature(), SimpleType::promoteVariability(), SimpleType::promoteVectorability(), sampCast(), scalCast(), truescalCast(), and vecCast().

422 {
423  SimpleType prototype(n,v,c,vec,b,i);
424  Tree code = codeAudioType(&prototype);
425 
426  AudioType* t;
427  if (MemoizedTypes.get(code, t)) {
428  return t;
429  } else {
431  t = new SimpleType(n,v,c,vec,b,i);
432  MemoizedTypes.set(code, t);
433  t->setCode(code);
434  return t;
435  }
436 }
static int gAllocationCount
Definition: sigtype.hh:85
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The type of a simple numeric audio signal.
Definition: sigtype.hh:237
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

Here is the caller graph for this function:

AudioType* makeTableType ( const Type ct)

Definition at line 448 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

Referenced by infereSigType(), infereWriteTableType(), operator|(), TableType::promoteBoolean(), TableType::promoteComputability(), TableType::promoteNature(), TableType::promoteVariability(), and TableType::promoteVectorability().

449 {
450  TableType prototype(ct);
451  Tree code = codeAudioType(&prototype);
452 
453  AudioType* tt;
454  if (MemoizedTypes.get(code, tt)) {
455  return tt;
456  } else {
458  tt = new TableType(ct);
459  MemoizedTypes.set(code, tt);
460  tt->setCode(code);
461  return tt;
462  }
463 }
static int gAllocationCount
Definition: sigtype.hh:85
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
The type of a table of audio data.
Definition: sigtype.hh:288
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

Here is the caller graph for this function:

AudioType* makeTableType ( const Type ct,
int  n,
int  v,
int  c,
int  vec 
)

Definition at line 482 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

483 {
484  TableType prototype(ct,n,v,c,vec);
485  Tree code = codeAudioType(&prototype);
486 
487  AudioType* tt;
488  if (MemoizedTypes.get(code, tt)) {
489  return tt;
490  } else {
492  tt = new TableType(ct);
493  MemoizedTypes.set(code, tt);
494  tt->setCode(code);
495  return tt;
496  }
497 }
static int gAllocationCount
Definition: sigtype.hh:85
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
The type of a table of audio data.
Definition: sigtype.hh:288
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

AudioType* makeTableType ( const Type ct,
int  n,
int  v,
int  c,
int  vec,
int  b,
const interval i 
)

Definition at line 465 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

466 {
467  TableType prototype(ct,n,v,c,vec,b,i);
468  Tree code = codeAudioType(&prototype);
469 
470  AudioType* tt;
471  if (MemoizedTypes.get(code, tt)) {
472  return tt;
473  } else {
475  tt = new TableType(ct);
476  MemoizedTypes.set(code, tt);
477  tt->setCode(code);
478  return tt;
479  }
480 }
static int gAllocationCount
Definition: sigtype.hh:85
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
The type of a table of audio data.
Definition: sigtype.hh:288
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

AudioType* makeTupletType ( const vector< Type > &  vt)

Definition at line 513 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

514 {
515  TupletType prototype(vt);
516  Tree code = codeAudioType(&prototype);
517 
518  AudioType* t;
519  if (MemoizedTypes.get(code, t)) {
520  return t;
521  } else {
523  t = new TupletType(vt);
524  MemoizedTypes.set(code, t);
525  t->setCode(code);
526  return t;
527  }
528 
529 }
static int gAllocationCount
Definition: sigtype.hh:85
The type of a tuplet of data.
Definition: sigtype.hh:340
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

AudioType* makeTupletType ( const vector< Type > &  vt,
int  n,
int  v,
int  c,
int  vec,
int  b,
const interval i 
)

Definition at line 531 of file sigtype.cpp.

References codeAudioType(), AudioType::gAllocationCount, property< P >::get(), property< P >::set(), and AudioType::setCode().

532 {
533  TupletType prototype(vt,n,v,c,vec,b,i);
534  Tree code = codeAudioType(&prototype);
535 
536  AudioType* t;
537  if (MemoizedTypes.get(code, t)) {
538  return t;
539  } else {
541  t = new TupletType(vt,n,v,c,vec,b,i);
542  MemoizedTypes.set(code, t);
543  t->setCode(code);
544  return t;
545  }
546 
547 }
static int gAllocationCount
Definition: sigtype.hh:85
The type of a tuplet of data.
Definition: sigtype.hh:340
property< AudioType * > MemoizedTypes
Definition: sigtype.cpp:356
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
Tree codeAudioType(AudioType *t)
codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type ...
Definition: sigtype.cpp:374
void setCode(Tree code)
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:112
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

int mergeboolean ( const vector< Type > &  v)
inline

Return the booleanity of a vector of types.

Definition at line 187 of file sigtype.hh.

188 {
189  int r = 0;
190  for (unsigned int i = 0; i < v.size(); i++) r |= v[i]->boolean();
191  return r;
192 }
int mergecomputability ( const vector< Type > &  v)
inline

Return the computability of a vector of types.

Definition at line 163 of file sigtype.hh.

164 {
165  int r = 0;
166  for (unsigned int i = 0; i < v.size(); i++) r |= v[i]->computability();
167  return r;
168 }
interval mergeinterval ( const vector< Type > &  v)
inline

Return the interval of a vector of types.

Definition at line 199 of file sigtype.hh.

References interval::hi, interval::lo, max(), min(), and interval::valid.

200 {
201  if (v.size()==0) {
202  return interval();
203  } else {
204  double lo=0, hi=0;
205  for (unsigned int i = 0; i < v.size(); i++) {
206  interval r = v[i]->getInterval();
207  if (!r.valid) return r;
208  if (i==0) {
209  lo = r.lo;
210  hi = r.hi;
211  } else {
212  lo = min(lo,r.lo);
213  hi = max(hi,r.hi);
214  }
215  }
216  return interval(lo, hi);
217  }
218 }
bool valid
true if it is a valid interval
Definition: interval.hh:38
double lo
minimal value
Definition: interval.hh:39
double max(double x, double y)
Definition: interval.hh:60
double min(double x, double y)
Definition: interval.hh:59
double hi
maximal value
Definition: interval.hh:40

Here is the call graph for this function:

int mergenature ( const vector< Type > &  v)
inline

Return the nature of a vector of types.

Definition at line 139 of file sigtype.hh.

140 {
141  int r = 0;
142  for (unsigned int i = 0; i < v.size(); i++) r |= v[i]->nature();
143  return r;
144 }
int mergevariability ( const vector< Type > &  v)
inline

Return the variability of a vector of types.

Definition at line 151 of file sigtype.hh.

152 {
153  int r = 0;
154  for (unsigned int i = 0; i < v.size(); i++) r |= v[i]->variability();
155  return r;
156 }
int mergevectorability ( const vector< Type > &  v)
inline

Return the vectorability of a vector of types.

Definition at line 175 of file sigtype.hh.

176 {
177  int r = 0;
178  for (unsigned int i = 0; i < v.size(); i++) r |= v[i]->vectorability();
179  return r;
180 }
Type numCast ( Type  t)
inline

Definition at line 273 of file sigtype.hh.

References kNum, and makeSimpleType().

273 { return makeSimpleType(t->nature(), t->variability(), t->computability(), t->vectorability(), kNum, t->getInterval()); }
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421
Definition: sigtype.hh:55

Here is the call graph for this function:

bool operator!= ( const Type t1,
const Type t2 
)
inline

Definition at line 419 of file sigtype.hh.

419 { return !(t1==t2); }
Type operator* ( const Type t1,
const Type t2 
)

Definition at line 241 of file sigtype.cpp.

References TupletType::arity().

242 {
243  vector<Type> v;
244 
245  TupletType* nt1 = dynamic_cast<TupletType*>((AudioType*)t1);
246  TupletType* nt2 = dynamic_cast<TupletType*>((AudioType*)t2);
247 
248  if (nt1) {
249  for (int i=0; i<nt1->arity(); i++) {
250  v.push_back((*nt1)[i]);
251  }
252  } else {
253  v.push_back(t1);
254  }
255 
256  if (nt2) {
257  for (int i=0; i<nt2->arity(); i++) {
258  v.push_back((*nt2)[i]);
259  }
260  } else {
261  v.push_back(t2);
262  }
263  return new TupletType(v);
264 }
The type of a tuplet of data.
Definition: sigtype.hh:340
int arity() const
Definition: sigtype.hh:358
The Root class for all audio data types.
Definition: sigtype.hh:82

Here is the call graph for this function:

bool operator< ( const Type t1,
const Type t2 
)
inline

Definition at line 420 of file sigtype.hh.

420 { return t1<=t2 && t1!=t2; }
ostream& operator<< ( ostream &  s,
const AudioType n 
)
inline

Definition at line 133 of file sigtype.hh.

References AudioType::print().

133 { return n.print(s); }
virtual ostream & print(ostream &dst) const =0
print nicely a type

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const SimpleType t 
)

Definition at line 48 of file sigtype.cpp.

References SimpleType::print().

48 { return t.print(dst); }
virtual ostream & print(ostream &dst) const
print a SimpleType
Definition: sigtype.cpp:65

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const Type t 
)

Definition at line 46 of file sigtype.cpp.

46 { return t->print(dst);}
ostream& operator<< ( ostream &  dst,
const TableType t 
)

Definition at line 50 of file sigtype.cpp.

References TableType::print().

50 { return t.print(dst); }
virtual ostream & print(ostream &dst) const
print a TableType
Definition: sigtype.cpp:79

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const TupletType t 
)

Definition at line 52 of file sigtype.cpp.

References TupletType::print().

52 { return t.print(dst); }
virtual ostream & print(ostream &dst) const
Print the content of a tuplet of types on a stream.
Definition: sigtype.cpp:105

Here is the call graph for this function:

bool operator<= ( const Type t1,
const Type t2 
)

Definition at line 234 of file sigtype.cpp.

235 {
236  return (t1|t2) == t2;
237 }
bool operator== ( const Type t1,
const Type t2 
)

Definition at line 201 of file sigtype.cpp.

References TupletType::arity(), AudioType::boolean(), AudioType::computability(), TableType::content(), AudioType::getInterval(), interval::hi, isSimpleType(), isTableType(), isTupletType(), interval::lo, AudioType::nature(), interval::valid, AudioType::variability(), and AudioType::vectorability().

202 {
203  SimpleType *st1, *st2;
204  TableType *tt1, *tt2;
205  TupletType *nt1, *nt2;
206 
207  if (t1->variability() != t2->variability()) return false;
208  if (t1->computability() != t2->computability()) return false;
209 
210  if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) )
211  return (st1->nature() == st2->nature())
212  && (st1->variability() == st2->variability())
213  && (st1->computability() == st2->computability())
214  && (st1->vectorability() == st2->vectorability())
215  && (st1->boolean() == st2->boolean())
216  && (st1->getInterval().lo == st2->getInterval().lo)
217  && (st1->getInterval().hi == st2->getInterval().hi)
218  && (st1->getInterval().valid == st2->getInterval().valid);
219  if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) )
220  return tt1->content()== tt2->content();
221  if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) {
222  int a1 = nt1->arity();
223  int a2 = nt2->arity();
224  if (a1 == a2) {
225  for (int i=0; i<a1; i++) { if ((*nt1)[i] != (*nt2)[i]) return false; }
226  return true;
227  } else {
228  return false;
229  }
230  }
231  return false;
232 }
bool valid
true if it is a valid interval
Definition: interval.hh:38
double lo
minimal value
Definition: interval.hh:39
int variability() const
returns how fast values change (constant, by blocks, by samples)
Definition: sigtype.hh:105
interval getInterval() const
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:110
The type of a tuplet of data.
Definition: sigtype.hh:340
Type content() const
return the type of data store in the table
Definition: sigtype.hh:320
int boolean() const
returns when a signal stands for a boolean value
Definition: sigtype.hh:108
int arity() const
Definition: sigtype.hh:358
The type of a table of audio data.
Definition: sigtype.hh:288
The type of a simple numeric audio signal.
Definition: sigtype.hh:237
TableType * isTableType(AudioType *t)
Definition: sigtype.cpp:268
int nature() const
returns the kind of values (integre or floating point)
Definition: sigtype.hh:104
TupletType * isTupletType(AudioType *t)
Definition: sigtype.cpp:269
int computability() const
returns when values are available (compilation, initialisation, execution)
Definition: sigtype.hh:106
SimpleType * isSimpleType(AudioType *t)
Definition: sigtype.cpp:267
double hi
maximal value
Definition: interval.hh:40
int vectorability() const
returns when a signal can be vectorized
Definition: sigtype.hh:107

Here is the call graph for this function:

bool operator> ( const Type t1,
const Type t2 
)
inline

Definition at line 421 of file sigtype.hh.

421 { return t2<t1; }
bool operator>= ( const Type t1,
const Type t2 
)
inline

Definition at line 422 of file sigtype.hh.

422 { return t2<=t1; }
Type operator| ( const Type t1,
const Type t2 
)

Definition at line 166 of file sigtype.cpp.

References TupletType::arity(), AudioType::boolean(), AudioType::computability(), TableType::content(), AudioType::getInterval(), isSimpleType(), isTableType(), isTupletType(), makeSimpleType(), makeTableType(), min(), AudioType::nature(), reunion(), AudioType::variability(), and AudioType::vectorability().

167 {
168  SimpleType *st1, *st2;
169  TableType *tt1, *tt2;
170  TupletType *nt1, *nt2;
171 
172  if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) ) {
173 
174  return makeSimpleType( st1->nature()|st2->nature(),
175  st1->variability()|st2->variability(),
176  st1->computability()|st2->computability(),
177  st1->vectorability()|st2->vectorability(),
178  st1->boolean()|st2->boolean(),
179  reunion(st1->getInterval(), st2->getInterval())
180  );
181 
182  } else if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) ) {
183 
184  return makeTableType( tt1->content() | tt2->content() );
185 
186  } else if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) {
187 
188  vector<Type> v;
189  int n = min(nt1->arity(), nt2->arity());
190  for (int i=0; i<n; i++) { v.push_back( (*nt1)[i] | (*nt2)[i]); }
191  return new TupletType( v );
192 
193  } else {
194 
195  cerr << "Error : trying to combine incompatible types, " << t1 << " and " << t2 << endl;
196  exit(1);
197  return 0;
198  }
199 }
int variability() const
returns how fast values change (constant, by blocks, by samples)
Definition: sigtype.hh:105
interval getInterval() const
returns the interval (min dn max values) of a signal
Definition: sigtype.hh:110
The type of a tuplet of data.
Definition: sigtype.hh:340
Type content() const
return the type of data store in the table
Definition: sigtype.hh:320
int boolean() const
returns when a signal stands for a boolean value
Definition: sigtype.hh:108
int arity() const
Definition: sigtype.hh:358
The type of a table of audio data.
Definition: sigtype.hh:288
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421
The type of a simple numeric audio signal.
Definition: sigtype.hh:237
AudioType * makeTableType(const Type &ct)
Definition: sigtype.cpp:448
interval reunion(const interval &x, const interval &y)
Definition: interval.hh:64
TableType * isTableType(AudioType *t)
Definition: sigtype.cpp:268
int nature() const
returns the kind of values (integre or floating point)
Definition: sigtype.hh:104
TupletType * isTupletType(AudioType *t)
Definition: sigtype.cpp:269
int computability() const
returns when values are available (compilation, initialisation, execution)
Definition: sigtype.hh:106
SimpleType * isSimpleType(AudioType *t)
Definition: sigtype.cpp:267
double min(double x, double y)
Definition: interval.hh:59
int vectorability() const
returns when a signal can be vectorized
Definition: sigtype.hh:107

Here is the call graph for this function:

Type sampCast ( Type  t)
inline

Definition at line 271 of file sigtype.hh.

References kSamp, and makeSimpleType().

Referenced by infereSigType().

271 { return makeSimpleType(t->nature(), kSamp, t->computability(), t->vectorability(), t->boolean(), t->getInterval()); }
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421
Definition: sigtype.hh:56

Here is the call graph for this function:

Here is the caller graph for this function:

Type scalCast ( Type  t)
inline

Definition at line 275 of file sigtype.hh.

References kScal, and makeSimpleType().

275 { return makeSimpleType(t->nature(), t->variability(), t->computability(), kScal, t->boolean(), t->getInterval()); }
Definition: sigtype.hh:58
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421

Here is the call graph for this function:

Type table ( const Type t)
Type truescalCast ( Type  t)
inline

Definition at line 276 of file sigtype.hh.

References kTrueScal, and makeSimpleType().

276 { return makeSimpleType(t->nature(), t->variability(), t->computability(), kTrueScal, t->boolean(), t->getInterval()); }
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421

Here is the call graph for this function:

Type vecCast ( Type  t)
inline

Definition at line 274 of file sigtype.hh.

References kVect, and makeSimpleType().

Referenced by infereProjType().

274 { return makeSimpleType(t->nature(), t->variability(), t->computability(), kVect, t->boolean(), t->getInterval()); }
Definition: sigtype.hh:58
AudioType * makeSimpleType(int n, int v, int c, int vec, int b, const interval &i)
Definition: sigtype.cpp:421

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

Type INT_TGUI

Definition at line 158 of file sigtype.cpp.

Type TBLOCK

Definition at line 146 of file sigtype.cpp.

Type TCOMP

Definition at line 149 of file sigtype.cpp.

Type TEXEC

Definition at line 151 of file sigtype.cpp.

Type TGUI

Definition at line 156 of file sigtype.cpp.

Referenced by infereSigType().

Type TGUI01

Definition at line 157 of file sigtype.cpp.

Referenced by infereSigType().

Type TINIT

Definition at line 150 of file sigtype.cpp.

Type TINPUT

Definition at line 155 of file sigtype.cpp.

Referenced by infereSigType().

Type TINT

Definition at line 142 of file sigtype.cpp.

Type TKONST

Definition at line 145 of file sigtype.cpp.

Type TREAL

Definition at line 143 of file sigtype.cpp.

Type TREC

Definition at line 163 of file sigtype.cpp.

Referenced by initialRecType().

Type TSAMP

Definition at line 147 of file sigtype.cpp.