Update RevisionGraph to 15570
[TortoiseGit.git] / src / TortoiseProc / RevisionGraph / VisibleGraph.h
blob4b370355c54ff652050126630cb70b4ece75aa1a
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
21 // required includes
23 #include "VisibleGraphNode.h"
25 /**
26 * Contains a filtered copy of some \ref CFullGraph instance.
28 * Acts as factory and container for all nodes and their sub-structres.
31 class CVisibleGraph
33 private:
35 CVisibleGraphNode::CFactory nodeFactory;
37 /// the graph is actually a forest of trees
39 std::vector<CVisibleGraphNode*> roots;
41 /// where new roots should be inserted
43 size_t insertionIndex;
45 public:
47 /// construction / destruction
49 CVisibleGraph(void);
50 ~CVisibleGraph(void);
52 /// modification
54 void Clear();
55 CVisibleGraphNode* Add ( const CFullGraphNode* base
56 , CVisibleGraphNode* source
57 , bool preserveNode);
59 void ReplaceRoot (CVisibleGraphNode* oldRoot, CVisibleGraphNode* newRoot);
60 void RemoveRoot (CVisibleGraphNode* root);
61 void AddRoot (CVisibleGraphNode* root);
63 /// member access
65 size_t GetRootCount() const;
66 CVisibleGraphNode* GetRoot (size_t index);
67 const CVisibleGraphNode* GetRoot (size_t index) const;
69 size_t GetNodeCount() const;
70 size_t GetInsertionIndex() const;
71 void SetInsertionIndex (size_t index);
73 /// factory access
75 CVisibleGraphNode::CFactory& GetFactory();
78 /// member access
80 inline size_t CVisibleGraph::GetRootCount() const
82 return roots.size();
85 inline const CVisibleGraphNode* CVisibleGraph::GetRoot (size_t index) const
87 return roots[index];
90 inline CVisibleGraphNode* CVisibleGraph::GetRoot (size_t index)
92 return roots[index];
95 inline size_t CVisibleGraph::GetNodeCount() const
97 return nodeFactory.GetNodeCount();
100 inline size_t CVisibleGraph::GetInsertionIndex() const
102 return insertionIndex;
105 inline void CVisibleGraph::SetInsertionIndex (size_t index)
107 insertionIndex = index;
110 inline CVisibleGraphNode::CFactory& CVisibleGraph::GetFactory()
112 return nodeFactory;