MCPcopy Create free account
hub / github.com/LASzip/LASzip / LASMessageStream

Class LASMessageStream

src/lasmessage.hpp:76–96  ·  view source on GitHub ↗

@brief Logger-Wrapper that allows to stream to the logger. @usage LASMessageStream(LAS_FATAL_ERROR) << "Pi is approximately: " << LASMessageStream().precision(2) << 3.14159 << std::endl;

Source from the content-addressed store, hash-verified

74// @brief Logger-Wrapper that allows to stream to the logger.
75// @usage LASMessageStream(LAS_FATAL_ERROR) << "Pi is approximately: " << LASMessageStream().precision(2) << 3.14159 << std::endl;
76class LASMessageStream
77{
78public:
79 LASMessageStream(LAS_MESSAGE_TYPE type) : setType(type) {}
80 ~LASMessageStream() { if (setType != LAS_QUIET) LASMessage(setType, usedStream.str().c_str()); }
81
82 template <typename T>
83 LASMessageStream& operator<<(const T& value)
84 {
85 usedStream << value;
86 return *this;
87 }
88
89 // just in case someone streams std::endl ...
90 LASMessageStream& operator<<(std::ostream& (*func)(std::ostream&));
91 LASMessageStream& precision(int prec);
92
93private:
94 LAS_MESSAGE_TYPE setType;
95 std::ostringstream usedStream;
96};
97
98#define logdebug LASMessageStream(LAS_DEBUG)
99#define logveryverbose LASMessageStream(LAS_VERY_VERBOSE)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected