CosPrim Class Reference

Inherits xtended.

Collaboration diagram for CosPrim:
[legend]

List of all members.

Public Member Functions

 CosPrim ()
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)

Detailed Description

Definition at line 7 of file cosprim.cpp.


Constructor & Destructor Documentation

CosPrim::CosPrim (  )  [inline]

Definition at line 12 of file cosprim.cpp.

00012 : xtended("cos") {}


Member Function Documentation

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

Implements xtended.

Definition at line 14 of file cosprim.cpp.

Referenced by generateCode(), and generateLateq().

00014 { return 1; }

Here is the caller graph for this function:

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

Implements xtended.

Definition at line 31 of file cosprim.cpp.

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

00031                                                                 {
00032         num n;
00033         if (isNum(args[0],n)) {
00034             return tree(cos(double(n)));
00035         } else {
00036             return tree(symbol(), args[0]);
00037         }
00038     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 40 of file cosprim.cpp.

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

00041     {
00042         assert (args.size() == arity());
00043         assert (types.size() == arity());
00044         
00045         return subst("cos$1($0)", args[0], isuffix());
00046     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 48 of file cosprim.cpp.

References arity(), and subst().

00049     {
00050         assert (args.size() == arity());
00051         assert (types.size() == arity());
00052         
00053         return subst("\\cos\\left($0\\right)", args[0]);
00054     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 26 of file cosprim.cpp.

00026                                                          {
00027         return args[0];
00028     }

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

Implements xtended.

Definition at line 18 of file cosprim.cpp.

References castInterval(), and floatCast().

00019     {
00020         assert (args.size() == 1);
00021         return castInterval(floatCast(args[0]), interval(-1,1));
00022     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 16 of file cosprim.cpp.

00016 { return true; }

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

Definition at line 24 of file cosprim.cpp.

00024 {}  


The documentation for this class was generated from the following file:
Generated on Wed Apr 28 23:46:03 2010 for FAUST compiler by  doxygen 1.6.3