1 // Copyright (C) 2007 Zack Weinberg <zackw@panix.com>
2 //
3 // This program is made available under the GNU GPL version 2.0 or
4 // greater. See the accompanying file COPYING for details.
5 //
6 // This program is distributed WITHOUT ANY WARRANTY; without even the
7 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE.
9 
10 #ifndef __REV_TYPES_HH__
11 #define __REV_TYPES_HH__
12 
13 // This file contains forward declarations and typedefs for all of the basic
14 // types associated with revision handling.  It should be included instead
15 // of (any or all of) basic_io.hh, cset.hh, graph.hh, paths.hh, revision.hh,
16 // roster.hh, and database.hh when all that is necessary is these
17 // declarations.
18 
19 #include <boost/shared_ptr.hpp>
20 #include "vocab.hh"
21 #include "numeric_vocab.hh"
22 #include "hybrid_map.hh"
23 #include "vector.hh"
24 #include "cow_trie.hh"
25 
26 // full definitions in basic_io.hh
27 namespace basic_io
28 {
29   struct printer;
30   struct parser;
31   struct stanza;
32 }
33 
34 // full definitions in cset.hh
35 typedef u32 node_id;
36 struct cset;
37 struct editable_tree;
38 
39 const node_id first_temp_node = 1U << (sizeof(node_id) * 8 - 1);
temp_node(node_id n)40 inline bool temp_node(node_id n)
41 {
42   return n & first_temp_node;
43 }
44 
45 // full definitions in graph.hh
46 struct rev_graph;
47 struct reconstruction_graph;
48 typedef std::vector<id> reconstruction_path;
49 typedef std::multimap<revision_id, revision_id> rev_ancestry_map;
50 
51 // full definitions in paths.hh
52 class any_path;
53 class bookkeeping_path;
54 class file_path;
55 class system_path;
56 class path_component;
57 
58 // full definitions in revision.hh
59 struct revision_t;
60 typedef std::map<revision_id, boost::shared_ptr<cset> > edge_map;
61 typedef edge_map::value_type edge_entry;
62 
63 // full definitions in rev_height.hh
64 class rev_height;
65 
66 // full definitions in roster.hh
67 struct node_id_source;
68 struct node;
69 struct dir_node;
70 struct file_node;
71 struct marking;
72 class roster_t;
73 class editable_roster_base;
74 
75 typedef boost::shared_ptr<node> node_t;
76 typedef boost::shared_ptr<file_node> file_t;
77 typedef boost::shared_ptr<dir_node> dir_t;
78 
79 typedef boost::shared_ptr<node const> const_node_t;
80 typedef boost::shared_ptr<file_node const> const_file_t;
81 typedef boost::shared_ptr<dir_node const> const_dir_t;
82 
83 typedef boost::shared_ptr<marking> marking_t;
84 typedef boost::shared_ptr<marking const> const_marking_t;
85 class marking_map;
86 
87 typedef std::map<path_component, node_t> dir_map;
88 //typedef hybrid_map<node_id, node_t> node_map;
89 typedef cow_trie<node_id, node_t, 8> node_map;
90 
91 // (true, "val") or (false, "") are both valid attr values (for proper
92 // merging, we have to widen the attr_value type to include a first-class
93 // "undefined" value).
94 typedef std::map<attr_key, std::pair<bool, attr_value> > attr_map_t;
95 
96 // full definitions in database.hh
97 class database;
98 class conditional_transaction_guard;
99 class transaction_guard;
100 
101 typedef boost::shared_ptr<roster_t const> roster_t_cp;
102 typedef boost::shared_ptr<marking_map const> marking_map_cp;
103 typedef std::pair<roster_t_cp, marking_map_cp> cached_roster;
104 
105 typedef std::map<revision_id, cached_roster> parent_map;
106 typedef parent_map::value_type parent_entry;
107 
108 #endif // __REV_TYPES_HH__
109 
110 // Local Variables:
111 // mode: C++
112 // fill-column: 76
113 // c-file-style: "gnu"
114 // indent-tabs-mode: nil
115 // End:
116 // vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
117