12 #ifndef RE_CachedObject_h
13 #define RE_CachedObject_h
43 myVersion[0] = cv.myVersion[0];
44 myVersion[1] = cv.myVersion[1];
45 myVersion[2] = cv.myVersion[2];
46 myVersion[3] = cv.myVersion[3];
51 myVersion[0] = cv.myVersion[0];
52 myVersion[1] = cv.myVersion[1];
53 myVersion[2] = cv.myVersion[2];
54 myVersion[3] = cv.myVersion[3];
59 return (myVersion[0] == cv.myVersion[0] &&
60 myVersion[1] == cv.myVersion[1] &&
61 myVersion[2] == cv.myVersion[2] &&
62 myVersion[3] == cv.myVersion[3]);
66 return (myVersion[0] != cv.myVersion[0] ||
67 myVersion[1] != cv.myVersion[1] ||
68 myVersion[2] != cv.myVersion[2] ||
69 myVersion[3] != cv.myVersion[3]);
126 os << myVersion[0] <<
"," << myVersion[1] <<
"," << myVersion[2] <<
","
136 os << v.myVersion[0] <<
"," << v.myVersion[1] <<
","
137 << v.myVersion[2] <<
"," << v.myVersion[3];
160 if (!myRefCount.add(-1))
176 virtual const char *
className()
const {
return "RE_CachedExtraData"; }
185 virtual int64 getMemoryUsage(
bool inclusive)
const = 0;
219 { myExtraData =
data; }
225 { myCacheTagHandle =
h; }
227 { myCacheTagHandle =
nullptr; }
232 if(!c && myExtraData)
233 myExtraData->cacheFree();
238 virtual int64 getMemoryUsage(
bool inclusive)
const;
259 void setInUse(
bool inc);
260 virtual bool inUse() {
return myUsage > 0; }
270 void setCached(
bool cached,
const char *mapname);
273 const char *
getName()
const {
return myName; }
277 bool setRemovalCallback(
bool (*relCB)(
void *,
void *),
280 bool clearRemovalCallback(
void *relObject);
299 const char *
className()
const override {
return "RE_BBoxData"; }
305 int64 mem = inclusive ?
sizeof(*this) : 0;
316 myUsage += inc ? 1 : -1;
319 std::cerr <<
"Bad object usage " << myUsage <<
" " <<
this <<
"\n";
320 else if(myUsage == 32767)
321 std::cerr <<
"Apparent overflow " << myUsage <<
" " <<
this <<
"\n";
bool operator==(const RE_CacheVersion &cv) const
GLenum GLuint GLenum GLsizei const GLchar * buf
bool operator!=(const RE_CacheVersion &cv) const
void setElementLow32(int i, int32 v)
GLenum GLuint GLsizei bufsize
std::ostream & operator<<(std::ostream &os) const
UT_IntrusivePtr< RE_CacheTag > RE_CacheTagHandle
unsigned long long uint64
RE_API size_t format(char *buf, size_t bufsize, const RE_CacheVersion &v)
RE_CacheVersion getVersion() const
int64 getElement(int i) const
void setExtraData(RE_CachedExtraData *data)
RE_CacheVersion & operator=(const RE_CacheVersion &cv)
#define UT_ASSERT_MSG(ZZ,...)
RE_CacheTagHandle myCacheTagHandle
void setElementHigh32(int i, int32 v)
int64 getMemoryUsage(bool inclusive) const override
void intrusive_ptr_release(T *x)
RE_BBoxData(const UT_BoundingBox &bbox)
RE_CacheVersion myVersion
RE_CacheVersion(const RE_CacheVersion &cv)
void setElement(int i, int64 v)
const char * className() const override
friend std::ostream & operator<<(std::ostream &os, const RE_CacheVersion &v)
I/O friends.
const RE_CachedExtraDataHandle & getExtraData() const
void setCacheTag(RE_CacheTagHandle h)
GLfloat GLfloat GLfloat GLfloat h
Cached object implementation for RE_TextureCache.
void setVersion(RE_CacheVersion v)
void intrusive_ptr_add_ref(T *x)
Basic cached object, with version and extra data only.
UT_IntrusivePtr< RE_CachedExtraData > RE_CachedExtraDataHandle
Simple class for a mutli-integer cache tag.
const char * getName() const
virtual int64 getMemoryUsage(bool inclusive) const
Returns the amount of main memory (not VRAM) owned by this object.
RE_CachedExtraDataHandle myExtraData
RE_CacheVersion & operator++()
This class is bumped whenever a cached item is evicted.