ProteoWizard
pwiz
data
msdata
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
26
#include "
pwiz/utility/misc/Export.hpp
"
27
#include "
MSData.hpp
"
28
#include "
MemoryMRUCache.hpp
"
29
#include "
SpectrumListWrapper.hpp
"
30
31
32
namespace
pwiz
{
33
namespace
msdata {
34
35
36
/// adds a level of flexible MRU caching to a SpectrumList processor chain
37
class
PWIZ_API_DECL
SpectrumListCache
:
public
SpectrumListWrapper
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
45
SpectrumListCache
(
const
SpectrumListPtr
& inner,
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
54
CacheType
&
spectrumCache
();
55
56
/// returns a const-reference to the cache
57
const
CacheType
&
spectrumCache
()
const
;
58
59
protected
:
60
mutable
CacheType
spectrumCache_
;
61
62
private
:
63
SpectrumListCache
(
SpectrumListCache
&);
64
SpectrumListCache
&
operator=
(
SpectrumListCache
&);
65
};
66
67
68
}
// namespace msdata
69
}
// namespace pwiz
70
71
72
#endif // _SPECTRUMLISTCACHE_HPP_
pwiz::msdata::SpectrumListCache::SpectrumListCache
SpectrumListCache(const SpectrumListPtr &inner, MemoryMRUCacheMode cacheMode, size_t cacheSize)
pwiz::msdata::SpectrumListPtr
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition:
MSData.hpp:711
pwiz::msdata::SpectrumListCache::CacheEntry
a cache mapping spectrum indices to SpectrumPtrs
Definition:
SpectrumListCache.hpp:42
pwiz::msdata::SpectrumListCache::spectrumCache
CacheType & spectrumCache()
returns a reference to the cache, to enable clearing it or changing the mode
pwiz
Definition:
ChromatogramList_Filter.hpp:36
pwiz::msdata::SpectrumListCache::spectrumCache_
CacheType spectrumCache_
Definition:
SpectrumListCache.hpp:60
MemoryMRUCache.hpp
pwiz::msdata::SpectrumListWrapper
Inheritable pass-through implementation for wrapping a SpectrumList.
Definition:
SpectrumListWrapper.hpp:38
pwiz::msdata::SpectrumListCache::operator=
SpectrumListCache & operator=(SpectrumListCache &)
MSData.hpp
pwiz::msdata::SpectrumListCache::CacheEntry::spectrum
SpectrumPtr spectrum
Definition:
SpectrumListCache.hpp:42
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition:
Export.hpp:32
pwiz::msdata::SpectrumListCache::spectrum
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
pwiz::msdata::SpectrumListCache::SpectrumListCache
SpectrumListCache(SpectrumListCache &)
pwiz::msdata::MemoryMRUCache
an MRU cache for SpectrumPtrs or ChromatogramPtrs
Definition:
MemoryMRUCache.hpp:46
Export.hpp
pwiz::msdata::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition:
MSData.hpp:573
pwiz::msdata::SpectrumListCache::spectrumCache
const CacheType & spectrumCache() const
returns a const-reference to the cache
pwiz::msdata::SpectrumListCache
adds a level of flexible MRU caching to a SpectrumList processor chain
Definition:
SpectrumListCache.hpp:38
pwiz::msdata::SpectrumListCache::CacheType
MemoryMRUCache< CacheEntry, BOOST_MULTI_INDEX_MEMBER(CacheEntry, size_t, index) > CacheType
Definition:
SpectrumListCache.hpp:43
SpectrumListWrapper.hpp
Generated by
1.8.18