FAUST compiler  0.9.9.6b8
Public Member Functions | List of all members
RintPrim Class Reference
Inheritance diagram for RintPrim:
Inheritance graph
[legend]
Collaboration diagram for RintPrim:
Collaboration graph
[legend]

Public Member Functions

 RintPrim ()
 
virtual unsigned int arity ()
 
virtual bool needCache ()
 
virtual Type infereSigType (const vector< Type > &args)
 
virtual void sigVisit (Tree sig, sigvisitor *visitor)
 
virtual int infereSigOrder (const vector< int > &args)
 
virtual Tree computeSigOutput (const vector< Tree > &args)
 
virtual string generateCode (Klass *klass, const vector< string > &args, const vector< Type > &types)
 
virtual string generateLateq (Lateq *lateq, const vector< string > &args, const vector< Type > &types)
 
- Public Member Functions inherited from xtended
 xtended (const char *name)
 
virtual ~xtended ()
 
Sym symbol ()
 
const char * name ()
 
Tree box ()
 
virtual bool isSpecialInfix ()
 generaly false, but true for binary op # such that #(x) == _::x More...
 

Detailed Description

Definition at line 8 of file rintprim.cpp.

Constructor & Destructor Documentation

RintPrim::RintPrim ( )
inline

Definition at line 13 of file rintprim.cpp.

13 : xtended("rint") {}
xtended(const char *name)
Definition: xtended.hh:18

Member Function Documentation

virtual unsigned int RintPrim::arity ( )
inlinevirtual

Implements xtended.

Definition at line 15 of file rintprim.cpp.

Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().

15 { return 1; }

Here is the caller graph for this function:

virtual Tree RintPrim::computeSigOutput ( const vector< Tree > &  args)
inlinevirtual

Implements xtended.

Definition at line 38 of file rintprim.cpp.

References arity(), isNum(), xtended::symbol(), and tree().

38  {
39  num n;
40  assert (args.size() == arity());
41  if (isNum(args[0],n)) {
42  return tree(rint(double(n)));
43  } else {
44  return tree(symbol(), args[0]);
45  }
46  }
Definition: num.hh:58
bool isNum(Tree a)
Definition: signals.hh:187
Sym symbol()
Definition: xtended.hh:24
Tree tree(const Node &n)
Definition: tree.hh:186
virtual unsigned int arity()
Definition: rintprim.cpp:15

Here is the call graph for this function:

virtual string RintPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 48 of file rintprim.cpp.

References arity(), isuffix(), and subst().

49  {
50  assert (args.size() == arity());
51  assert (types.size() == arity());
52 
53  return subst("rint$1($0)", args[0], isuffix());
54  }
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47
virtual unsigned int arity()
Definition: rintprim.cpp:15
const char * isuffix()
suffix for math functions
Definition: floats.cpp:43

Here is the call graph for this function:

virtual string RintPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 56 of file rintprim.cpp.

References arity(), and subst().

57  {
58  assert (args.size() == arity());
59  assert (types.size() == arity());
60 
61  return subst("\\left[ {$0} \\right]", args[0]);
62  }
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47
virtual unsigned int arity()
Definition: rintprim.cpp:15

Here is the call graph for this function:

virtual int RintPrim::infereSigOrder ( const vector< int > &  args)
inlinevirtual

Implements xtended.

Definition at line 32 of file rintprim.cpp.

References arity().

32  {
33  assert (args.size() == arity());
34  return args[0];
35  }
virtual unsigned int arity()
Definition: rintprim.cpp:15

Here is the call graph for this function:

virtual Type RintPrim::infereSigType ( const vector< Type > &  args)
inlinevirtual

Implements xtended.

Definition at line 19 of file rintprim.cpp.

References arity(), castInterval(), and floatCast().

20  {
21  assert (args.size() == arity());
22  interval i = args[0]->getInterval();
23  if (i.valid) {
24  return castInterval(floatCast(args[0]), interval(rint(i.lo), rint(i.hi)));
25  } else {
26  return floatCast(args[0]);
27  }
28  }
Type floatCast(Type t)
Definition: sigtype.hh:270
virtual unsigned int arity()
Definition: rintprim.cpp:15
Type castInterval(Type t, const interval &i)
Definition: sigtype.hh:278

Here is the call graph for this function:

virtual bool RintPrim::needCache ( )
inlinevirtual

Implements xtended.

Definition at line 17 of file rintprim.cpp.

17 { return true; }
virtual void RintPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
)
inlinevirtual

Definition at line 30 of file rintprim.cpp.

30 {}

The documentation for this class was generated from the following file: