#include <object_cache.h>
template<typename T>
class tesseract::ObjectCache< T >
Definition at line 35 of file object_cache.h.
◆ ObjectCache()
◆ ~ObjectCache()
Definition at line 38 of file object_cache.h.
40 for (
int i = 0; i < cache_.
size(); i++) {
41 if (cache_[i].
count > 0) {
42 tprintf(
"ObjectCache(%p)::~ObjectCache(): WARNING! LEAK! object %p "
43 "still has count %d (id %s)\n",
44 this, cache_[i].
object, cache_[i].
count,
45 cache_[i].
id.
string());
47 delete cache_[i].object;
48 cache_[i].object =
nullptr;
◆ DeleteUnusedObjects()
Definition at line 100 of file object_cache.h.
102 for (
int i = cache_.
size() - 1; i >= 0; i--) {
103 if (cache_[i].
count <= 0) {
104 delete cache_[i].object;
◆ Free()
Definition at line 86 of file object_cache.h.
87 if (t ==
nullptr)
return false;
89 for (
int i = 0; i < cache_.
size(); i++) {
90 if (cache_[i].
object == t) {
◆ Get()
Definition at line 60 of file object_cache.h.
64 for (
int i = 0; i < cache_.
size(); i++) {
65 if (
id == cache_[i].
id) {
66 retval = cache_[i].object;
67 if (cache_[i].
object !=
nullptr) {
76 ReferenceCount &rc = cache_.
back();
78 retval = rc.object = loader->
Run();
79 rc.count = (retval !=
nullptr) ? 1 : 0;
The documentation for this class was generated from the following file: