#include <OTC/debug/tobject.hh> class OTC_TObject {
public:
virtual ~OTC_TObject();
static void terminateAll();
protected:
OTC_TObject();
virtual void cleanup() = 0;
};
cleanup()
function, to initiate any actions which your class
needs to perform. This function will be called when terminate()
is invoked, provided that you have registered a terminate function
which invokes the function OTC_TObject::terminateAll()
.
Note that your cleanup()
function should do as little as
possible. If your function results in OTCLIB_TERMINATE()
being
called, then this will result in abort()
being called.
It is not known what a real exception implementation will do in
this situation yet, thus no special checks are made in
terminate()
for looping; they are only done in
OTCLIB_TERMINATE()
.
The requirement for this class will largely vanish when real
exceptions are available, as most objects will be destroyed
automatically as a result of the stack being unwound, when an
exception occurs. This class could still be useful though to
ensure that destructors of objects on the free store, referenced
through pointers at global scope, are destroyed.
virtual ~OTC_TObject();
OTC_TObject
classes.
static void terminateAll();
OTC_TObject
class and invokes
cleanup()
on each one.
OTC_TObject();
OTC_TObject
classes.
virtual void cleanup() = 0;