FAUST compiler  0.9.9.6b8
Functions | Variables
sigtype.cpp File Reference
#include "tree.hh"
#include "sigtype.hh"
#include "property.hh"
Include dependency graph for sigtype.cpp:

Go to the source code of this file.

Functions

ostream & operator<< (ostream &dst, const Type &t)
 
ostream & operator<< (ostream &dst, const SimpleType &t)
 
ostream & operator<< (ostream &dst, const TableType &t)
 
ostream & operator<< (ostream &dst, const TupletType &t)
 
Type operator| (const Type &t1, const Type &t2)
 
bool operator== (const Type &t1, const Type &t2)
 
bool operator<= (const Type &t1, const Type &t2)
 
Type operator* (const Type &t1, const Type &t2)
 
SimpleTypeisSimpleType (AudioType *t)
 
TableTypeisTableType (AudioType *t)
 
TupletTypeisTupletType (AudioType *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 is a type is appropriate for a delay. More...
 
string cType (Type t)
 
static Tree codeSimpleType (SimpleType *st)
 Code a simple audio type as a tree in order to benefit of memoization. More...
 
static Tree codeTableType (TableType *tt)
 Code a table type as a tree in order to benefit of memoization. More...
 
static Tree codeTupletType (TupletType *nt)
 Code a tuplet type as a tree in order to benefit of memoization. More...
 
Tree codeAudioType (AudioType *t)
 codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type field (of the coded type) is used to store the audio type 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, int b, const interval &i)
 
AudioTypemakeTableType (const Type &ct, int n, int v, int c, int vec)
 
AudioTypemakeTupletType (const vector< Type > &vt)
 
AudioTypemakeTupletType (const vector< Type > &vt, int n, int v, int c, int vec, int b, const interval &i)
 

Variables

Type TINT = makeSimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
 
Type TREAL = makeSimpleType(kReal, kKonst, kComp, kVect, kNum, interval())
 
Type TKONST = makeSimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
 
Type TBLOCK = makeSimpleType(kInt, kBlock, kComp, kVect, kNum, interval())
 
Type TSAMP = makeSimpleType(kInt, kSamp, kComp, kVect, kNum, interval())
 
Type TCOMP = makeSimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
 
Type TINIT = makeSimpleType(kInt, kKonst, kInit, kVect, kNum, interval())
 
Type TEXEC = makeSimpleType(kInt, kKonst, kExec, kVect, kNum, interval())
 
Type TINPUT = makeSimpleType(kReal, kSamp, kExec, kVect, kNum, interval())
 
Type TGUI = makeSimpleType(kReal, kBlock,kExec, kVect, kNum, interval())
 
Type TGUI01 = makeSimpleType(kReal, kBlock,kExec, kVect, kNum, interval(0,1))
 
Type INT_TGUI = makeSimpleType(kInt, kBlock,kExec, kVect, kNum, interval())
 
Type TREC = makeSimpleType(kInt, kSamp, kInit, kScal, kNum, interval())
 
property< AudioType * > MemoizedTypes
 
Sym SIMPLETYPE = symbol ("SimpleType")
 
Sym TABLETYPE = symbol ("TableType")
 
Sym TUPLETTYPE = symbol ("TupletType")
 

Function Documentation

int checkDelayInterval ( Type  t)

Check is a type 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)

codeAudioType(Type) -> Tree Code an audio type as a tree in order to benefit of memoization The type field (of the coded type) is used to store the audio type

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:

static Tree codeSimpleType ( SimpleType st)
static

Code a simple audio type as a tree in order to benefit of memoization.

Definition at line 404 of file sigtype.cpp.

References AudioType::boolean(), AudioType::computability(), AudioType::getInterval(), interval::hi, interval::lo, CTree::make(), AudioType::nature(), tree(), interval::valid, AudioType::variability(), and AudioType::vectorability().

Referenced by codeAudioType().

405 {
406  vector<Tree> elems;
407  elems.push_back(tree(st->nature()));
408  elems.push_back(tree(st->variability()));
409  elems.push_back(tree(st->computability()));
410  elems.push_back(tree(st->vectorability()));
411  elems.push_back(tree(st->boolean()));
412 
413  elems.push_back(tree(st->getInterval().valid));
414  elems.push_back(tree(st->getInterval().lo));
415  elems.push_back(tree(st->getInterval().hi));
416 
417  return CTree::make(SIMPLETYPE, elems);
418 
419 }
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
int boolean() const
returns when a signal stands for a boolean value
Definition: sigtype.hh:108
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one
int nature() const
returns the kind of values (integre or floating point)
Definition: sigtype.hh:104
int computability() const
returns when values are available (compilation, initialisation, execution)
Definition: sigtype.hh:106
Tree tree(const Node &n)
Definition: tree.hh:186
Sym SIMPLETYPE
Definition: sigtype.cpp:359
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:

Here is the caller graph for this function:

static Tree codeTableType ( TableType st)
static

Code a table type as a tree in order to benefit of memoization.

Definition at line 443 of file sigtype.cpp.

References codeAudioType(), TableType::content(), and tree().

Referenced by codeAudioType().

444 {
445  return tree(TABLETYPE, codeAudioType(tt->content()));
446 }
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
Tree tree(const Node &n)
Definition: tree.hh:186
Sym TABLETYPE
Definition: sigtype.cpp:360

Here is the call graph for this function:

Here is the caller graph for this function:

static Tree codeTupletType ( TupletType st)
static

Code a tuplet type as a tree in order to benefit of memoization.

Definition at line 504 of file sigtype.cpp.

References TupletType::arity(), codeAudioType(), and CTree::make().

Referenced by codeAudioType().

505 {
506  vector<Tree> elems;
507  for (int i=0; i<nt->arity(); i++) {
508  elems.push_back(codeAudioType((*nt)[i]));
509  }
510  return CTree::make(TUPLETTYPE, elems);
511 }
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
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one
Sym TUPLETTYPE
Definition: sigtype.cpp:361

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:

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,
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* 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* 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:

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:

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

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:

Variable Documentation

Definition at line 158 of file sigtype.cpp.

property<AudioType*> MemoizedTypes

Definition at line 356 of file sigtype.cpp.

Sym SIMPLETYPE = symbol ("SimpleType")

Definition at line 359 of file sigtype.cpp.

Sym TABLETYPE = symbol ("TableType")

Definition at line 360 of file sigtype.cpp.

Definition at line 146 of file sigtype.cpp.

Definition at line 149 of file sigtype.cpp.

Definition at line 151 of file sigtype.cpp.

Definition at line 156 of file sigtype.cpp.

Referenced by infereSigType().

Definition at line 157 of file sigtype.cpp.

Referenced by infereSigType().

Definition at line 150 of file sigtype.cpp.

Definition at line 155 of file sigtype.cpp.

Referenced by infereSigType().

Definition at line 142 of file sigtype.cpp.

Definition at line 145 of file sigtype.cpp.

Definition at line 143 of file sigtype.cpp.

Definition at line 163 of file sigtype.cpp.

Referenced by initialRecType().

Definition at line 147 of file sigtype.cpp.

Sym TUPLETTYPE = symbol ("TupletType")

Definition at line 361 of file sigtype.cpp.