OSDN Git Service

Add TortoiseProc
[tortoisegit/TortoiseGitJp.git] / TortoiseProc / RevisionGraph / VisibleGraph.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 \r
21 // required includes\r
22 \r
23 #include "VisibleGraphNode.h"\r
24 \r
25 /**\r
26 * Contains a filtered copy of some \ref CFullGraph instance.\r
27\r
28 * Acts as factory and container for all nodes and their sub-structres.\r
29 */\r
30 \r
31 class CVisibleGraph\r
32 {\r
33 private:\r
34 \r
35     CVisibleGraphNode::CFactory nodeFactory;\r
36 \r
37     /// the graph is actually a forest of trees\r
38 \r
39     std::vector<CVisibleGraphNode*> roots;\r
40 \r
41 public:\r
42 \r
43     /// construction / destruction\r
44 \r
45     CVisibleGraph(void);\r
46     ~CVisibleGraph(void);\r
47 \r
48     /// modification\r
49 \r
50     void Clear();\r
51     CVisibleGraphNode* Add ( const CFullGraphNode* base\r
52                            , CVisibleGraphNode* source\r
53                            , bool preserveNode);\r
54 \r
55     void ReplaceRoot (CVisibleGraphNode* oldRoot, CVisibleGraphNode* newRoot);\r
56     void RemoveRoot (CVisibleGraphNode* root);\r
57     void AddRoot (CVisibleGraphNode* root);\r
58 \r
59     /// member access\r
60 \r
61     size_t GetRootCount() const;\r
62     CVisibleGraphNode* GetRoot (size_t index);\r
63     const CVisibleGraphNode* GetRoot (size_t index) const;\r
64 \r
65     size_t GetNodeCount() const;\r
66 \r
67     /// factory access\r
68 \r
69     CVisibleGraphNode::CFactory& GetFactory();\r
70 };\r
71 \r
72 /// member access\r
73 \r
74 inline size_t CVisibleGraph::GetRootCount() const\r
75 {\r
76     return roots.size();\r
77 }\r
78 \r
79 inline const CVisibleGraphNode* CVisibleGraph::GetRoot (size_t index) const\r
80 {\r
81     return roots[index];\r
82 }\r
83 \r
84 inline CVisibleGraphNode* CVisibleGraph::GetRoot (size_t index)\r
85 {\r
86     return roots[index];\r
87 }\r
88 \r
89 inline size_t CVisibleGraph::GetNodeCount() const\r
90 {\r
91     return nodeFactory.GetNodeCount();\r
92 }\r
93 \r
94 inline CVisibleGraphNode::CFactory& CVisibleGraph::GetFactory()\r
95 {\r
96     return nodeFactory;\r
97 }\r