mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
32 lines
533 B
C++
32 lines
533 B
C++
//=============================================================================//
|
|
//
|
|
// Purpose: simple class that could be used to manage depths of nested elements
|
|
//
|
|
//=============================================================================//
|
|
#ifndef TIER1_DEPTHCOUNTER_H
|
|
#define TIER1_DEPTHCOUNTER_H
|
|
|
|
template<class T>
|
|
class CDepthCounter
|
|
{
|
|
public:
|
|
CDepthCounter(T& counter) : ref(counter)
|
|
{
|
|
ref++;
|
|
}
|
|
~CDepthCounter()
|
|
{
|
|
ref--;
|
|
}
|
|
|
|
T Get()
|
|
{
|
|
return ref;
|
|
}
|
|
|
|
private:
|
|
T& ref;
|
|
};
|
|
|
|
#endif // TIER1_DEPTHCOUNTER_H
|