VHISTlib
1.84.0.3018
|
00001 /* $HEADERS 00002 $Id: workflowtree.h 2179 2011-06-24 09:03:24Z ahuesgen $ 00003 */ 00004 00005 #ifndef WORKFLOWTREE_INCLUDED 00006 #define WORKFLOWTREE_INCLUDED 00007 00008 #include "../shared/misc_defines.h" 00009 #include "../unvhistlib/vhistparser.h" 00010 #include "../shared/logsource.h" 00011 #include "diffdefines.h" 00012 #include "workflowtreenode.h" 00013 #include "vhistfilemanager.h" 00014 00015 namespace vhist 00016 { 00017 00018 class VHIST_EXTERN WorkflowTree : public LogSource 00019 { 00020 Q_OBJECT 00021 00022 private: 00023 typedef QHash<NodeId, WorkflowTreeNode> TreeNodeHash; 00024 typedef QHash<NodeId, QList<NodeId> > ChildHash; 00025 00026 public: // construction/destruction 00027 WorkflowTree(QObject* listener = NULL); 00028 WorkflowTree(const WorkflowTree& rhs); 00029 ~WorkflowTree(); 00030 00031 WorkflowTree& operator=(const WorkflowTree& rhs); 00032 00033 public: // structural modifications of tree 00034 NodeId addTreeNode(NodeId parentId, const Workflowstep& wfs, 00035 const QString& filename, const QString& tmpfile); 00036 void clear(); 00037 00038 public: // creation of tree from VHIST files 00039 void treeFromVhistFile(SPVhistParser vhistFile, 00040 const QString& filename = "rootfile.vhist"); 00041 void treeFromVhistFile(const QString& vhistFile); 00042 00043 public: // getter 00044 const Workflowstep* workflowStep(NodeId nodeId) const; 00045 int parent(NodeId nodeId) const; 00046 QString vhistfile(NodeId nodeId) const; 00047 QString fileOnDisk(NodeId nodeId) const; 00048 QList<NodeId> children(int nodeId) const; 00049 SPVhistParser vhistParser(NodeId nodeId); 00050 00051 QList<NodeId> serializedTree() const; 00052 NodeId root() const; 00053 QList<NodeId> nodeIds() const; 00054 QLinkedList<NodeId> nodeIdsLinked() const; 00055 00056 00057 private: // tree filling helper 00058 QString extractFile(SPVhistParser vhistFile, int tagId); 00059 void fillTree(SPVhistParser vhistFile, NodeId parent, 00060 const QString& vhistFilename, 00061 const QString& fileOnDisk); 00062 00063 private: // structural helper 00064 void addTreeNode(const WorkflowTreeNode& node); 00065 QList<NodeId> serializeFromRoot(const NodeId& root) const; 00066 00067 private: // member variables 00068 NodeId m_nextId; 00069 TreeNodeHash m_nodes; 00070 ChildHash m_children; 00071 VhistFileManager m_filemanager; 00072 }; 00073 00074 } // namespace vhist 00075 00076 #endif // WORKFLOWTREE_H