Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
vcg::Cache< Token > Class Template Reference

#include <cache.h>

Inheritance diagram for vcg::Cache< Token >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void abort ()
 Cache (uint64_t _capacity=INT_MAX)
uint64_t capacity ()
void flush ()
template<class FUNCTOR >
void flush (FUNCTOR functor)
bool newData ()
 return true if the cache is waiting for priority to change
void setCapacity (uint64_t c)
void setInputCache (Provider< Token > *p)
uint64_t size ()
virtual ~Cache ()

Public Attributes

void(* callback )(void *data)
 callback for new_data
bool final
 true if this is the last cache (the one we use the data from)
Provider< Token > * input
 data is fetched from here
mt::atomicInt new_data
 keeps track of changes (if 1 then something was loaded or dropped
bool quit
std::vector< Transfer< Token > * > transfers
 threads running over cache...

Protected Member Functions

virtual void begin ()
 make sure the get function do not access token after abort is returned.
virtual int drop (Token *token)=0
 return amount removed
virtual void end ()
 called in as last thing in run()
virtual int get (Token *token)=0
 returns amount of space used in cache -1 for failed transfer
bool load ()
 should be protected
virtual void middle ()
void run ()
 [should be protected]
virtual int size (Token *token)=0
 return the space used in the cache by the loaded resource
bool unload ()

Protected Attributes

uint64_t s_curr
 current space used
uint64_t s_max
 max space available

Detailed Description

template<typename Token>
class vcg::Cache< Token >

Definition at line 44 of file cache.h.


Constructor & Destructor Documentation

template<typename Token>
vcg::Cache< Token >::Cache ( uint64_t  _capacity = INT_MAX) [inline]

Definition at line 69 of file cache.h.

template<typename Token>
virtual vcg::Cache< Token >::~Cache ( ) [inline, virtual]

Definition at line 71 of file cache.h.


Member Function Documentation

template<typename Token>
virtual void vcg::Cache< Token >::abort ( ) [inline, virtual]

Definition at line 135 of file cache.h.

template<typename Token>
virtual void vcg::Cache< Token >::begin ( ) [inline, protected, virtual]

make sure the get function do not access token after abort is returned.

called in as first thing in run()

Definition at line 150 of file cache.h.

template<typename Token>
uint64_t vcg::Cache< Token >::capacity ( ) [inline]

Definition at line 74 of file cache.h.

template<typename Token>
virtual int vcg::Cache< Token >::drop ( Token token) [protected, pure virtual]

return amount removed

template<typename Token>
virtual void vcg::Cache< Token >::end ( ) [inline, protected, virtual]

called in as last thing in run()

Definition at line 153 of file cache.h.

template<typename Token>
void vcg::Cache< Token >::flush ( ) [inline]

empty the cache. Make sure no resource is locked before calling this. Require pause or stop before. Ensure there no locked item

Definition at line 86 of file cache.h.

template<typename Token>
template<class FUNCTOR >
void vcg::Cache< Token >::flush ( FUNCTOR  functor) [inline]

empty the cache. Make sure no resource is locked before calling this. Require pause or stop before. Ensure there no locked item

Reimplemented from vcg::Provider< Token >.

Definition at line 108 of file cache.h.

template<typename Token>
virtual int vcg::Cache< Token >::get ( Token token) [protected, pure virtual]

returns amount of space used in cache -1 for failed transfer

template<typename Token>
bool vcg::Cache< Token >::load ( ) [inline, protected]

should be protected

Definition at line 237 of file cache.h.

template<typename Token>
virtual void vcg::Cache< Token >::middle ( ) [inline, protected, virtual]

Definition at line 151 of file cache.h.

template<typename Token>
bool vcg::Cache< Token >::newData ( ) [inline]

return true if the cache is waiting for priority to change

Definition at line 79 of file cache.h.

template<typename Token>
void vcg::Cache< Token >::run ( void  ) [inline, protected, virtual]

[should be protected]

Reimplemented from mt::thread.

Definition at line 156 of file cache.h.

template<typename Token>
void vcg::Cache< Token >::setCapacity ( uint64_t  c) [inline]

Definition at line 76 of file cache.h.

template<typename Token>
void vcg::Cache< Token >::setInputCache ( Provider< Token > *  p) [inline]

Definition at line 73 of file cache.h.

template<typename Token>
uint64_t vcg::Cache< Token >::size ( ) [inline]

Definition at line 75 of file cache.h.

template<typename Token>
virtual int vcg::Cache< Token >::size ( Token token) [protected, pure virtual]

return the space used in the cache by the loaded resource

template<typename Token>
bool vcg::Cache< Token >::unload ( ) [inline, protected]

Checks wether we need to make room in the cache because of: size() - sizeof(lowest priority item) > capacity()

Definition at line 185 of file cache.h.


Member Data Documentation

template<typename Token>
void(* vcg::Cache< Token >::callback)(void *data)

callback for new_data

Definition at line 54 of file cache.h.

template<typename Token>
bool vcg::Cache< Token >::final

true if this is the last cache (the one we use the data from)

Definition at line 48 of file cache.h.

template<typename Token>
Provider<Token>* vcg::Cache< Token >::input

data is fetched from here

Definition at line 57 of file cache.h.

template<typename Token>
mt::atomicInt vcg::Cache< Token >::new_data

keeps track of changes (if 1 then something was loaded or dropped

Definition at line 52 of file cache.h.

template<typename Token>
bool vcg::Cache< Token >::quit

Definition at line 50 of file cache.h.

template<typename Token>
uint64_t vcg::Cache< Token >::s_curr [protected]

current space used

Definition at line 66 of file cache.h.

template<typename Token>
uint64_t vcg::Cache< Token >::s_max [protected]

max space available

Definition at line 64 of file cache.h.

template<typename Token>
std::vector<Transfer<Token> *> vcg::Cache< Token >::transfers

threads running over cache...

Definition at line 60 of file cache.h.


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


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:41:10