Debian Codegraph @

include/icounter.h

raw
1 #pragma once
2
3 #include <cstddef>
4 #include "imodule.h"
5
6 class ICounter
7 {
8 public:
9 /** Destructor */
10 virtual ~ICounter() {}
11
12 /** greebo: Decrements/increments the counter.
13 */
14 virtual void increment() = 0;
15 virtual void decrement() = 0;
16
17 /** greebo: Returns the current count.
18 */
19 virtual std::size_t get() const = 0;
20 };
21
22 // Known counters
23 enum CounterType
24 {
25 counterBrushes,
26 counterPatches,
27 counterEntities,
28 };
29
30 const char* const MODULE_COUNTER("Counters");
31
32 /** greebo: This abstract class defines the interface to the core application.
33 * Use this to access methods from the main codebase in radiant/
34 */
35 class ICounterManager :
36 public RegisterableModule
37 {
38 public:
39 // Returns the Counter object of the given type
40 virtual ICounter& getCounter(CounterType counter) = 0;
41
42 virtual sigc::signal<void>& signal_countersChanged() = 0;
43 };
44
45 inline ICounterManager& GlobalCounters()
46 {
47 static module::InstanceReference<ICounterManager> _reference(MODULE_COUNTER);
48 return _reference;
49 }