Ardour  9.0-pre0-582-g084a23a80d
flag_debuggable.h
Go to the documentation of this file.
1 #ifndef AUDIOGRAPHER_FLAG_DEBUGGABLE_H
2 #define AUDIOGRAPHER_FLAG_DEBUGGABLE_H
3 
5 #include "debuggable.h"
6 #include "debug_utils.h"
7 #include "process_context.h"
8 #include "types.h"
9 
10 namespace AudioGrapher
11 {
12 
14 template<DebugLevel L = DEFAULT_DEBUG_LEVEL>
16 {
17  public:
19 
20  protected:
21 
24  {
25  flags.set (flag);
26  }
27 
29  template<typename SelfType, typename ContextType>
30  void check_flags (SelfType & self, ProcessContext<ContextType> context)
31  {
32  if (!Debuggable<L>::debug_level (DebugFlags)) { return; }
33  FlagField unsupported = flags.unsupported_flags_of (context.flags());
34 
35  for (FlagField::iterator it = unsupported.begin(); it != unsupported.end(); ++it) {
38  << " does not support flag "
40  << std::endl;
41  }
42  }
43 
44  private:
46 };
47 
48 
49 } // namespace
50 
51 #endif // AUDIOGRAPHER_FLAG_DEBUGGABLE_H
std::ostream & debug_stream()
Definition: debuggable.h:55
A debugging class for nodes that support a certain set of flags.
void check_flags(SelfType &self, ProcessContext< ContextType > context)
Prints debug output if context contains flags that are not supported by this class.
void add_supported_flag(Flag flag)
Adds a flag to the set of flags supported.
Bi-directional iterator for flag set. Iterates over flags that are set in this field.
Definition: flag_field.h:32
FlagField unsupported_flags_of(FlagField const &other) const
Returns the flags in other that are not set in this field.
Definition: flag_field.h:81
iterator end() const
Definition: flag_field.h:99
iterator begin() const
Definition: flag_field.h:92
FlagField const & flags() const
@ DebugFlags
Debug ProcessContext flags only on process cycle level.
Definition: debuggable.h:20
static std::string process_context_flag_name(FlagField::Flag flag)
Returns name of ProcessContext::Flag.
static std::string demangled_name(T const &obj)
Returns the demangled name of the object passed as the parameter.
Definition: debug_utils.h:24