* Bug 15599 fixed: now degree of zero polynomial is -Inf
[scilab.git] / scilab / modules / ast / includes / ast / expHistory.hxx
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2014 - Scilab Enterpprises - Cedric Delamarre
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15
16 #ifndef __EXPHISTORY_HXX__
17 #define __EXPHISTORY_HXX__
18
19 #include <list>
20 #include <vector>
21 #include "types.hxx"
22 #include "ast.hxx"
23 #include "simplevar.hxx"
24
25 class ExpHistory
26 {
27 public :
28     ExpHistory();
29     ExpHistory(ExpHistory*, ast::SimpleVar*);
30     ExpHistory(ExpHistory*, types::typed_list*);
31     ExpHistory(ExpHistory*, ast::SimpleVar*, types::typed_list*, int, bool, types::InternalType*);
32
33     ~ExpHistory();
34
35     // expression "a"
36     void                    setExp(ast::SimpleVar*);
37     ast::SimpleVar*         getExp();
38     std::wstring            getExpAsString();
39
40     // arguments x of a(x)
41     void                    setArgs(types::typed_list*);
42     types::typed_list*      getArgs();
43     int                     getSizeFromArgs();
44     int                     getArgsDims();
45     int*                    getArgsDimsArray();
46     void                    computeArgs();
47     bool                    needResize();
48     void                    setArgsOwner(bool);
49     void                    setExpOwner(bool);
50
51     // current InternalType a
52     bool                    setCurrent(types::InternalType*);
53     types::InternalType*    getCurrent();
54     void                    setDeleteCurrent(bool bDelete); // false by default
55
56     // parent of me
57     ExpHistory*             getParent();
58
59     // use to know if we have to reinsert current in there parent and where
60     void                    setReinsertion(bool bForce = false);
61     void                    resetReinsertion();
62     bool                    reinsertMe();
63     int                     getWhereReinsert();
64     void                    setWhereReinsert(int);
65
66     // use to know where we are in expression
67     void                    setLevel(int);
68     int                     getLevel();
69
70     // management of expression a(x) or a{x}
71     void                    setCellExp();
72     bool                    isCellExp();
73
74 private :
75
76     void                    initHistory();
77
78     types::typed_list*      m_pArgs;
79     int*                    m_piArgsDimsArray;
80     ast::SimpleVar*         m_pExp;
81     ExpHistory*             m_pParent;
82     types::InternalType*    m_pITCurrent;
83     bool                    m_bReinsertMe;
84     bool                    m_bCellExp;
85     int                     m_iArgsDims;
86     int                     m_iWhere;
87     int                     m_iLevel;
88     bool                    m_pArgsOwner;
89     bool                    m_pExpOwner;
90     bool                    m_bDeleteCurrent;
91
92 };
93
94 #endif /* __EXPHISTORY_HXX__ */