ProteoWizard
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
pwiz::util::mru_list< Item, KeyExtractor > Class Template Reference

#include <mru_list.hpp>

Inheritance diagram for pwiz::util::mru_list< Item, KeyExtractor >:
pwiz::msdata::MemoryMRUCache< CacheEntry, BOOST_MULTI_INDEX_MEMBER(CacheEntry, size_t, index) > pwiz::msdata::MemoryMRUCache< PtrType, KeyExtractor >

Public Types

typedef Item item_type
 
typedef item_list::iterator iterator
 
typedef item_list::reverse_iterator reverse_iterator
 
typedef item_list::const_iterator const_iterator
 
typedef item_list::const_reverse_iterator const_reverse_iterator
 
typedef item_list::value_type value_type
 

Public Member Functions

 mru_list (std::size_t max_num_items_)
 
bool insert (const item_type &item)
 
template<typename Modifier >
bool modify (iterator position, Modifier modifier)
 
bool empty () const
 
std::size_t size () const
 
std::size_t max_size () const
 
void clear ()
 
const item_typemru () const
 
const item_typelru () const
 
iterator begin ()
 
iterator end ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 

Private Types

typedef boost::multi_index::multi_index_container< Item, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_unique< KeyExtractor > > > item_list
 

Private Attributes

item_list il
 
std::size_t max_num_items
 

Detailed Description

template<typename Item, typename KeyExtractor = boost::multi_index::identity<Item>>
class pwiz::util::mru_list< Item, KeyExtractor >

Definition at line 49 of file mru_list.hpp.

Member Typedef Documentation

◆ item_list

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef boost::multi_index::multi_index_container< Item, boost::multi_index::indexed_by < boost::multi_index::sequenced<>, boost::multi_index::hashed_unique<KeyExtractor> > > pwiz::util::mru_list< Item, KeyExtractor >::item_list
private

Definition at line 59 of file mru_list.hpp.

◆ item_type

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef Item pwiz::util::mru_list< Item, KeyExtractor >::item_type

Definition at line 62 of file mru_list.hpp.

◆ iterator

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef item_list::iterator pwiz::util::mru_list< Item, KeyExtractor >::iterator

Definition at line 63 of file mru_list.hpp.

◆ reverse_iterator

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef item_list::reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::reverse_iterator

Definition at line 64 of file mru_list.hpp.

◆ const_iterator

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef item_list::const_iterator pwiz::util::mru_list< Item, KeyExtractor >::const_iterator

Definition at line 65 of file mru_list.hpp.

◆ const_reverse_iterator

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef item_list::const_reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::const_reverse_iterator

Definition at line 66 of file mru_list.hpp.

◆ value_type

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
typedef item_list::value_type pwiz::util::mru_list< Item, KeyExtractor >::value_type

Definition at line 67 of file mru_list.hpp.

Constructor & Destructor Documentation

◆ mru_list()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
pwiz::util::mru_list< Item, KeyExtractor >::mru_list ( std::size_t  max_num_items_)
inline

Definition at line 69 of file mru_list.hpp.

69: max_num_items(max_num_items_){}
std::size_t max_num_items
Definition mru_list.hpp:113

Member Function Documentation

◆ insert()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
bool pwiz::util::mru_list< Item, KeyExtractor >::insert ( const item_type item)
inline

Definition at line 71 of file mru_list.hpp.

72 {
73 std::pair<iterator,bool> p=il.push_front(item);
74
75 if(!p.second){ /* duplicate item */
76 il.relocate(il.begin(),p.first); /* put in front */
77 return false; /* item not inserted */
78 }
79 else if(il.size()>max_num_items){ /* keep the length <= max_num_items */
80 il.pop_back();
81 }
82 return true; /* new item inserted */
83 }

References pwiz::util::mru_list< Item, KeyExtractor >::il, and pwiz::util::mru_list< Item, KeyExtractor >::max_num_items.

Referenced by test(), and testMemoryMRUCache().

◆ modify()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
template<typename Modifier >
bool pwiz::util::mru_list< Item, KeyExtractor >::modify ( iterator  position,
Modifier  modifier 
)
inline

Definition at line 86 of file mru_list.hpp.

87 {
88 return il.modify(position, modifier);
89 }

References pwiz::util::mru_list< Item, KeyExtractor >::il.

◆ empty()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
bool pwiz::util::mru_list< Item, KeyExtractor >::empty ( ) const
inline

◆ size()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
std::size_t pwiz::util::mru_list< Item, KeyExtractor >::size ( ) const
inline

◆ max_size()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
std::size_t pwiz::util::mru_list< Item, KeyExtractor >::max_size ( ) const
inline

◆ clear()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
void pwiz::util::mru_list< Item, KeyExtractor >::clear ( )
inline

◆ mru()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const item_type & pwiz::util::mru_list< Item, KeyExtractor >::mru ( ) const
inline

◆ lru()

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const item_type & pwiz::util::mru_list< Item, KeyExtractor >::lru ( ) const
inline

◆ begin() [1/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
iterator pwiz::util::mru_list< Item, KeyExtractor >::begin ( )
inline

Definition at line 99 of file mru_list.hpp.

99{return il.begin();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

Referenced by std::operator<<(), std::operator<<(), and test().

◆ end() [1/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
iterator pwiz::util::mru_list< Item, KeyExtractor >::end ( )
inline

Definition at line 100 of file mru_list.hpp.

100{return il.end();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

Referenced by std::operator<<(), and std::operator<<().

◆ rbegin() [1/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::rbegin ( )
inline

Definition at line 102 of file mru_list.hpp.

102{return il.rbegin();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

Referenced by test().

◆ rend() [1/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::rend ( )
inline

Definition at line 103 of file mru_list.hpp.

103{return il.rend();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

◆ begin() [2/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const_iterator pwiz::util::mru_list< Item, KeyExtractor >::begin ( ) const
inline

Definition at line 105 of file mru_list.hpp.

105{return il.begin();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

◆ end() [2/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const_iterator pwiz::util::mru_list< Item, KeyExtractor >::end ( ) const
inline

Definition at line 106 of file mru_list.hpp.

106{return il.end();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

◆ rbegin() [2/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const_reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::rbegin ( ) const
inline

Definition at line 108 of file mru_list.hpp.

108{return il.rbegin();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

◆ rend() [2/2]

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
const_reverse_iterator pwiz::util::mru_list< Item, KeyExtractor >::rend ( ) const
inline

Definition at line 109 of file mru_list.hpp.

109{return il.rend();}

References pwiz::util::mru_list< Item, KeyExtractor >::il.

Member Data Documentation

◆ il

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
item_list pwiz::util::mru_list< Item, KeyExtractor >::il
private

◆ max_num_items

template<typename Item , typename KeyExtractor = boost::multi_index::identity<Item>>
std::size_t pwiz::util::mru_list< Item, KeyExtractor >::max_num_items
private

The documentation for this class was generated from the following file: