skein/hopper
view combined/skeintreepp.hpp @ 31:2cee2d6dcb85
I think I finally have a workable interface.
| author | Eric Hopper <hopper@omnifarious.org> |
|---|---|
| date | Fri Jun 26 23:26:10 2009 -0700 (2009-06-26) |
| parents | 1c8aa49d116f |
| children | b8b91d47e466 |
line source
1 #pragma once
2 #pragma interface
3 #include <string>
4 #include <cstddef>
5 #include <cstdint>
6 #include <algorithm>
7 #include "skeinpp.hpp"
8 #include "skeinpp_priv.hpp"
9 #define nullptr 0
15 #ifdef __GNUG__
21 }
22 }
24 }
25 #else
32 }
35 }
36 }
38 }
39 #endif
41 //! A class for generating hash values using SKein's tree hash mode.
48 };
50 //! Data for an individual leaf managed by a SkeinLeafFetcher, follows the
51 //! auto_ptr pattern of being moveable but not copyable.
52 //
53 // \invariant
54 // isLast() || getLeafSize() == fetcher.leafSize(), meaning that all leaves
55 // except for the last should be the leaf size given by the leaf fetcher.
56 //
57 // \note
58 // This class is moveable, but not copyable. In c++0x this is handled in the
59 // correct way using rvalue references, move constructors and move assignment
60 // operators while disabling copy constructors and standard assignment.
61 //
62 // \para
63 // In earlier versions of C++ this is done with ::std::auto_ptr like kludges in
64 // which the copy constructor and assignment operators modify the right hand
65 // side argument.
71 {
72 }
73 #ifdef HAVE_CXX0X
77 {
80 }
81 #else
85 {
88 }
89 #endif
91 {
93 }
95 //! Which leaf number is this?
97 //! Give me a pointer to the data for this leaf (preferably page aligned).
99 //! How big is this leaf (they should all be the same size except the last).
101 //! Is this the last leaf?
103 //! Is the data valid?
106 #ifdef HAVE_CXX0X
108 #else
110 #endif
111 {
117 }
119 // Done this way to properly handle self-assignment.
125 }
130 }
135 }
137 // Done this way to properly handle self-assignment.
143 }
145 }
148 //! Construct leaf data from the components.
149 //
150 // \param owner This reference is saved until the SkeinLeafData object is
151 // destroyed.
155 {
156 }
167 #ifdef HAVE_CXX0X
170 #endif
171 };
180 };
185 {
186 }
193 {
194 }
198 //! Size of each leaf.
200 //! How many leaves are at each level of the tree, must be >= 2.
202 //! Maximum height of tree from 2 to 255, 255 meaning unlimited.
205 //! Allocate a leaf and stuff it into the passed in SkeinLeafData object.
209 //! Informs the SkeinLeafFetcher that a given leaf is no longer needed in
210 // memory.
218 #ifdef HAVE_CXX0X
221 #else
222 //! Purposefully undefined
224 //! Purposefully undefined
226 #endif
227 };
231 {
236 }
237 }
