summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/throwing.h
blob: 05a056d5e9b52c3b4c5fe7ea061a012cb1fb5b75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef AUDIOGRAPHER_THROWING_H
#define AUDIOGRAPHER_THROWING_H

#ifndef DEFAULT_THROW_LEVEL
#define DEFAULT_THROW_LEVEL ThrowStrict
#endif

namespace AudioGrapher
{

enum ThrowLevel
{
	ThrowNone,     //< Not allowed to throw
	ThrowObject,   //< Object level stuff, ctors, initalizers etc.
	ThrowProcess,  //< Process cycle level stuff
	ThrowStrict,   //< Stricter checks than ThrowProcess, less than ThrowSample
	ThrowSample    //< Sample level stuff
};

/// Class that allows optimizing out error checking during compile time
template<ThrowLevel L = DEFAULT_THROW_LEVEL>
class Throwing
{
  protected:
	Throwing() {}
	bool throw_level (ThrowLevel level) { return L >= level; }
};


} // namespace

#endif // AUDIOGRAPHER_THROWING_H