File indexing completed on 2024-05-12 05:39:27

0001 #ifndef EXECUTIONNODE_H
0002 #define EXECUTIONNODE_H
0003 
0004 #include "result/result.h"
0005 #include <diceparser/diceparser_global.h>
0006 #include <diceparser/diceparserhelper.h>
0007 
0008 #include <QCoreApplication>
0009 /**
0010  * @brief The ExecutionNode class
0011  */
0012 class DICEPARSER_EXPORT ExecutionNode
0013 {
0014     Q_DECLARE_TR_FUNCTIONS(ExecutionNode)
0015 public:
0016     /**
0017      * @brief ExecutionNode
0018      */
0019     ExecutionNode();
0020     /**
0021      * @brief ~ExecutionNode
0022      */
0023     virtual ~ExecutionNode();
0024     /**
0025      * @brief run
0026      * @param previous
0027      */
0028     virtual void run(ExecutionNode* previous= nullptr)= 0;
0029     /**
0030      * @brief getResult
0031      * @return
0032      */
0033     virtual Result* getResult();
0034     /**
0035      * @brief setNextNode
0036      */
0037     void setNextNode(ExecutionNode*);
0038     /**
0039      * @brief getNextNode
0040      * @return
0041      */
0042     ExecutionNode* getNextNode();
0043     /**
0044      * @brief getPreviousNode
0045      * @return
0046      */
0047     virtual ExecutionNode* getPreviousNode() const;
0048     void setPreviousNode(ExecutionNode* node);
0049     /**
0050      * @brief toString
0051      * @return
0052      */
0053     virtual QString toString(bool withLabel) const= 0;
0054     /**
0055      * @brief getPriority
0056      * @return
0057      */
0058     virtual qint64 getPriority() const= 0;
0059     /**
0060      * @brief getErrorList
0061      * @return
0062      */
0063     virtual QMap<Dice::ERROR_CODE, QString> getExecutionErrorMap();
0064 
0065     /**
0066      * @brief generateDotTree
0067      */
0068     virtual void generateDotTree(QString&);
0069 
0070     /**
0071      * @brief getHelp
0072      * @return
0073      */
0074     virtual QString getHelp();
0075 
0076     /**
0077      * @brief getCopy
0078      * @return should return a copy of that node.
0079      */
0080     virtual ExecutionNode* getCopy() const= 0;
0081 
0082     virtual qint64 getScalarResult();
0083 
0084 protected:
0085     /**
0086      * @brief m_nextNode
0087      */
0088     ExecutionNode* m_previousNode= nullptr;
0089     /**
0090      * @brief m_result
0091      */
0092     Result* m_result= nullptr;
0093     /**
0094      * @brief m_nextNode
0095      */
0096     ExecutionNode* m_nextNode= nullptr;
0097     /**
0098      * @brief m_errors
0099      */
0100     QMap<Dice::ERROR_CODE, QString> m_errors;
0101 
0102     QString m_id;
0103 };
0104 
0105 #endif // EXECUTIONNODE_H