logplus/Workflow/WFEngine/Module/include/ModuleMetaData.h

504 lines
13 KiB
C
Raw Normal View History

2026-01-16 17:18:41 +08:00
/**
* @file ModuleMetaData.h
* @brief
* @author dev
* @date 2011-8-29
*/
#ifndef PAI_FRAME_MODULEAPI_MODULEMETADATA_H
#define PAI_FRAME_MODULEAPI_MODULEMETADATA_H
#include <string>
#include <vector>
#include "ParameterItem.h"
#include "Turtle.h"
namespace Json {
class Value;
}
namespace pai {
namespace module {
typedef AcceptDropType OutputType;
/**
* @brief
*/
enum PortType
{
PORT_INPUT, /**< 输入端口*/
PORT_OUTPUT, /**< 输出端口*/
};
/**
* @class Port
* @brief
*/
class PAI_MODULE_EXPORT Port
{
public:
/**
* @brief
*/
Port();
int order; /**< */
PortType type; /**< 端口类型 */
std::string connectedModuleType; /**< 表示每个端口可接模块的类型如Trace */
std::string name; /**< */
bool optional; /**< */
};
/**
* @class CModuleMetaData
* @brief
*/
class PAI_MODULE_EXPORT CModuleMetaData
{
public:
/**
* @brief
*/
CModuleMetaData();
/*
* @brief
*/
virtual ~CModuleMetaData();
/**
* @brief
* @param[in] strCategory
*/
void SetCategory(const std::string& strCategory);
/**
* @brief
* @return
*/
std::string GetCategory() const;
/**
* @brief ID
* @param[in] strID ID
*/
void SetID(const std::string& strID);
/**
* @brief ID
* @return ID
*/
std::string GetID() const;
/**
* @brief
* @param[in] strName
*/
void SetName(const std::string& strName);
/**
* @brief
* @return
*/
std::string GetName() const;
/**
* @brief
* @param[in] strDescription
*/
void SetDescription(const std::string& strDescription);
/**
* @brief
* @return
*/
std::string GetDescription() const;
/**
* @brief
* @param[in] strAuthor
*/
void SetAuthor(const std::string& strAuthor);
/**
* @brief
* @return
*/
std::string GetAuthor() const;
/**
* @brief
* @param[in] strCreateTime
*/
void SetCreateTime(const std::string& strCreateTime);
/**
* @brief
* @return
*/
std::string GetCreateTime() const;
/**
* @brief
* @param[in] strModifyTime
*/
void SetLastModifyTime(const std::string& strLastModifyTime);
/**
* @brief
* @return
*/
std::string GetLastModifyTime() const;
/**
* @brief
* @param[in] strVersion
*/
void SetVersion(const std::string& strVersion);
/**
* @brief
* @return
*/
std::string GetVersion() const;
/**
* @brief
* @param[in] strSubCategory
*/
void SetSubCategory(const std::string& strSubCategory);
/**
* @brief
* @return
*/
std::string GetSubCategory() const;
/**
* @brief
* @param[in] strHelpDoc
*/
void SetHelpDoc(const std::string& strHelpDoc);
/**
* @brief
* @return
*/
std::string GetHelpDoc()const;
/**
* @brief
* @param[in] strDimension
*/
void SetDimension(const std::string& strDimension);
/**
* @brief
* @brief
*/
std::string GetDimension() const;
/**
* @brief
* @param[in] strDomain
*/
void SetDomain(const std::string& strDomain);
/**
* @brief
* @return
*/
std::string GetDomain() const;
/**
* @brief
* @param[in] strInputDomain
*/
void SetInputDomain(const std::string& strInputDomain);
/**
* @brief
* @return
*/
std::string GetInputDomain() const;
/**
* @brief
* @param[in] strOutputDomain
*/
void SetOutputDomain(const std::string& strOutputDomain);
/**
* @brief
* @return
*/
std::string GetOutputDomain() const;
/**
* @brief
* @param[in] strWorkUnit
*/
void SetWorkUnit(const std::string& strWorkUnit);
/**
* @brief
* @return
*/
std::string GetWorkUnit() const;
/**
* @brief
* @param[in] bInput true表示有输入,.
*/
void SetHasInput(const bool& bHasInput);
/**
* @brief
* @return truefalse
*/
bool GetHasInput() const;
/**
* @brief
* @param[in] bOutput true表示有输出,.
*/
void SetHasOutput(const bool& bHasOutput);
/**
* @brief
* @return truefalse
*/
bool GetHasOutput() const;
/**
* @brief
* @param[in] strIOType
*/
void SetIOType(const std::string& strIOType);
/**
* @brief
* @return
*/
std::string GetIOType() const;
/**
* @brief
* @param[in] bNeedOtherFile true表示需要其他文件,.
*/
void SetNeedOtherFile(const bool& bNeedOtherFile);
/**
* @brief
* @return truefalse
*/
bool GetNeedOtherFile() const;
/**
* @brief
* @param[in] bNeedTmpMemory true表示需要临时内存,.
*/
void SetNeedTmpMemory(const bool& bNeedTmpMemory);
/**
* @brief
* @return truefalse
*/
bool GetNeedTmpMemory() const;
/**
* @brief
* @param[in] bNeedOutputFile true表示需要输出其他文件,.
*/
void SetNeedOutputFile(const bool& bNeedOutputFile);
/**
* @brief
* @return truefalse
*/
bool GetNeedOutputFile() const;
/**
* @brief
* @param[in] bNeedParameters true表示需要参数信息,.
*/
void SetNeedParameters(const bool& bNeedParameters);
/**
* @brief
* @return truefalse
*/
bool GetNeedParameters() const;
/**
* @brief
* @param[in] bInterActive true表示需要内部激活,.
*/
void SetIsInterActive(const bool& bInterActive);
/**
* @brief
* @return truefalse
*/
bool GetIsInterActive() const;
/**
* @brief
* @param[in] iCompute 1\2\3\4
*/
void SetComputeLevel(const double& iCompute);
/**
* @brief
* @return
*/
double GetComputeLevel() const;
/**
* @brief
* @param[in] iMemory
*/
void SetMemoryLevel(const double& iMemory);
/**
* @brief
* @return
*/
double GetMemoryLevel() const;
/**
* @brief
* @param[in] strParallelMode Cpu\GPU
*/
void SetParallelMode(const std::string& strParallelMode);
/**
* @brief
* @return
*/
std::string GetParallelMode() const;
void SetNeedReduce(const bool& bReduce);
/**
* @brief Reduce
* @return truefalse
*/
bool GetNeedReduce() const;
/**
* @brief
* @param[in][out] vecInputPorts
*/
void GetInputPorts(std::vector<Port>& vecInputPorts);
/**
* @brief
* @param[in][out] vecOutputPorts
*/
void GetOutputPorts(std::vector<Port>& vecOutputPorts);
/**
* @brief
* @param[in] port
*/
void AddPort(const Port& port);
/**
* @brief index.
* @param[in] ePortType
* @param[in] iPortCount
*/
void AddPorts(PortType ePortType,int iPortCount);
/**
* @brief
* @return
*/
std::string GetStrLibName() const;
/**
* @brief
* @return
*/
std::string GetStrNameSpace() const;
void SetStrLibName(std::string m_strLibName);
void SetStrNameSpace(std::string m_strNameSpace);
/**
* @brief json对象
* @param[in] rMeta json对象
*/
void LoadFromJsonObject(const Json::Value& rMeta);
/**
* @brief Json文件中读取模块IO信息
* @param[in] pIO
* @param[in] root json对象
*/
void LoadIOFromJsonObject(const PortType pIO, const Json::Value& root);
/**
* @brief pai系统的版本号
* @return pai系统的版本号
*/
std::string GetPaiVersion() const;
/**
* @brief pai系统版本号
* @param[in] m_strPaiVersion pai系统版本号
*/
void SetPaiVersion(std::string m_strPaiVersion);
/**
* @brief
* @param[in] acceptDropTypes
*/
void AddOutputType(OutputType outputType);
/**
* @brief
* @return
*/
// std::vector<OutputType> GetOutputTypes() const ;
/**
* @brief "1",json文件自己带过来
* @param[in] stageNum模块并行阶段数
*/
void SetStageNum(std::string stageNum);
/**
* @brief "1"
* @return
*/
std::string GetStageNum() const;
/**
* @brief ,json文件自己带过来
* @param[in] SplitStage
*/
void SetSplitStage(std::string SplitStage);
/**
* @brief
* @return
*/
std::string GetSplitStage() const;
/**
* @brief
* @return
*/
int GetInputPortCount();
/**
* @brief
* @return
*/
int GetOutputPortCount();
private:
std::string RemoveSpace(std::string str);
private:
std::vector<Port> m_vecPorts;
std::string m_strCategory;//模块分类名
std::string m_strID;//模块ID
std::string m_strNameSpace;//模块命名空间
std::string m_strLibName;//模块编译结果库名
std::string m_strName;//模块名字
std::string m_strDescription;//模块描述
std::string m_strAuthor;//模块作者名
std::string m_strCreateTime;//模块创建日期
std::string m_strLastModifyTime;//模块上次修改日期
std::string m_strVersion;//模块版本号
std::string m_strPaiVersion;//Pai版本号
std::string m_strSubCategory;//模块子类型
std::string m_strHelpDoc;//模块帮助文档名
std::string m_strDimension;//模块空间维数
std::string m_strDomain;//工作域
std::string m_strInputDataDomain;//输入数据域
std::string m_strOuputDataDomain;//输出数据域
std::string m_strWorkUnit;//基本工作单元
bool m_bHasInput;//是否输入数据流
bool m_bHasOutput;//是否输出数据流
std::string m_strIOType;//模块I/O模式
bool m_bNeedOtherFile;//是否读入其他数据文件
bool m_bNeedTmpMemory;//是否需要使用临时空间
bool m_bOutputOtherFile;//是否输出其他文件
bool m_bNeedParameters;//是否带参数
bool m_bIsInterActive;//是否交互处理模块
double m_iCompute;//计算量指数1-4之间值表示计算量的相对大小
double m_iMemory;//内存指数1-4之间值表示计算量的相对大小
std::string m_strParalleMode;//并行方式
bool m_bNeedReduce;//是否实现reduce方法
int m_iOutputTypes;//该模块的输出数据的数据类型
std::string m_strStageNum;//模块并行阶段数
std::string m_SplitStage;//模块哪些阶段需要切片
};
}
}
#endif