In file gfx/libutil/ObjectStorer.hxx:

template<class T> class Util::ObjectStorer_LazyDelete

A template for storing (owning pointers to) objects by integer ids.

Documentation

A template for storing (owning pointers to) objects by integer ids. Objects may also be marked for removal: the ones marked for removal are really deleted when a new one is being allocated. This is used to ensure that java's potentially multi-threaded garbage collection does not (through calling the finalize() method which will call C++ to remove the reflected object) delete C++ objects that would touch OpenGL state at the same time. OpenGL has the global context, and that forces us to jump through some hoops. XXX Not any more: now ensurance of thread at higher level.

Inheritance:

ObjectStorer_LazyDelete


Public Methods

[more]int add (T* p)
Add a new object, get back its assigned id.
[more]void remove (int p)
Mark the object with the given id for removal
[more]T* get (int p)
Get the pointer corresponding to the given id
[more]T* operator[] (int p)
Alias to get()

oint add(T* p)
Add a new object, get back its assigned id. Side effect: all object marked for removal since the last add() are really deleted. The ObjectStorer takes ownership of the pointer and will eventually delete() it.

ovoid remove(int p)
Mark the object with the given id for removal

oT* get(int p)
Get the pointer corresponding to the given id

oT* operator[](int p)
Alias to get()


This class has no child classes.

Alphabetic index Hierarchy of classes



This page was generated with the help of DOC++.