raze/source/build/include/tracker.hpp
hendricks266 1cc9d13ccf The great repository rearrangement of 2017.
Files moved but not modified. Changes to follow in a subsequent commit.

You down with CPP?

git-svn-id: https://svn.eduke32.com/eduke32@6055 1a8010ca-5511-0410-912e-c29ae57300e0
2017-02-01 10:01:11 +00:00

92 lines
2.2 KiB
C++

template<typename TrackedType>
class TRACKER_NAME_
{
public:
TrackedType TrackedValue;
inline TrackedType* operator & ()
{
TRACKER_GLOBAL_HOOK_((uintptr_t)&this->TrackedValue);
return &this->TrackedValue;
}
inline TrackedType operator ++ ()
{
TRACKER_GLOBAL_HOOK_((uintptr_t)&this->TrackedValue);
return ++this->TrackedValue;
}
inline TrackedType operator ++ (int)
{
TRACKER_GLOBAL_HOOK_((uintptr_t)&this->TrackedValue);
return this->TrackedValue++;
}
inline TrackedType operator -- ()
{
TRACKER_GLOBAL_HOOK_((uintptr_t)&this->TrackedValue);
return --this->TrackedValue;
}
inline TrackedType operator -- (int)
{
TRACKER_GLOBAL_HOOK_((uintptr_t)&this->TrackedValue);
return this->TrackedValue--;
}
inline TrackedType operator = (TrackedType);
inline TrackedType operator += (TrackedType);
inline TrackedType operator -= (TrackedType);
inline TrackedType operator *= (TrackedType);
inline TrackedType operator /= (TrackedType);
inline TrackedType operator |= (TrackedType);
inline TrackedType operator &= (TrackedType);
inline TrackedType operator ^= (TrackedType);
inline TrackedType operator <<= (TrackedType);
inline TrackedType operator >>= (TrackedType);
inline operator TrackedType() const;
inline TrackedType cast() const;
};
#ifndef tracker_hpp_
#define tracker_hpp_
enum {
TRACKER_NOOP_RIGHTHAND_EQUAL_ = 0,
TRACKER_NOOP_RIGHTHAND_ZERO_,
TRACKER_NOOP_RIGHTHAND_ONE_,
__TRACKER_NEVER,
};
#endif
#define __TRACKER_RIGHTHAND_TYPE TrackedType rightHand
#define __TRACKER_RIGHTHAND rightHand
#include "tracker_operators.hpp"
#undef __TRACKER_RIGHTHAND_TYPE
#undef __TRACKER_RIGHTHAND
template<typename TrackedType>
inline TRACKER_NAME_<TrackedType>::operator TrackedType() const
{
return this->TrackedValue;
}
template<typename TrackedType>
inline TrackedType TRACKER_NAME_<TrackedType>::cast() const
{
return this->TrackedValue;
}