Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 84d18a76d0
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (38 sloc) 0.747 kb
#ifndef TORA_PRIM_H_
#define TORA_PRIM_H_
#include <cassert>
#include <stdio.h>
#define PRIM_DECL(klass) \
public: \
int refcnt; \
void release() { \
--refcnt; \
if (refcnt == 0) { \
delete this; \
} \
} \
void retain() { \
assert(refcnt >= 0); \
++refcnt; \
}
class Prim {
protected:
Prim(): refcnt(0) { }
int refcnt;
Prim(const Prim&) = delete;
Prim& operator=(const Prim&) = delete;
public:
virtual ~Prim() { }
void release() {
// assert(refcnt > 0);
--refcnt;
if (refcnt == 0) {
delete this;
}
}
void retain() {
assert(refcnt >= 0);
++refcnt;
}
};
#endif // TORA_PRIM_H_
Jump to Line
Something went wrong with that request. Please try again.