mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier1: create simple depth manager class
Will be used to manage depths of nested arrays
This commit is contained in:
parent
b2442164a7
commit
80fecfa228
31
r5dev/public/tier1/depthcounter.h
Normal file
31
r5dev/public/tier1/depthcounter.h
Normal file
@ -0,0 +1,31 @@
|
||||
//=============================================================================//
|
||||
//
|
||||
// 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
|
Loading…
x
Reference in New Issue
Block a user