Field3D
|
#include <FieldCache.h>
Public Types | |
typedef std::map< std::string, CacheEntry > | Cache |
typedef std::pair< WeakPtr, Field_T * > | CacheEntry |
typedef Field< Data_T > | Field_T |
typedef Field_T::Ptr | FieldPtr |
typedef Field_T::WeakPtr | WeakPtr |
Public Member Functions | |
void | cacheField (FieldPtr field, const std::string &filename, const std::string &layerPath) |
Adds the given field to the cache. | |
FieldPtr | getCachedField (const std::string &filename, const std::string &layerPath) |
Checks the cache for a previously loaded field. | |
long long int | memSize () const |
Returns the memory use of all currently loaded fields. | |
Static Public Member Functions | |
static FieldCache & | singleton () |
Returns a reference to the FieldCache singleton. | |
Private Member Functions | |
std::string | key (const std::string &filename, const std::string &layerPath) |
Constructs the cache key for a given file and layer path. | |
Private Attributes | |
Cache | m_cache |
The cache itself. Maps a 'key' to a weak pointer and a raw pointer. | |
Static Private Attributes | |
static boost::mutex | ms_accessMutex |
Mutex to prevent reading from and writing to the cache concurrently. | |
static boost::mutex | ms_creationMutex |
Mutex to prevent multiple allocaation of the singleton. | |
static boost::scoped_ptr< FieldCache > | ms_singleton |
The singleton instance. | |
Definition at line 80 of file FieldCache.h.
Field<Data_T> FieldCache< Data_T >::Field_T |
Definition at line 86 of file FieldCache.h.
Field_T::Ptr FieldCache< Data_T >::FieldPtr |
Definition at line 87 of file FieldCache.h.
Field_T::WeakPtr FieldCache< Data_T >::WeakPtr |
Definition at line 88 of file FieldCache.h.
std::pair<WeakPtr, Field_T*> FieldCache< Data_T >::CacheEntry |
Definition at line 89 of file FieldCache.h.
std::map<std::string, CacheEntry> FieldCache< Data_T >::Cache |
Definition at line 90 of file FieldCache.h.
|
static |
Returns a reference to the FieldCache singleton.
Definition at line 135 of file FieldCache.h.
Referenced by Field3DInputFile::readLayer(), and Field3DInputFileHDF5::readLayer().
FieldCache< Data_T >::FieldPtr FieldCache< Data_T >::getCachedField | ( | const std::string & | filename, |
const std::string & | layerPath ) |
Checks the cache for a previously loaded field.
Definition at line 148 of file FieldCache.h.
Referenced by Field3DInputFile::readLayer(), and Field3DInputFileHDF5::readLayer().
void FieldCache< Data_T >::cacheField | ( | FieldPtr | field, |
const std::string & | filename, | ||
const std::string & | layerPath ) |
Adds the given field to the cache.
Definition at line 169 of file FieldCache.h.
Referenced by Field3DInputFile::readLayer(), and Field3DInputFileHDF5::readLayer().
long long int FieldCache< Data_T >::memSize | ( | ) | const |
Returns the memory use of all currently loaded fields.
Definition at line 180 of file FieldCache.h.
|
private |
Constructs the cache key for a given file and layer path.
Definition at line 203 of file FieldCache.h.
|
private |
The cache itself. Maps a 'key' to a weak pointer and a raw pointer.
Definition at line 121 of file FieldCache.h.
|
staticprivate |
The singleton instance.
Definition at line 123 of file FieldCache.h.
|
staticprivate |
Mutex to prevent multiple allocaation of the singleton.
Definition at line 125 of file FieldCache.h.
|
staticprivate |
Mutex to prevent reading from and writing to the cache concurrently.
Definition at line 127 of file FieldCache.h.