rt-message.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef AFUN_RT_MESSAGE_H
  2. #define AFUN_RT_MESSAGE_H
  3. #include "aFunRuntimeExport.h"
  4. #include "aFuncore.h"
  5. namespace aFunrt {
  6. class TopMessage : public virtual aFuncore::Message {
  7. public:
  8. virtual void topProgress(aFuncore::Inter &inter, aFuncore::Activation &activation) = 0;
  9. };
  10. class AFUN_RT_EXPORT NormalMessage : public TopMessage {
  11. public:
  12. explicit NormalMessage(aFuncore::Object *obj_);
  13. AFUN_INLINE NormalMessage(NormalMessage &&msg) noexcept;
  14. ~NormalMessage() override;
  15. void topProgress(aFuncore::Inter &inter, aFuncore::Activation &activation) override;
  16. AFUN_INLINE aFuncore::Object *getObject();
  17. private:
  18. aFuncore::Object *obj;
  19. };
  20. class AFUN_RT_EXPORT ErrorMessage : public TopMessage {
  21. public:
  22. struct TrackBack {
  23. const aFuntool::FilePath path;
  24. aFuntool::FileLine line;
  25. };
  26. explicit ErrorMessage(std::string error_type_, std::string error_info_, aFuncore::Inter &inter);
  27. AFUN_INLINE ErrorMessage(ErrorMessage &&msg) noexcept;
  28. void topProgress(aFuncore::Inter &inter_, aFuncore::Activation &activation) override;
  29. [[nodiscard]] AFUN_INLINE std::string getErrorType() const;
  30. [[nodiscard]] AFUN_INLINE std::string getErrorInfo() const;
  31. [[nodiscard]] AFUN_INLINE const std::list<TrackBack> &getTrackBack() const;
  32. private:
  33. aFuncore::Inter &inter;
  34. std::string error_type;
  35. std::string error_info;
  36. std::list<TrackBack> trackback;
  37. };
  38. }
  39. #include "rt-message.inline.h"
  40. #endif //AFUN_RT_MESSAGE_H