PowPrim Class Reference

Inherits xtended.

Collaboration diagram for PowPrim:
[legend]

List of all members.

Public Member Functions

 PowPrim ()
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)
virtual bool isSpecialInfix ()
 generaly false, but true for binary op # such that #(x) == _::x

Detailed Description

Definition at line 7 of file powprim.cpp.


Constructor & Destructor Documentation

PowPrim::PowPrim (  )  [inline]

Definition at line 12 of file powprim.cpp.

00012 : xtended("powf") {}


Member Function Documentation

virtual unsigned int PowPrim::arity (  )  [inline, virtual]

Implements xtended.

Definition at line 14 of file powprim.cpp.

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

00014 { return 2; }

Here is the caller graph for this function:

virtual Tree PowPrim::computeSigOutput ( const vector< Tree > &  args  )  [inline, virtual]

Implements xtended.

Definition at line 33 of file powprim.cpp.

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

00033                                                                 {
00034         num n,m;
00035         assert (args.size() == arity());
00036         if (isNum(args[0],n) & isNum(args[1],m)) {
00037             return tree(pow(double(n), double(m)));
00038         } else {
00039             return tree(symbol(), args[0], args[1]);
00040         }
00041     }

Here is the call graph for this function:

virtual string PowPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 43 of file powprim.cpp.

References arity(), isuffix(), kInt, Klass::rememberNeedPowerDef(), and subst().

00044     {
00045         assert (args.size() == arity());
00046         assert (types.size() == arity());
00047 
00048         if (types[1]->nature() == kInt) {
00049             klass->rememberNeedPowerDef();
00050             return subst("faustpower<$1>($0)", args[0], args[1]);
00051         } else {
00052             return subst("pow$2($0,$1)", args[0], args[1], isuffix());
00053         }
00054     }

Here is the call graph for this function:

virtual string PowPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 56 of file powprim.cpp.

References arity(), and subst().

00057     {
00058         assert (args.size() == arity());
00059         assert (types.size() == arity());
00060         
00061         return subst("{$0}^{$1}", args[0], args[1]);
00062     }

Here is the call graph for this function:

virtual int PowPrim::infereSigOrder ( const vector< int > &  args  )  [inline, virtual]

Implements xtended.

Definition at line 27 of file powprim.cpp.

References arity(), and max().

00027                                                          {
00028         assert (args.size() == arity());
00029         return max(args[0], args[1]);
00030     }

Here is the call graph for this function:

virtual Type PowPrim::infereSigType ( const vector< Type > &  args  )  [inline, virtual]

Implements xtended.

Definition at line 18 of file powprim.cpp.

References arity(), and castInterval().

00019     {
00020         assert (args.size() == arity());
00021         //return castInterval(floatCast(args[0]|args[1]), interval()); // temporary !!!
00022         return castInterval(args[0]|args[1], interval()); // temporary !!!
00023     }

Here is the call graph for this function:

virtual bool PowPrim::isSpecialInfix (  )  [inline, virtual]

generaly false, but true for binary op # such that #(x) == _::x

Reimplemented from xtended.

Definition at line 66 of file powprim.cpp.

00066 { return true; }

virtual bool PowPrim::needCache (  )  [inline, virtual]

Implements xtended.

Definition at line 16 of file powprim.cpp.

00016 { return true; }

virtual void PowPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
) [inline, virtual]

Definition at line 25 of file powprim.cpp.

00025 {}  


The documentation for this class was generated from the following file:
Generated on Thu Jul 15 16:15:59 2010 for FAUST compiler by  doxygen 1.6.3