ReboltRunDelegate.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // ReboltRunDelegate.hpp
  3. // redream_runtime
  4. //
  5. // Created by zhu on 2022/11/3.
  6. //
  7. #ifndef ReboltRunDelegate_hpp
  8. #define ReboltRunDelegate_hpp
  9. #include <stdio.h>
  10. #include <string>
  11. #include <map>
  12. typedef enum ReboltErrorType{
  13. ReboltErrorTypeNone,
  14. ReboltErrorTypeWarn,
  15. ReboltErrorTypeError
  16. } ReboltLogType;
  17. typedef struct ReboltErrorInfo{
  18. ReboltErrorType errorType;
  19. std::string errorDes;
  20. ReboltErrorInfo(){
  21. errorType = ReboltErrorTypeNone;
  22. errorDes = "";
  23. }
  24. } ReboltErrorInfo;
  25. /// rebolt运行时的一些回调方法
  26. class ReboltRunDelegate {
  27. public:
  28. /// 开始播放一棵树
  29. /// - Parameter treeId: 树的随机ID
  30. virtual void onTreePlayStart(const std::string treeId) = 0;
  31. /// 树播放完毕
  32. /// - Parameter treeId: 树的随机ID
  33. /// - Parameter finishType: 结束类型 枚举{BT_INVALID, BT_SUCCESS, BT_FAILURE, BT_RUNNING,}
  34. /// - Parameter params: 预留的参数map
  35. virtual void onTreePlayFinished(const std::string treeId, int finishType, const std::map<std::string, std::string> params = {}) = 0;
  36. /// Block开始播放
  37. /// - Parameter treeId: 树的随机ID
  38. /// - Parameter stepId: block块的ID
  39. virtual void onTreeStepStart(const std::string treeId, const std::string stepId) = 0;
  40. /// 错误信息
  41. /// - Parameters:
  42. /// - errorJson: 错位信息{ "treeName", string树的名字}, { "blockId", string block块的ID}, { "errorType", int错误类型 0、无1、警告2、错误}, { "errorDes", string错误信息}
  43. virtual void onError(const std::string errorJson) = 0;
  44. };
  45. #endif /* ReboltRunDelegate_hpp */