252 lines
5.2 KiB
C++
252 lines
5.2 KiB
C++
/**
|
||
* @file ModuleInfomation.h
|
||
* @brief 模块信息类
|
||
*
|
||
* @author 黄军
|
||
* @date 2011-7-27
|
||
*/
|
||
|
||
#ifndef PAI_FRAME_WORKFLOWENGINE_MODULEINFORMATION_H
|
||
#define PAI_FRAME_WORKFLOWENGINE_MODULEINFORMATION_H
|
||
|
||
#include <iostream>
|
||
|
||
#include "Module.h"
|
||
#include "ModuleParameter.h"
|
||
// #include "ModuleConnection.h"
|
||
|
||
namespace pai {
|
||
namespace workflow {
|
||
|
||
using namespace pai::module;
|
||
/**
|
||
* @brief 模块信息类
|
||
*
|
||
*/
|
||
class PAI_WORKFLOWENGINE_EXPORT CModuleInformation
|
||
{
|
||
private:
|
||
|
||
CModule* m_oModule;
|
||
|
||
int m_iStepId;
|
||
|
||
/*
|
||
* 模块 id
|
||
* 字段不能为空
|
||
* */
|
||
int m_iId;
|
||
/*
|
||
* 模块类的namespace
|
||
* 字段不能为空
|
||
* */
|
||
std::string m_strNamespace;
|
||
/*
|
||
* 模块的名称,也是模块类的class name
|
||
* 字段不能为空
|
||
* */
|
||
std::string m_strName;
|
||
//模块版本
|
||
std::string m_strVersion;
|
||
//模块qc,默认值等于false
|
||
bool m_bQC;
|
||
//模块断点,默认值等于false
|
||
bool m_bBreakpoint;
|
||
std::string m_strComments;
|
||
//模块是否可用,默认值等于true
|
||
bool m_bEnabled;
|
||
//模块的参数集合
|
||
CModuleParameter* m_ModParam;
|
||
//模块的
|
||
std::vector<CModuleInformation*> inModules;
|
||
std::vector<CModuleInformation*> outModules;
|
||
bool m_bBlankModule;//blank module or not
|
||
|
||
CModuleInformation & operator=(const workflow::CModuleInformation&);
|
||
public:
|
||
/**
|
||
* @biref 目前只能计算浅层的内存统计,主要用于GUI排查内存增长问题
|
||
* @return 对象占用内存的大小
|
||
*/
|
||
unsigned long GetMemorySize();
|
||
|
||
/**@brief 设置 @ref CModule
|
||
* @param[in] module 模块
|
||
*/
|
||
//REMOVEME
|
||
void SetModule(CModule* module)
|
||
{
|
||
m_oModule = module;
|
||
}
|
||
|
||
/**@brief 获取@ref CModule 模块
|
||
* @return CModule*
|
||
*/
|
||
CModule* GetModule() const
|
||
{
|
||
return m_oModule;
|
||
}
|
||
|
||
/**
|
||
* @brief
|
||
*/
|
||
void SetStepID(int iStepID)
|
||
{
|
||
m_iStepId = iStepID;
|
||
}
|
||
/**@brief 获取模块在工作流中的位置
|
||
*@see CModule
|
||
*/
|
||
int GetStepID() const
|
||
{
|
||
return m_iStepId;
|
||
}
|
||
|
||
/**@brief 获取模块ID
|
||
* @return string 模块ID
|
||
*/
|
||
std::string GetModuleID() const
|
||
{
|
||
return m_oModule->GetMetaData()->GetID();
|
||
}
|
||
|
||
std::string GetClassName() const
|
||
{
|
||
if (m_oModule)
|
||
return m_oModule->GetClassName();
|
||
else
|
||
return "";
|
||
}
|
||
/**@brief 获取模块的元数据
|
||
* @return CModuleMetaData* 模块元数据对象
|
||
* @see CModuleMetaData
|
||
*/
|
||
const CModuleMetaData* GetModuleMetaData() const;
|
||
/**
|
||
* 设置模块参数
|
||
* @param[in] _parammmmeter 模块所对应的参数对象地址
|
||
* @see ModuleParameter
|
||
*/
|
||
void SetParameters(CModuleParameter* _parameter)
|
||
{
|
||
m_oModule->SetParameters(_parameter);
|
||
}
|
||
/**
|
||
* 获取模块参数
|
||
* @return ModuleParameter* 模块所对应的参数地址
|
||
* @see ModuleParameter
|
||
*/
|
||
CModuleParameter* GetModuleParameter() const;
|
||
|
||
// Deprecated methods
|
||
int GetId() const
|
||
{
|
||
return this->GetStepID();
|
||
}
|
||
void SetId(int iId)
|
||
{
|
||
SetStepID(iId);
|
||
}
|
||
|
||
std::string GetNamespace() const
|
||
{
|
||
return this->m_strNamespace;
|
||
}
|
||
void SetNamespace(const std::string& strNamespace)
|
||
{
|
||
this->m_strNamespace = strNamespace;
|
||
}
|
||
|
||
//REMOVEME
|
||
void SetName(const std::string& strName)
|
||
{
|
||
this->m_strName = strName;
|
||
}
|
||
std::string GetName() const;
|
||
|
||
bool GetQC() const
|
||
{
|
||
return this->m_bQC;
|
||
}
|
||
void SetQC(bool bQC)
|
||
{
|
||
this->m_bQC = bQC;
|
||
}
|
||
|
||
bool GetBreakpoint() const
|
||
{
|
||
return this->m_bBreakpoint;
|
||
}
|
||
void SetBreakpoint(bool bBreakpoint)
|
||
{
|
||
this->m_bBreakpoint = bBreakpoint;
|
||
}
|
||
|
||
std::string GetComments() const
|
||
{
|
||
return this->m_strComments;
|
||
}
|
||
std::string GetComments2() const;
|
||
void SetComments(const std::string& strComments)
|
||
{
|
||
this->m_strComments = strComments;
|
||
}
|
||
|
||
std::string GetVersion() const
|
||
{
|
||
return this->m_strVersion;
|
||
}
|
||
void SetVersion(const std::string& strVersion)
|
||
{
|
||
this->m_strVersion = strVersion;
|
||
}
|
||
|
||
bool GetEnabled() const
|
||
{
|
||
return this->m_bEnabled;
|
||
}
|
||
void SetEnabled(bool bEnabled)
|
||
{
|
||
this->m_bEnabled = bEnabled;
|
||
}
|
||
/**
|
||
* @brief Get whether it is blank module or not
|
||
*/
|
||
bool IsBlankModule() const;
|
||
/**
|
||
* @brief Set whether it is blank module or not
|
||
*/
|
||
void SetBlankModule(bool bBlankModule);
|
||
|
||
//REMOVEME
|
||
CModuleParameter* GetModuleParam()
|
||
{
|
||
return this->m_ModParam;
|
||
}
|
||
|
||
void Print();
|
||
|
||
std::string static ParamItemTypeToString(ParameterType type);
|
||
|
||
CModuleInformation();
|
||
CModuleInformation(const workflow::CModuleInformation&);
|
||
CModuleInformation(const std::string& moduleClass);
|
||
virtual ~CModuleInformation();
|
||
/**
|
||
* @brief 克隆函数
|
||
* @param srcModuleInfo 克隆的对象
|
||
*/
|
||
void Clone(const workflow::CModuleInformation& srcModuleInfo);
|
||
|
||
/**
|
||
* @brief 比较两个模块信息
|
||
*
|
||
*/
|
||
friend bool operator ==(CModuleInformation &info, CModuleInformation &info2);
|
||
};
|
||
|
||
}
|
||
}
|
||
|
||
#endif
|