#include <object_cache.h>
List of all members.
Detailed Description
template<typename T>
class tesseract::ObjectCache< T >
Definition at line 35 of file object_cache.h.
Constructor & Destructor Documentation
Definition at line 38 of file object_cache.h.
{
mu_.Lock();
for (int i = 0; i < cache_.size(); i++) {
if (cache_[i].count > 0) {
tprintf("ObjectCache(%p)::~ObjectCache(): WARNING! LEAK! object %p "
"still has count %d (id %s)\n",
this, cache_[i].object, cache_[i].count,
cache_[i].id.string());
} else {
delete cache_[i].object;
cache_[i].object = NULL;
}
}
mu_.Unlock();
}
Member Function Documentation
Definition at line 86 of file object_cache.h.
{
if (t == NULL) return false;
mu_.Lock();
for (int i = 0; i < cache_.size(); i++) {
if (cache_[i].object == t) {
--cache_[i].count;
mu_.Unlock();
return true;
}
}
mu_.Unlock();
return false;
}
Definition at line 60 of file object_cache.h.
{
T *retval = NULL;
mu_.Lock();
for (int i = 0; i < cache_.size(); i++) {
if (id == cache_[i].id) {
retval = cache_[i].object;
if (cache_[i].object != NULL) {
cache_[i].count++;
}
mu_.Unlock();
delete loader;
return retval;
}
}
cache_.push_back(ReferenceCount());
ReferenceCount &rc = cache_.back();
rc.id = id;
retval = rc.object = loader->Run();
rc.count = (retval != NULL) ? 1 : 0;
mu_.Unlock();
return retval;
}
The documentation for this class was generated from the following file:
- /usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccutil/object_cache.h