RintPrim Class Reference

Inherits xtended.

Collaboration diagram for RintPrim:
[legend]

List of all members.

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)

Detailed Description

Definition at line 18 of file rintprim.cpp.


Constructor & Destructor Documentation

RintPrim::RintPrim (  )  [inline]

Definition at line 23 of file rintprim.cpp.

00023 : xtended("rint") {}


Member Function Documentation

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

Implements xtended.

Definition at line 25 of file rintprim.cpp.

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

00025 { return 1; }

Here is the caller graph for this function:

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

Implements xtended.

Definition at line 48 of file rintprim.cpp.

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

00048                                                                 {
00049         num n;
00050         assert (args.size() == arity());
00051         if (isNum(args[0],n)) {
00052             return tree(rint(double(n)));
00053         } else {
00054             return tree(symbol(), args[0]);
00055         }
00056     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 58 of file rintprim.cpp.

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

00059     {
00060         assert (args.size() == arity());
00061         assert (types.size() == arity());
00062 
00063         return subst("rint$1($0)", args[0], isuffix());
00064     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 66 of file rintprim.cpp.

References arity(), and subst().

00067     {
00068         assert (args.size() == arity());
00069         assert (types.size() == arity());
00070         
00071         return subst("\\left[ {$0} \\right]", args[0]);
00072     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 42 of file rintprim.cpp.

References arity().

00042                                                          {
00043         assert (args.size() == arity());
00044         return args[0];
00045     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 29 of file rintprim.cpp.

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

00030     {
00031         assert (args.size() == arity());
00032         interval i = args[0]->getInterval();
00033         if (i.valid) {
00034             return castInterval(floatCast(args[0]), interval(rint(i.lo), rint(i.hi)));
00035         } else {
00036             return floatCast(args[0]);
00037         }
00038     }

Here is the call graph for this function:

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

Implements xtended.

Definition at line 27 of file rintprim.cpp.

00027 { return true; }

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

Definition at line 40 of file rintprim.cpp.

00040 {}  


The documentation for this class was generated from the following file:
Generated on Thu Apr 29 00:00:22 2010 for FAUST compiler by  doxygen 1.6.3