e9af708c3b
- sort goes to math funcs - math funcs specializations for vector types go to vector files - use ZN macros in a few more places
32 lines
515 B
C++
32 lines
515 B
C++
#ifndef VOXEL_VIEWER_REF_COUNT_H
|
|
#define VOXEL_VIEWER_REF_COUNT_H
|
|
|
|
#include "errors.h"
|
|
|
|
namespace zylann {
|
|
|
|
// Simple reference counter.
|
|
// This one is not thread-safe.
|
|
class RefCount {
|
|
public:
|
|
inline void add() {
|
|
++_count;
|
|
}
|
|
|
|
inline void remove() {
|
|
ZN_ASSERT_RETURN_MSG(_count != 0, "Trying to decrease refcount when it's already zero");
|
|
--_count;
|
|
}
|
|
|
|
inline unsigned int get() const {
|
|
return _count;
|
|
}
|
|
|
|
private:
|
|
unsigned int _count = 0;
|
|
};
|
|
|
|
} // namespace zylann
|
|
|
|
#endif // VOXEL_VIEWER_REF_COUNT_H
|