2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2007-2008 - DIGITEO - Bruno JOFRET
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 #ifndef AST_DOUBLEEXP_HXX
14 #define AST_DOUBLEEXP_HXX
16 #include "constexp.hxx"
18 #include "visitor.hxx"
22 /** \brief Abstract an Double Expression node.
24 ** \b Example: 42.51 */
25 class DoubleExp : public ConstExp
28 DoubleExp (const Location& location, double value)
29 : ConstExp (location),
34 DoubleExp (const Location& location, types::InternalType* value)
35 : ConstExp (location),
40 /** \brief Destroy an Double Expression node.
42 ** Delete size et init (exp) (see constructor). */
48 virtual DoubleExp* clone()
50 DoubleExp* cloned = new DoubleExp(getLocation(), getValue());
51 cloned->setVerbose(isVerbose());
55 virtual bool equal(const Exp & e) const
57 return e.getType() == DOUBLEEXP && _value == static_cast<const DoubleExp &>(e)._value;
60 /** \name Visitors entry point.
63 /** \brief Accept a const visitor \a v. */
64 virtual void accept (Visitor& v)
68 /** \brief Accept a non-const visitor \a v. */
69 virtual void accept (ConstVisitor& v) const
79 /** \brief Return the value */
80 double getValue() const
86 virtual ExpType getType() const
91 inline bool isDoubleExp() const
96 inline DoubleExp* neg()
99 //constant will not be update but
100 //normally neg is only called by parser
101 //before constant was created