ProteoWizard
MemoryIndex.hpp
Go to the documentation of this file.
1 //
2 // $Id: MemoryIndex.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 _MEMORYINDEX_HPP_
23 #define _MEMORYINDEX_HPP_
24 
25 
26 #include "Index.hpp"
27 
28 
29 namespace pwiz {
30 namespace data {
31 
32 
33 /// index implementation in memory;
34 /// find(string id) is O(logN);
35 /// find(ordinal index) is O(1);
36 /// memory footprint is basically (number of entries * 2)
38 {
39  public:
40 
41  MemoryIndex();
42 
43  virtual void create(std::vector<Entry>& entries);
44  virtual size_t size() const;
45  virtual EntryPtr find(const std::string& id) const;
46  virtual EntryPtr find(size_t index) const;
47 
48  private:
49  class Impl;
50  boost::shared_ptr<Impl> impl_;
51 };
52 
53 
54 } // namespace data
55 } // namespace pwiz
56 
57 
58 #endif // _MEMORYINDEX_HPP_