Loading...
Searching...
No Matches
ASLog.h
Go to the documentation of this file.
#ifndef ASLOG_H
#define ASLOG_H
// This class is used by train_cost_model, which doesn't link to
// libHalide, so (despite the namespace) we are better off not
// including Halide.h, lest we reference something we won't have available
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <utility>
namespace Halide {
namespace Internal {
class aslog {
const bool logging;
public:
explicit aslog(int verbosity)
: logging(verbosity <= aslog_level()) {
}
template<typename T>
aslog &operator<<(T &&x) {
if (logging) {
std::cerr << std::forward<T>(x);
}
return *this;
}
std::ostream &get_ostream() {
// It is an error to call this for an aslog() instance that cannot log.
assert(logging);
return std::cerr;
}
static int aslog_level();
};
} // namespace Internal
} // namespace Halide
#endif
Halide::Internal::aslog::operator<<
aslog & operator<<(T &&x)
Definition ASLog.h:25
Halide::Internal::aslog::get_ostream
std::ostream & get_ostream()
Definition ASLog.h:32
Halide::Internal::aslog::aslog
aslog(int verbosity)
Definition ASLog.h:20
Halide::Internal::aslog::aslog_level
static int aslog_level()
Halide::Internal
Definition AbstractGenerator.h:24
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19