1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+// |
|
2 |
+// $Id$ |
|
3 |
+// |
|
4 |
+// |
|
5 |
+// Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu> |
|
6 |
+// |
|
7 |
+// Copyright 2009 Vanderbilt University - Nashville, TN 37232 |
|
8 |
+// |
|
9 |
+// Licensed under the Apache License, Version 2.0 (the "License"); |
|
10 |
+// you may not use this file except in compliance with the License. |
|
11 |
+// You may obtain a copy of the License at |
|
12 |
+// |
|
13 |
+// http://www.apache.org/licenses/LICENSE-2.0 |
|
14 |
+// |
|
15 |
+// Unless required by applicable law or agreed to in writing, software |
|
16 |
+// distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
+// See the License for the specific language governing permissions and |
|
19 |
+// limitations under the License. |
|
20 |
+// |
|
21 |
+ |
|
22 |
+#ifndef _BINARYINDEX_HPP_ |
|
23 |
+#define _BINARYINDEX_HPP_ |
|
24 |
+ |
|
25 |
+ |
|
26 |
+#include "Index.hpp" |
|
27 |
+#include <iostream> |
|
28 |
+ |
|
29 |
+ |
|
30 |
+namespace pwiz { |
|
31 |
+namespace data { |
|
32 |
+ |
|
33 |
+ |
|
34 |
+/// index implementation in a stream (intended for fstreams but any iostream works); |
|
35 |
+/// find(string id) is O(logN); |
|
36 |
+/// find(ordinal index) is O(1); |
|
37 |
+/// memory footprint is negligible |
|
38 |
+class PWIZ_API_DECL BinaryIndexStream : public Index |
|
39 |
+{ |
|
40 |
+ public: |
|
41 |
+ |
|
42 |
+ BinaryIndexStream(boost::shared_ptr<std::iostream> indexStreamPtr); |
|
43 |
+ |
|
44 |
+ virtual void create(std::vector<Entry>& entries); |
|
45 |
+ virtual size_t size() const; |
|
46 |
+ virtual EntryPtr find(const std::string& id) const; |
|
47 |
+ virtual EntryPtr find(size_t index) const; |
|
48 |
+ |
|
49 |
+ private: |
|
50 |
+ class Impl; |
|
51 |
+ boost::shared_ptr<Impl> impl_; |
|
52 |
+}; |
|
53 |
+ |
|
54 |
+ |
|
55 |
+} // namespace data |
|
56 |
+} // namespace pwiz |
|
57 |
+ |
|
58 |
+ |
|
59 |
+#endif // _BINARYINDEX_HPP_ |
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,59 +0,0 @@ |
1 |
-// |
|
2 |
-// $Id: BinaryIndexStream.hpp 1621 2009-12-15 17:43:15Z chambm $ |
|
3 |
-// |
|
4 |
-// |
|
5 |
-// Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu> |
|
6 |
-// |
|
7 |
-// Copyright 2009 Vanderbilt University - Nashville, TN 37232 |
|
8 |
-// |
|
9 |
-// Licensed under the Apache License, Version 2.0 (the "License"); |
|
10 |
-// you may not use this file except in compliance with the License. |
|
11 |
-// You may obtain a copy of the License at |
|
12 |
-// |
|
13 |
-// http://www.apache.org/licenses/LICENSE-2.0 |
|
14 |
-// |
|
15 |
-// Unless required by applicable law or agreed to in writing, software |
|
16 |
-// distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
-// See the License for the specific language governing permissions and |
|
19 |
-// limitations under the License. |
|
20 |
-// |
|
21 |
- |
|
22 |
-#ifndef _BINARYINDEX_HPP_ |
|
23 |
-#define _BINARYINDEX_HPP_ |
|
24 |
- |
|
25 |
- |
|
26 |
-#include "Index.hpp" |
|
27 |
-#include <iostream> |
|
28 |
- |
|
29 |
- |
|
30 |
-namespace pwiz { |
|
31 |
-namespace data { |
|
32 |
- |
|
33 |
- |
|
34 |
-/// index implementation in a stream (intended for fstreams but any iostream works); |
|
35 |
-/// find(string id) is O(logN); |
|
36 |
-/// find(ordinal index) is O(1); |
|
37 |
-/// memory footprint is negligible |
|
38 |
-class PWIZ_API_DECL BinaryIndexStream : public Index |
|
39 |
-{ |
|
40 |
- public: |
|
41 |
- |
|
42 |
- BinaryIndexStream(boost::shared_ptr<std::iostream> indexStreamPtr); |
|
43 |
- |
|
44 |
- virtual void create(std::vector<Entry>& entries); |
|
45 |
- virtual size_t size() const; |
|
46 |
- virtual EntryPtr find(const std::string& id) const; |
|
47 |
- virtual EntryPtr find(size_t index) const; |
|
48 |
- |
|
49 |
- private: |
|
50 |
- class Impl; |
|
51 |
- boost::shared_ptr<Impl> impl_; |
|
52 |
-}; |
|
53 |
- |
|
54 |
- |
|
55 |
-} // namespace data |
|
56 |
-} // namespace pwiz |
|
57 |
- |
|
58 |
- |
|
59 |
-#endif // _BINARYINDEX_HPP_ |
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/mzR@57456 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
1 |
+// |
|
2 |
+// $Id: BinaryIndexStream.hpp 1621 2009-12-15 17:43:15Z chambm $ |
|
3 |
+// |
|
4 |
+// |
|
5 |
+// Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu> |
|
6 |
+// |
|
7 |
+// Copyright 2009 Vanderbilt University - Nashville, TN 37232 |
|
8 |
+// |
|
9 |
+// Licensed under the Apache License, Version 2.0 (the "License"); |
|
10 |
+// you may not use this file except in compliance with the License. |
|
11 |
+// You may obtain a copy of the License at |
|
12 |
+// |
|
13 |
+// http://www.apache.org/licenses/LICENSE-2.0 |
|
14 |
+// |
|
15 |
+// Unless required by applicable law or agreed to in writing, software |
|
16 |
+// distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
+// See the License for the specific language governing permissions and |
|
19 |
+// limitations under the License. |
|
20 |
+// |
|
21 |
+ |
|
22 |
+#ifndef _BINARYINDEX_HPP_ |
|
23 |
+#define _BINARYINDEX_HPP_ |
|
24 |
+ |
|
25 |
+ |
|
26 |
+#include "Index.hpp" |
|
27 |
+#include <iostream> |
|
28 |
+ |
|
29 |
+ |
|
30 |
+namespace pwiz { |
|
31 |
+namespace data { |
|
32 |
+ |
|
33 |
+ |
|
34 |
+/// index implementation in a stream (intended for fstreams but any iostream works); |
|
35 |
+/// find(string id) is O(logN); |
|
36 |
+/// find(ordinal index) is O(1); |
|
37 |
+/// memory footprint is negligible |
|
38 |
+class PWIZ_API_DECL BinaryIndexStream : public Index |
|
39 |
+{ |
|
40 |
+ public: |
|
41 |
+ |
|
42 |
+ BinaryIndexStream(boost::shared_ptr<std::iostream> indexStreamPtr); |
|
43 |
+ |
|
44 |
+ virtual void create(std::vector<Entry>& entries); |
|
45 |
+ virtual size_t size() const; |
|
46 |
+ virtual EntryPtr find(const std::string& id) const; |
|
47 |
+ virtual EntryPtr find(size_t index) const; |
|
48 |
+ |
|
49 |
+ private: |
|
50 |
+ class Impl; |
|
51 |
+ boost::shared_ptr<Impl> impl_; |
|
52 |
+}; |
|
53 |
+ |
|
54 |
+ |
|
55 |
+} // namespace data |
|
56 |
+} // namespace pwiz |
|
57 |
+ |
|
58 |
+ |
|
59 |
+#endif // _BINARYINDEX_HPP_ |