Halide
ASLog.h
Go to the documentation of this file.
1 #ifndef ASLOG_H
2 #define ASLOG_H
3 
4 // This class is used by train_cost_model, which doesn't link to
5 // libHalide, so (despite the namespace) we are better off not
6 // including Halide.h, lest we reference something we won't have available
7 
8 #include <cstdlib>
9 #include <iostream>
10 #include <utility>
11 
12 namespace Halide {
13 namespace Internal {
14 
15 class aslog {
16  const bool logging;
17 
18 public:
19  aslog(int verbosity)
20  : logging(verbosity <= aslog_level()) {
21  }
22 
23  template<typename T>
24  aslog &operator<<(T &&x) {
25  if (logging) {
26  std::cerr << std::forward<T>(x);
27  }
28  return *this;
29  }
30 
31  static int aslog_level();
32 };
33 
34 } // namespace Internal
35 } // namespace Halide
36 
37 #endif
Halide::Internal::aslog::operator<<
aslog & operator<<(T &&x)
Definition: ASLog.h:24
Halide::Internal::aslog
Definition: ASLog.h:15
Halide::Internal::aslog::aslog
aslog(int verbosity)
Definition: ASLog.h:19
Halide::Internal::aslog::aslog_level
static int aslog_level()
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition: AddAtomicMutex.h:21
Halide::LinkageType::Internal
@ Internal
Not visible externally, similar to 'static' linkage in C.