#include <CacheEngine.hpp>
The deletion is done by a pointer to a function that accept void* reference. You can use any of the predefined static member function for this pointer. Defaut is deletion with "delete[] (char*)ptr" like function
Public Types | |
typedef void(*) | DeleteDataFnc (void *) |
The deletion function pointer signature. | |
enum | DocumentType { Unknown = 0x00000000, XML = 0x00000001, HTML = 0x00000002, JPEGImage = 0x00000003, PNGImage = 0x00000004, GIFImage = 0x00000005, Stylesheet = 0x00000006, ScriptFile = 0x00000007 } |
The possible documents type. More... | |
enum | Status { Unset = 0, WaitingFetching = 1, Ready = 2, FetchingError = -1, BadURI = -2 } |
The possible item status. More... | |
Public Member Functions | |
void | deleteData () volatile |
Delete the item data (you should never call this, unless the data is updated). | |
void | deleteData () |
Delete the item data (you should never call this, unless the data is updated). | |
bool | fetchingError () constvolatile |
Is this item on error ? | |
bool | fetchingError () const |
Does the fetching of this item gave error ? | |
const void * | getData () volatileconst |
Get the data. | |
const void * | getData () const |
Get the data. | |
const uint32 | getDataSize () volatileconst |
Get the data size. | |
const uint32 | getDataSize () const |
Get the data size. | |
const DocumentType | getDocumentType () constvolatile |
Get the data type. | |
const DocumentType | getDocumentType () const |
Get the data type. | |
const Strings::FastString & | getDocumentURL () constvolatile |
Get the document URL. | |
const Strings::FastString & | getDocumentURL () const |
Get the document URL. | |
const Status | getStatus () constvolatile |
Get the current status. | |
const Status | getStatus () const |
Get the current status. | |
const CacheTime | getTimestamp () constvolatile |
Get the document timestamp. | |
const CacheTime | getTimestamp () const |
Get the document timestamp. | |
Item (const Strings::FastString &_URL, const DocumentType &_type=Unknown, void *_data=0, const uint32 _size=0, const DeleteDataFnc _deleter=&PODBlockDeleter) | |
Build an item to store in the cache's Holder. | |
void | setData (const DocumentType _type, void *_data, const uint32 _size, const DeleteDataFnc _deleter=&PODBlockDeleter) volatile |
Set the data, type, and deleter for this item. | |
void | setData (const DocumentType _type, void *_data, const uint32 _size, const DeleteDataFnc _deleter=&PODBlockDeleter) |
Set the data, size, type, and deleter for this item. | |
void | setStatus (const Status _status) volatile |
Set the current status for this item. | |
void | setStatus (const Status _status) |
Set the current status for this item. | |
void | Suicide () volatile |
Make this item commit suicide (the item is deleted). | |
void | Suicide () |
Make this item commit suicide (the item is deleted). | |
~Item () | |
The only destructor. | |
Static Public Member Functions | |
template<typename T> | |
static void | ArrayDeleteDeleter (T *ptr) |
Delete the data with delete[] operator. | |
template<typename T> | |
static void | DeleteDeleter (T *ptr) |
Delete the data with delete operator. | |
static void | FreeDeleter (void *ptr) |
Delete the data with free function. | |
static void | NoDeleter (void *ptr) |
No deletion. | |
static CacheTime | Now () |
What time is it now ? | |
static void | PODBlockDeleter (void *ptr) |
Convenience function that delete the allocated block of POD type. | |
Public Attributes | |
volatile Lock | lock |
The lock when used in threaded environment. |
typedef void(*) Cache::Item::DeleteDataFnc(void *) |
The deletion function pointer signature.
The possible documents type.
Unknown | The document type is unknown. |
XML | The document is an XML stream. |
HTML | The document is an HTML stream. |
JPEGImage | The document is an image compressed using JPEG codec. |
PNGImage | The document is an image compressed using PNG codec. |
GIFImage | The document is an image compressed using GIF codec. |
Stylesheet | The document is an external stylesheet stream. |
ScriptFile | The document is an external script stream. |
enum Cache::Item::Status |
Cache::Item::Item | ( | const Strings::FastString & | _URL, | |
const DocumentType & | _type = Unknown , |
|||
void * | _data = 0 , |
|||
const uint32 | _size = 0 , |
|||
const DeleteDataFnc | _deleter = &PODBlockDeleter | |||
) | [inline] |
Build an item to store in the cache's Holder.
_URL | The item universal resource location | |
_type | The document type (can be Unknown if assigned later on) | |
_data | The document data (can be 0 if assigned later on) | |
_deleter | The deleter function pointer (default is PODBlockDeleter) |
Cache::Item::~Item | ( | ) | [inline] |
The only destructor.
For performance reason, this destructor is not virtual, so you can't inherit from this class
static void Cache::Item::ArrayDeleteDeleter | ( | T * | ptr | ) | [inline, static] |
Delete the data with delete[] operator.
ptr | A pointer to a T object, allocated with new[] |
void Cache::Item::deleteData | ( | ) | volatile [inline] |
Delete the item data (you should never call this, unless the data is updated).
void Cache::Item::deleteData | ( | ) | [inline] |
Delete the item data (you should never call this, unless the data is updated).
static void Cache::Item::DeleteDeleter | ( | T * | ptr | ) | [inline, static] |
Delete the data with delete operator.
ptr | A pointer to a T object, allocated with new |
bool Cache::Item::fetchingError | ( | ) | const volatile [inline] |
Is this item on error ?
bool Cache::Item::fetchingError | ( | ) | const [inline] |
Does the fetching of this item gave error ?
static void Cache::Item::FreeDeleter | ( | void * | ptr | ) | [inline, static] |
Delete the data with free function.
ptr | A pointer to a void *, allocated with malloc |
const void* Cache::Item::getData | ( | ) | const volatile [inline] |
Get the data.
const void* Cache::Item::getData | ( | ) | const [inline] |
Get the data.
const uint32 Cache::Item::getDataSize | ( | ) | const volatile [inline] |
Get the data size.
const uint32 Cache::Item::getDataSize | ( | ) | const [inline] |
Get the data size.
const DocumentType Cache::Item::getDocumentType | ( | ) | const volatile [inline] |
Get the data type.
const DocumentType Cache::Item::getDocumentType | ( | ) | const [inline] |
Get the data type.
const Strings::FastString& Cache::Item::getDocumentURL | ( | ) | const volatile [inline] |
Get the document URL.
const Strings::FastString& Cache::Item::getDocumentURL | ( | ) | const [inline] |
Get the document URL.
const Status Cache::Item::getStatus | ( | ) | const volatile [inline] |
Get the current status.
const Status Cache::Item::getStatus | ( | ) | const [inline] |
Get the current status.
const CacheTime Cache::Item::getTimestamp | ( | ) | const volatile [inline] |
Get the document timestamp.
const CacheTime Cache::Item::getTimestamp | ( | ) | const [inline] |
Get the document timestamp.
static void Cache::Item::NoDeleter | ( | void * | ptr | ) | [inline, static] |
No deletion.
static CacheTime Cache::Item::Now | ( | ) | [inline, static] |
What time is it now ?
static void Cache::Item::PODBlockDeleter | ( | void * | ptr | ) | [inline, static] |
Convenience function that delete the allocated block of POD type.
void Cache::Item::setData | ( | const DocumentType | _type, | |
void * | _data, | |||
const uint32 | _size, | |||
const DeleteDataFnc | _deleter = &PODBlockDeleter | |||
) | volatile [inline] |
Set the data, type, and deleter for this item.
void Cache::Item::setData | ( | const DocumentType | _type, | |
void * | _data, | |||
const uint32 | _size, | |||
const DeleteDataFnc | _deleter = &PODBlockDeleter | |||
) | [inline] |
Set the data, size, type, and deleter for this item.
void Cache::Item::setStatus | ( | const Status | _status | ) | volatile [inline] |
Set the current status for this item.
void Cache::Item::setStatus | ( | const Status | _status | ) | [inline] |
Set the current status for this item.
void Cache::Item::Suicide | ( | ) | volatile [inline] |
Make this item commit suicide (the item is deleted).
void Cache::Item::Suicide | ( | ) | [inline] |
Make this item commit suicide (the item is deleted).
volatile Lock Cache::Item::lock |
The lock when used in threaded environment.