#include <object_cache.h>
template<typename T>
class tesseract::ObjectCache< T >
Definition at line 36 of file object_cache.h.
◆ ObjectCache()
◆ ~ObjectCache()
Definition at line 39 of file object_cache.h.
40 std::lock_guard<std::mutex> guard(mu_);
41 for (
auto &it : cache_) {
44 "ObjectCache(%p)::~ObjectCache(): WARNING! LEAK! object %p "
45 "still has count %d (id %s)\n",
46 this, it.object, it.count, it.id.c_str());
void tprintf(const char *format,...)
◆ DeleteUnusedObjects()
Definition at line 96 of file object_cache.h.
97 std::lock_guard<std::mutex> guard(mu_);
98 for (
auto it = cache_.rbegin(); it != cache_.rend(); ++it) {
101 cache_.erase(std::next(it).base());
◆ Free()
Definition at line 82 of file object_cache.h.
86 std::lock_guard<std::mutex> guard(mu_);
87 for (
auto &it : cache_) {
◆ Get()
Definition at line 60 of file object_cache.h.
62 std::lock_guard<std::mutex> guard(mu_);
63 for (
auto &it : cache_) {
66 if (it.object !=
nullptr) {
72 cache_.push_back(ReferenceCount());
73 ReferenceCount &rc = cache_.back();
75 retval = rc.object = loader();
76 rc.count = (retval !=
nullptr) ? 1 : 0;
The documentation for this class was generated from the following file: