/* * 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 #include #include namespace pai{ namespace workflow{ class CWorkFlowFileWrapper; typedef map >::iterator WrapperMapIter; struct WorkflowCellInfo { int m_Id; CWorkFlowFile *m_Workflow; JobCreater *m_JobCreater; set m_ChildCellIds; set m_ParentCellIds; vector m_InModuleIds; vector 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确定,不需要创建输出、输入模块pair,如:PSTM类、地表一致性类、sort内部实现。 */ class CWorkFlowFileWrapper { public: CWorkFlowFileWrapper(CWorkFlowFile* workflowFile); CWorkFlowFileWrapper& operator=(const CWorkFlowFileWrapper& wrapper); virtual ~CWorkFlowFileWrapper(); CWorkFlowFile* GetWorkFlowFile(); void SetDecomposeAspects(const vector &aspects); vector& GetDecomposeAspects(); void SetDecomposeWkfWrapper(const map > &wkfWrappers); map >& GetDecomposeWkfWrapper(); void GetWorkflowCellInfoMap(map &workflowCellMap); std::vector GetLeafWkfWrapper(); private: CWorkFlowFileWrapper(const CWorkFlowFileWrapper& wkfWrapper); void IterateWrappers(CWorkFlowFileWrapper *wrapper, vector &aspects, map &workflowCellMap); void GetIOModuleIds(CWorkFlowFile *workflow, vector &iModuleIds, vector &oModuleIds); void GetJobCreater(CWorkFlowFile *workflow, JobCreater *&jobCreater); void FillParentAndChildCellIds(vector &aspects, map &workflowCellMap, WorkflowCellInfo *info); void InneralGetLeafWkfWrapper(CWorkFlowFileWrapper* wkfWrapper, std::vector& leafWkfList); private: int m_CurrentCellId; CWorkFlowFile* m_WorkflowFile; map > m_DecomposeWkfWrapper;//存储拆分后的工作流容器,key表示工作流执行顺序 vector m_DecomposeAspects; //记录拆分过程的拆分切面 }; } } #endif /* WORKFLOWFILEWRAPPER_H_ */