ProteoWizard
SpectrumListCache.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6//
7// Copyright 2008 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 _SPECTRUMLISTCACHE_HPP_
23#define _SPECTRUMLISTCACHE_HPP_
24
25
27#include "MSData.hpp"
28#include "MemoryMRUCache.hpp"
30
31
32namespace pwiz {
33namespace msdata {
34
35
36/// adds a level of flexible MRU caching to a SpectrumList processor chain
38{
39 public:
40
41 /// a cache mapping spectrum indices to SpectrumPtrs
42 struct CacheEntry { CacheEntry(size_t i, SpectrumPtr s) : index(i), spectrum(s) {}; size_t index; SpectrumPtr spectrum; };
43 typedef MemoryMRUCache<CacheEntry, BOOST_MULTI_INDEX_MEMBER(CacheEntry, size_t, index) > CacheType;
44
46 MemoryMRUCacheMode cacheMode,
47 size_t cacheSize);
48
49 /// returns the requested spectrum which may or may not be cached depending on
50 /// the current cache mode
51 virtual SpectrumPtr spectrum(size_t index, bool getBinaryData = false) const;
52
53 /// returns a reference to the cache, to enable clearing it or changing the mode
55
56 /// returns a const-reference to the cache
57 const CacheType& spectrumCache() const;
58
59 protected:
61
62 private:
65};
66
67
68} // namespace msdata
69} // namespace pwiz
70
71
72#endif // _SPECTRUMLISTCACHE_HPP_
#define PWIZ_API_DECL
Definition Export.hpp:32
an MRU cache for SpectrumPtrs or ChromatogramPtrs
adds a level of flexible MRU caching to a SpectrumList processor chain
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const
returns the requested spectrum which may or may not be cached depending on the current cache mode
SpectrumListCache & operator=(SpectrumListCache &)
CacheType & spectrumCache()
returns a reference to the cache, to enable clearing it or changing the mode
const CacheType & spectrumCache() const
returns a const-reference to the cache
SpectrumListCache(SpectrumListCache &)
MemoryMRUCache< CacheEntry, BOOST_MULTI_INDEX_MEMBER(CacheEntry, size_t, index) > CacheType
SpectrumListCache(const SpectrumListPtr &inner, MemoryMRUCacheMode cacheMode, size_t cacheSize)
Inheritable pass-through implementation for wrapping a SpectrumList.
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition MSData.hpp:711
boost::shared_ptr< Spectrum > SpectrumPtr
Definition MSData.hpp:573
a cache mapping spectrum indices to SpectrumPtrs
CacheEntry(size_t i, SpectrumPtr s)