logplus/Workflow/WFEngine/WorkflowEngine/include/WorkFlowFileWrapper.h

94 lines
3.0 KiB
C
Raw Normal View History

2026-01-16 17:18:41 +08:00
/*
* 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_ */