ABLATE Source Documentation  0.12.34
nullLog.hpp
1 #ifndef ABLATELIBRARY_NULLLOG_HPP
2 #define ABLATELIBRARY_NULLLOG_HPP
3 
4 #include <iostream>
5 #include <ostream>
6 #include <vector>
7 #include "log.hpp"
8 
9 namespace ablate::monitors::logs {
10 class NullLog : public Log {
11  private:
15  class NullBuffer : public std::streambuf {
16  protected:
17  int_type overflow(int_type c) override { return c; }
18  };
19 
20  inline static NullBuffer nullBuffer;
21 
22  public:
26  inline static std::ostream nullStream = std::ostream(&nullBuffer);
27 
28  public:
29  // allow access to all print from base
30  using Log::Print;
31  void Print(const char*) override {}
32  void Printf(const char*, ...) override {}
33  void Initialize(MPI_Comm comm) override {}
34 
39  std::ostream& GetStream() override { return nullStream; }
40 };
41 } // namespace ablate::monitors::logs
42 
43 #endif // ABLATELIBRARY_NULLLOG_HPP
Definition: log.hpp:10
Definition: nullLog.hpp:10
static std::ostream nullStream
Definition: nullLog.hpp:26
std::ostream & GetStream() override
Definition: nullLog.hpp:39