Ardour  8.7-15-gadf511264b
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 #include <boost/format.hpp>
11 
12 namespace AudioGrapher
13 {
14 
16 template<DebugLevel L = DEFAULT_DEBUG_LEVEL>
18 {
19  public:
21 
22  protected:
23 
26  {
27  flags.set (flag);
28  }
29 
31  template<typename SelfType, typename ContextType>
32  void check_flags (SelfType & self, ProcessContext<ContextType> context)
33  {
34  if (!Debuggable<L>::debug_level (DebugFlags)) { return; }
35  FlagField unsupported = flags.unsupported_flags_of (context.flags());
36 
37  for (FlagField::iterator it = unsupported.begin(); it != unsupported.end(); ++it) {
38  Debuggable<L>::debug_stream() << boost::str (boost::format
39  ("%1% does not support flag %2%")
41  ) << std::endl;
42  }
43  }
44 
45  private:
47 };
48 
49 
50 } // namespace
51 
52 #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