76 lines
2.2 KiB
C++
76 lines
2.2 KiB
C++
/**
|
||
* @file WorkflowFileParser.h
|
||
* @brief 工作流解析器基类
|
||
*
|
||
* @author 黄军
|
||
* @date 2011-7-27
|
||
*/
|
||
|
||
#ifndef PAI_FRAME_WORKFLOWENGINE_WORKFLOWFILEPARSER_H
|
||
#define PAI_FRAME_WORKFLOWENGINE_WORKFLOWFILEPARSER_H
|
||
|
||
#include "WorkFlowFile.h"
|
||
|
||
namespace pai {
|
||
namespace workflow {
|
||
|
||
/**
|
||
* @brief 工作流文件解析器基类
|
||
*
|
||
* 提供了工作流解析器的基本接口方法:
|
||
* (1)工作流文件解析(不能直接调用基类方法)
|
||
* (2)工作流文件对象的检查(不能直接调用基类方法)
|
||
* 以及工作流文件对象的打印的具体实现
|
||
*
|
||
*/
|
||
class CWorkflowFileParser
|
||
{
|
||
public:
|
||
/*
|
||
* @brief 解析工作流文件为@ref CWolkFlowFile对象
|
||
*
|
||
* 在解析过程中不会校验文件格式的错误,可以等解析完成后,
|
||
* 调用@ref CheckWorkFlowFile方法去校验格式
|
||
*
|
||
* @param[in] strFilePath 工作流文件全路径
|
||
* @param[in/out] workFlowFile 工作流文件对象
|
||
* @pre 工作流文件必须存在,先初始化CWolkFlowFile对象
|
||
*/
|
||
virtual bool Parse(const std::string& strFilePath, CWorkFlowFile* workFlowFile) = 0;
|
||
|
||
/*
|
||
* @brief 检查工作流文件对象
|
||
*
|
||
* 如果校验有错误,错误信息先保存在errorMsg里
|
||
*
|
||
* @param[in] workFlowFile 校验工作流文件对象
|
||
* @param[in/out] errorMsg 校验错误信息
|
||
* @pre 要先初始化errorMsg
|
||
* @return 工作流对象是否通过校验
|
||
*/
|
||
virtual bool CheckWorkFlowFile(CWorkFlowFile* workFlowFile, std::string& errorMsg) = 0;
|
||
/*
|
||
* @brief 存储CWorkFlowFile对象到文件
|
||
*
|
||
* 在序列化的是,需要通过CheckWorkFlowFile校验,保证工作流文件的完整性
|
||
*
|
||
* @param[in] workFlowFile 工作流文件对象
|
||
* @param[in] strFilePath 工作流文件全路径
|
||
*/
|
||
virtual bool Serialize(CWorkFlowFile* workFlowFile, const std::string& strFilePath) = 0;
|
||
|
||
virtual std::string Serialize(CWorkFlowFile* workFlowFile)=0;
|
||
|
||
virtual bool ParseFromString(const std::string& jsonStr, CWorkFlowFile* workFlowFile, bool isWorkflow=false) = 0;
|
||
|
||
|
||
public:
|
||
CWorkflowFileParser();
|
||
virtual ~CWorkflowFileParser();
|
||
};
|
||
|
||
}
|
||
}
|
||
|
||
#endif
|