CFEL - ASG Software Suite
2.5.0
CASS
|
a list of results for caching More...
#include <cached_list.hpp>
Classes | |
struct | item_info |
bundeling the lock status and the id More... | |
Public Types | |
typedef Result< float > | item_type |
define the type of which the list is for More... | |
typedef std::tr1::shared_ptr< item_type > | item_sp |
define a shared pointer of the item More... | |
typedef CASSEvent::id_t | id_type |
define the type of the id used More... | |
typedef std::pair< item_info, item_sp > | entry_type |
define an entry in the list More... | |
typedef std::vector< entry_type > | list_type |
define the container of items with their ids More... | |
typedef list_type::iterator | iter_type |
define an iterator for the list More... | |
Public Member Functions | |
const item_type & | item (const id_type &id) |
retrieve an item with the right id More... | |
const item_type & | latest () const |
retrieve the latest item More... | |
item_type & | latest () |
retrieve the latest item More... | |
void | latest (const iter_type it) |
set which one is the latest item More... | |
void | release (const id_type &id) |
unlock the item with id More... | |
iter_type | newItem (const id_type &id) |
get an item for processing More... | |
void | setup (item_sp item, size_t size) |
create the list of items More... | |
void | clearItems () |
clear the items in the list More... | |
Private Member Functions | |
iter_type | findId (const id_type &id) |
get an iterator to the item for id More... | |
Private Attributes | |
list_type | _list |
the list More... | |
QMutex | _mutex |
mutex for locking the internal list More... | |
iter_type | _latest |
iterator to the latest entry More... | |
iter_type | _current |
iterator the currently used entry More... | |
a list of results for caching
Definition at line 34 of file cached_list.hpp.
typedef std::pair<item_info,item_sp> cass::CachedList::entry_type |
define an entry in the list
Definition at line 50 of file cached_list.hpp.
define the type of the id used
Definition at line 44 of file cached_list.hpp.
typedef std::tr1::shared_ptr<item_type> cass::CachedList::item_sp |
define a shared pointer of the item
Definition at line 41 of file cached_list.hpp.
typedef Result<float> cass::CachedList::item_type |
define the type of which the list is for
Definition at line 38 of file cached_list.hpp.
typedef list_type::iterator cass::CachedList::iter_type |
define an iterator for the list
Definition at line 56 of file cached_list.hpp.
typedef std::vector<entry_type> cass::CachedList::list_type |
define the container of items with their ids
Definition at line 53 of file cached_list.hpp.
|
inline |
clear the items in the list
lock and go through all items, lock them and clear them. After they have been cleard unlock them again.
Definition at line 161 of file cached_list.hpp.
Referenced by cass::Processor::clearHistograms().
get an iterator to the item for id
id | the id for which the entry should be returned |
Definition at line 178 of file cached_list.hpp.
References _list, and cass::CachedList::item_info::id.
retrieve an item with the right id
id |
Definition at line 62 of file cached_list.hpp.
References _latest, _list, _mutex, and findId().
Referenced by cass::Processor::result().
|
inline |
retrieve the latest item
Definition at line 75 of file cached_list.hpp.
References _latest.
Referenced by cass::Processor::processEvent(), cass::pp14::processEvent(), and cass::Processor::result().
|
inline |
retrieve the latest item
Definition at line 84 of file cached_list.hpp.
References _latest.
|
inline |
set which one is the latest item
change the lock of the item from write lock to read lock
it | pointer to the item to be set as latest |
Definition at line 95 of file cached_list.hpp.
get an item for processing
find the next item in the list that has the eventid not set (e.g.: id is 0) Set the id to the event id and return the iterator pointing to the entry.
Clear the item before return it
id | the id that the item will have in the list |
Definition at line 123 of file cached_list.hpp.
References _current, _latest, _list, and _mutex.
Referenced by cass::Processor::processEvent(), and cass::pp14::processEvent().
|
inline |
unlock the item with id
make the entry available again by setting the id to 0
id | the id of the item to be released |
Definition at line 107 of file cached_list.hpp.
References _mutex, and findId().
Referenced by cass::Processor::releaseEvent().
|
inline |
create the list of items
item | the template of which copies will be placed in the container |
size | the number of items that should be in the container |
Definition at line 144 of file cached_list.hpp.
References _current, _latest, _list, _mutex, cass::CachedList::item_info::id, info, cass::CachedList::item_info::locked, and size.
Referenced by cass::Processor::createHistList().
|
private |
iterator the currently used entry
Definition at line 202 of file cached_list.hpp.
|
private |
|
private |
the list
Definition at line 193 of file cached_list.hpp.
Referenced by clearItems(), findId(), item(), newItem(), and setup().
|
private |
mutex for locking the internal list
Definition at line 196 of file cached_list.hpp.
Referenced by clearItems(), item(), latest(), newItem(), release(), and setup().