92da59259585ddcc544ac255ea7451455d765d22
[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  *  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
10  *
11  */
12
13 #ifndef __EXPHISTORY_HXX__
14 #define __EXPHISTORY_HXX__
15
16 #include <list>
17 #include <vector>
18 #include "types.hxx"
19 #include "ast.hxx"
20 #include "simplevar.hxx"
21
22 class ExpHistory
23 {
24 public :
25     ExpHistory();
26     ExpHistory(ExpHistory*, ast::SimpleVar*);
27     ExpHistory(ExpHistory*, types::typed_list*);
28     ExpHistory(ExpHistory*, ast::SimpleVar*, types::typed_list*, int, bool, types::InternalType*);
29
30     ~ExpHistory();
31
32     // expression "a"
33     void                    setExp(ast::SimpleVar*);
34     ast::SimpleVar*         getExp();
35     std::wstring            getExpAsString();
36
37     // arguments x of a(x)
38     void                    setArgs(types::typed_list*);
39     types::typed_list*      getArgs();
40     int                     getSizeFromArgs();
41     int                     getArgsDims();
42     int*                    getArgsDimsArray();
43     void                    computeArgs();
44     bool                    needResize();
45     void                    setArgsOwner(bool);
46
47     // current InternalType a
48     bool                    setCurrent(types::InternalType*);
49     types::InternalType*    getCurrent();
50
51     // parent of me
52     ExpHistory*             getParent();
53
54     // use to know if we have to reinsert current in there parent and where
55     void                    setReinsertion();
56     void                    resetReinsertion();
57     bool                    reinsertMe();
58     int                     getWhereReinsert();
59     void                    setWhereReinsert(int);
60
61     // use to know where we are in expression
62     void                    setLevel(int);
63     int                     getLevel();
64
65     // management of expression a(x) or a{x}
66     void                    setCellExp();
67     bool                    isCellExp();
68
69 private :
70
71     void                    initHistory();
72
73     types::typed_list*      m_pArgs;
74     int*                    m_piArgsDimsArray;
75     int                     m_iArgsDims;
76
77     ast::SimpleVar*         m_pExp;
78     ExpHistory*             m_pParent;
79     types::InternalType*    m_pITCurrent;
80
81     bool                    m_bReinsertMe;
82     int                     m_iWhere;
83     int                     m_iLevel;
84
85     bool                    m_bCellExp;
86     bool                    m_pArgsOwner;
87 };
88
89 #endif /* __EXPHISTORY_HXX__ */