logplus/Workflow/WFEngine/WorkflowEngine/include/WorkFlowFileWrapper.h
2026-01-16 17:18:41 +08:00

94 lines
3.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* WorkFlowFileWrapper.h
*
* Created on: Mar 19, 2015
* Author: dev
*/
#ifndef PAI_FRAME_WORKFLOWENGINE_WORKFLOWFILEWRAPPER_H
#define PAI_FRAME_WORKFLOWENGINE_WORKFLOWFILEWRAPPER_H
#include "WorkFlowFile.h"
#include "JobCreater.h"
#include "DecomposeAspect.h"
#include <map>
#include <vector>
#include <set>
namespace pai{
namespace workflow{
class CWorkFlowFileWrapper;
typedef map<int, vector<CWorkFlowFileWrapper*> >::iterator WrapperMapIter;
struct WorkflowCellInfo
{
int m_Id;
CWorkFlowFile *m_Workflow;
JobCreater *m_JobCreater;
set<int> m_ChildCellIds;
set<int> m_ParentCellIds;
vector<int> m_InModuleIds;
vector<int> m_OutModuleIds;
WorkflowCellInfo(): m_Id(), m_Workflow(NULL), m_JobCreater(NULL),
m_ChildCellIds(), m_ParentCellIds(), m_InModuleIds(), m_OutModuleIds()
{}
~WorkflowCellInfo()
{
//m_Workflow的内存由对应的WorkFlowFileWrapper在析构函数中释放
//释放m_JobCreater占用的内存
if (m_JobCreater != NULL)
{
delete m_JobCreater;
m_JobCreater = NULL;
}
}
};
/**
* @brief 拆分后的工作流依赖关系计算类通过拆分过程中建立的各相关父子关系工作流输出、输入模块pair
* 来确定各子工作流的关系。如果一个工作流的拆分是基于最简单、单一功能工作流的内部拆分,那么因此产生的
* 工作流关系由对应的JobCreater确定不需要创建输出、输入模块pairPSTM类、地表一致性类、sort内部实现。
*/
class CWorkFlowFileWrapper
{
public:
CWorkFlowFileWrapper(CWorkFlowFile* workflowFile);
CWorkFlowFileWrapper& operator=(const CWorkFlowFileWrapper& wrapper);
virtual ~CWorkFlowFileWrapper();
CWorkFlowFile* GetWorkFlowFile();
void SetDecomposeAspects(const vector<DecomposeAspect *> &aspects);
vector<DecomposeAspect *>& GetDecomposeAspects();
void SetDecomposeWkfWrapper(const map<int, vector<CWorkFlowFileWrapper*> > &wkfWrappers);
map<int, vector<CWorkFlowFileWrapper*> >& GetDecomposeWkfWrapper();
void GetWorkflowCellInfoMap(map<int, WorkflowCellInfo *> &workflowCellMap);
std::vector<CWorkFlowFileWrapper*> GetLeafWkfWrapper();
private:
CWorkFlowFileWrapper(const CWorkFlowFileWrapper& wkfWrapper);
void IterateWrappers(CWorkFlowFileWrapper *wrapper, vector<DecomposeAspect *> &aspects, map<int, WorkflowCellInfo *> &workflowCellMap);
void GetIOModuleIds(CWorkFlowFile *workflow, vector<int> &iModuleIds, vector<int> &oModuleIds);
void GetJobCreater(CWorkFlowFile *workflow, JobCreater *&jobCreater);
void FillParentAndChildCellIds(vector<DecomposeAspect *> &aspects, map<int, WorkflowCellInfo *> &workflowCellMap, WorkflowCellInfo *info);
void InneralGetLeafWkfWrapper(CWorkFlowFileWrapper* wkfWrapper, std::vector<CWorkFlowFileWrapper*>& leafWkfList);
private:
int m_CurrentCellId;
CWorkFlowFile* m_WorkflowFile;
map<int, vector<CWorkFlowFileWrapper*> > m_DecomposeWkfWrapper;//存储拆分后的工作流容器key表示工作流执行顺序
vector<DecomposeAspect *> m_DecomposeAspects; //记录拆分过程的拆分切面
};
}
}
#endif /* WORKFLOWFILEWRAPPER_H_ */