117 lines
3.7 KiB
C
117 lines
3.7 KiB
C
|
|
/**
|
|||
|
|
* @file ModuleCheckResult.h
|
|||
|
|
* @brief 文件包含模块参数校验的错误信息结果定义
|
|||
|
|
* @author Haidong Wang
|
|||
|
|
* @date 2011-10-21
|
|||
|
|
*/
|
|||
|
|
#ifndef PAI_FRAME_MODULEAPI_MODULECHECKRESULT_H
|
|||
|
|
#define PAI_FRAME_MODULEAPI_MODULECHECKRESULT_H
|
|||
|
|
#include <string>
|
|||
|
|
#include <vector>
|
|||
|
|
#include "Turtle.h"
|
|||
|
|
namespace pai {
|
|||
|
|
namespace module {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @class CModuleParameterErrorInfo
|
|||
|
|
* @brief 模块参数的错误信息, 模块开发人员请不要直接调用此类的接口,此类需配合CModuleCheckResult使用.
|
|||
|
|
* @see CModuleCheckResult
|
|||
|
|
*/
|
|||
|
|
class CModuleParameterErrorInfo
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
/**
|
|||
|
|
* @brief 构造函数
|
|||
|
|
* @param[in] strParameterItemID 参数项ID
|
|||
|
|
* @param[in] strMessage 错误信息
|
|||
|
|
*/
|
|||
|
|
CModuleParameterErrorInfo(const std::string& strParameterItemID,const std::string& strMessage);
|
|||
|
|
/**
|
|||
|
|
* @brief 析构函数
|
|||
|
|
*/
|
|||
|
|
virtual ~CModuleParameterErrorInfo(){};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 获取模块参数项在对应模块的参数容器中的ID
|
|||
|
|
* @return 参数项的id
|
|||
|
|
*/
|
|||
|
|
std::string GetParameterItemID() const;
|
|||
|
|
/**
|
|||
|
|
* @brief 获取该模块参数Validate后产生的错误信息
|
|||
|
|
* @return 错误信息
|
|||
|
|
*/
|
|||
|
|
std::string GetMessage() const;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 设置该模块参数项的错误信息
|
|||
|
|
* @param[in] strMessage 模块参数项的错误信息
|
|||
|
|
*/
|
|||
|
|
void SetMessage(const std::string& strMessage);
|
|||
|
|
private:
|
|||
|
|
std::string m_strParamItemID; ///< 模块参数项在对应模块的参数容器中的ID
|
|||
|
|
std::string m_strMessage; ///< 模块参数Validate后产生的错误信息
|
|||
|
|
};
|
|||
|
|
/**
|
|||
|
|
* @class CModuleCheckResult
|
|||
|
|
* @brief 模块错误信息,包含了多个参数的错误提示, 用于模块校验开发
|
|||
|
|
*/
|
|||
|
|
class PAI_MODULE_EXPORT CModuleCheckResult
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
/**
|
|||
|
|
* @brief 构造函数
|
|||
|
|
* @param[in] iModuleStepID 模块id
|
|||
|
|
*/
|
|||
|
|
CModuleCheckResult(int iModuleStepID);
|
|||
|
|
/**
|
|||
|
|
* @brief 虚析构函数
|
|||
|
|
*/
|
|||
|
|
virtual ~CModuleCheckResult(){};
|
|||
|
|
/**
|
|||
|
|
* @brief 模块错误信息是否为空,为空表示没有错误信息
|
|||
|
|
* @return 没有错误信息则返回true,否则返回false
|
|||
|
|
*/
|
|||
|
|
bool IsEmpty() const;
|
|||
|
|
/**
|
|||
|
|
* @brief 增加模块参数错误信息
|
|||
|
|
* @param[in] strParameterItemID 模块参数在对应模块的参数容器中的ID
|
|||
|
|
* @param[in] strMessage 该模块参数的错误信息
|
|||
|
|
*/
|
|||
|
|
void AddParameterErroInfo(const std::string& strParameterItemID,const std::string& strMessage);
|
|||
|
|
/**
|
|||
|
|
* @brief 增加模块参数错误信息, 推荐模块开发人员调用<code>AddParameterErroInfo(std::string, std::string)</code>代替
|
|||
|
|
* @see CModuleCheckResult#AddParameterErroInfo(std::string, std::string)
|
|||
|
|
* @param[in] parameterErroInfo 模块参数错误信息
|
|||
|
|
*/
|
|||
|
|
void AddParameterErroInfo(const CModuleParameterErrorInfo& parameterErroInfo);
|
|||
|
|
/**
|
|||
|
|
* @brief 移除模块参数错误信息
|
|||
|
|
* @param[in] strParameterItemID 模块参数在对应模块的参数容器中的ID
|
|||
|
|
* @return 移除错误信息成功则返回true,否则返回false
|
|||
|
|
*/
|
|||
|
|
bool RemoveParameterErroInfo(const std::string& strParameterItemID);
|
|||
|
|
/**
|
|||
|
|
* @brief 得出所有出错的参数的索引
|
|||
|
|
* @brief[out] vecParameterItemIDs 所有出错的参数的ID
|
|||
|
|
*/
|
|||
|
|
void GetErroInfoParameterIDs(std::vector<std::string>& vecParameterItemIDs) const;
|
|||
|
|
/**
|
|||
|
|
* @brief 根据指定的参数索引得出对应的参数错误信息
|
|||
|
|
* @param[in] strParameterItemID 模块参数在对应模块的参数容器中的ID
|
|||
|
|
* @return 参数错误信息
|
|||
|
|
*/
|
|||
|
|
std::string GetErrorMessage(const std::string& strParameterItemID) const;
|
|||
|
|
/**
|
|||
|
|
* @brief 清空所有错误信息
|
|||
|
|
*/
|
|||
|
|
void Clear();
|
|||
|
|
private:
|
|||
|
|
int m_iModuleStepID; ///< 模块在对应工作流中的ID
|
|||
|
|
std::vector<CModuleParameterErrorInfo> m_vecParameterErroInfos; ///< 多个参数的错误提示集合
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif
|