InstanceSystem.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../Basics/LogId.hpp"
4 #include "../Basics/volatile_set.hpp"
5 #include "SystemContainer.hpp"
6 #include "../DebugView/TreeDebugView.hpp"
7 #include "../DebugView/TableDebugView.hpp"
8 #include <unordered_set>
9 
10 namespace iv
11 {
12 
13 class Instance;
14 class ClientMarker;
15 class DebugInstanceListener;
16 
17 class InstanceSystem : public System
18 {
19 public:
21 
24  virtual std::string debug_name() const override { return "InstanceSystem"; }
25  void status( TextDebugView * view ) override;
26  virtual bool flushSystem() override;
27 
28 //------------------------- logging ------------------------------------------
29  void ClientLog( ClientMarker const * cm, SrcInfo const & info, LogId id, std::string const & message );
30  bool ClientLogEnabled( ClientMarker const * cm, LogId id );
31 
32  void SystemLog( System const * system, SrcInfo const & info, LogId id, std::string const & message );
33  bool SystemLogEnabled( System const * system, LogId id );
34 
35 //------------------------- introspection ------------------------------------
38  void register_instance( Instance * );
39  void unregister_instance( Instance * );
40 
42 
45  void AddDebugListener( DebugInstanceListener * listener );
46  void RemoveDebugListener( DebugInstanceListener * listener );
47 
50  std::unordered_set< Instance * > const & Debug_Instances();
51 
52 private:
53  void DebugPrintInstance( TreeDebugView * tree, Instance * inst );
54 
55 private:
56  std::unordered_set< Instance * > _instances;
58  unsigned last_check_frame_id;
59 };
60 
61 }
62 
63 #include "SystemContainer.inl"