aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libparser/node/executionnode.h
blob: 64cc2daaa8ab392e7e46992b00f54fb5e007c41a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef EXECUTIONNODE_H
#define EXECUTIONNODE_H

#include "result/result.h"
#include <diceparser/diceparser_global.h>
#include <diceparser/diceparserhelper.h>

#include <QCoreApplication>
/**
 * @brief The ExecutionNode class
 */
class DICEPARSER_EXPORT ExecutionNode
{
    Q_DECLARE_TR_FUNCTIONS(ExecutionNode)
public:
    /**
     * @brief ExecutionNode
     */
    ExecutionNode();
    /**
     * @brief ~ExecutionNode
     */
    virtual ~ExecutionNode();
    /**
     * @brief run
     * @param previous
     */
    virtual void run(ExecutionNode* previous= nullptr)= 0;
    /**
     * @brief getResult
     * @return
     */
    virtual Result* getResult();
    /**
     * @brief setNextNode
     */
    void setNextNode(ExecutionNode*);
    /**
     * @brief getNextNode
     * @return
     */
    ExecutionNode* getNextNode();
    /**
     * @brief getPreviousNode
     * @return
     */
    virtual ExecutionNode* getPreviousNode() const;
    void setPreviousNode(ExecutionNode* node);
    /**
     * @brief toString
     * @return
     */
    virtual QString toString(bool withLabel) const= 0;
    /**
     * @brief getPriority
     * @return
     */
    virtual qint64 getPriority() const= 0;
    /**
     * @brief getErrorList
     * @return
     */
    virtual QMap<Dice::ERROR_CODE, QString> getExecutionErrorMap();

    /**
     * @brief generateDotTree
     */
    virtual void generateDotTree(QString&);

    /**
     * @brief getHelp
     * @return
     */
    virtual QString getHelp();

    /**
     * @brief getCopy
     * @return should return a copy of that node.
     */
    virtual ExecutionNode* getCopy() const= 0;

    virtual qint64 getScalarResult();

protected:
    /**
     * @brief m_nextNode
     */
    ExecutionNode* m_previousNode= nullptr;
    /**
     * @brief m_result
     */
    Result* m_result= nullptr;
    /**
     * @brief m_nextNode
     */
    ExecutionNode* m_nextNode= nullptr;
    /**
     * @brief m_errors
     */
    QMap<Dice::ERROR_CODE, QString> m_errors;

    QString m_id;
};

#endif // EXECUTIONNODE_H