1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-04 21:34:41 +00:00

Revert "added partial VFS support - enough to read static data from any source"

This reverts commit fa3e9e7329.
This commit is contained in:
fgenesis 2011-09-15 19:18:53 +02:00
commit 56c6833220
56 changed files with 608 additions and 4023 deletions

View file

@ -1,44 +0,0 @@
#ifndef SELFREFCOUNTER_H
#define SELFREFCOUNTER_H
#include "VFSDefines.h"
#include "VFSAtomic.h"
VFS_NAMESPACE_START
// self must point to the object that holds the counter.
template <class T, bool DELSELF = true> class SelfRefCounter
{
private:
T *self;
volatile int c;
SelfRefCounter(SelfRefCounter& r); // forbid copy constructor
inline unsigned int _deref(void)
{
unsigned int cc = (unsigned int)Atomic_Decr(c); // copy c, in case we get deleted
if(DELSELF && !cc)
{
delete self;
}
return cc;
}
public:
SelfRefCounter(T *p): self(p), c(1) {}
~SelfRefCounter() { /* DEBUG(ASSERT(c <= 1)); */ } // its ok if the last reference calls delete instead of _deref()
inline unsigned int count(void) { return c; }
// post-increment (dummy int)
inline unsigned int operator++(int) { unsigned int cc = c; Atomic_Incr(c); return cc; }
inline unsigned int operator--(int) { unsigned int cc = c; _deref(); return cc; }
// pre-increment
inline unsigned int operator++(void) { return (unsigned int)Atomic_Incr(c); }
inline unsigned int operator--(void) { return _deref(); }
};
VFS_NAMESPACE_END
#endif