Only log message in debug.

This commit is contained in:
Dave Pugmire 2023-03-23 15:09:47 -04:00
parent 9d3c24ab91
commit 322012a596

@ -33,6 +33,27 @@ namespace flow
namespace internal
{
#ifdef NDEBUG
namespace
{
struct NullStream
{
void open(const std::string&, std::ios_base::openmode) {}
};
template <typename T>
NullStream& operator<<(NullStream& s, T const&)
{
return s;
}
NullStream& operator<<(NullStream& s, std::ostream&(std::ostream&))
{
return s;
}
}
#endif
class VTKM_FILTER_FLOW_EXPORT Messenger
{
public:
@ -53,7 +74,11 @@ public:
bool UsingSyncCommunication() const { return !this->UsingAsyncCommunication(); }
bool UsingAsyncCommunication() const { return this->UseAsynchronousCommunication; }
#ifdef NDEBUG
NullStream Log;
#else
std::ofstream Log;
#endif
protected:
static std::size_t CalcMessageBufferSize(std::size_t msgSz);
@ -98,8 +123,6 @@ private:
std::size_t id, numPackets, packet, packetSz, dataSz;
} Header;
//bool RecvData(int tag, std::vector<vtkmdiy::MemoryBuffer>& buffers, bool blockAndWait = false);
void PrepareForSend(int tag, const vtkmdiy::MemoryBuffer& buff, std::vector<char*>& buffList);
vtkm::Id GetMsgID() { return this->MsgID++; }
static bool PacketCompare(const char* a, const char* b);