Gromacs  2021.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::LogWriteHelper Class Reference

#include <gromacs/utility/logger.h>

Description

Helper class for implementing GMX_LOG.

Public Member Functions

 LogWriteHelper (ILogTarget *target)
 Initializes a helper for writing to the given target.
 
 operator bool () const
 Returns whether anything needs to be written. More...
 
LogWriteHelperoperator= (const LogEntryWriter &entryWriter)
 Writes the entry from the given writer to the log target. More...
 

Member Function Documentation

gmx::LogWriteHelper::operator bool ( ) const
inline

Returns whether anything needs to be written.

Note that the return value is unintuitively false when the target is active, to allow implementing GMX_LOG like it is now.

LogWriteHelper& gmx::LogWriteHelper::operator= ( const LogEntryWriter entryWriter)
inline

Writes the entry from the given writer to the log target.

This is implemented as an assignment operator to get proper precedence for operations for the GMX_LOG macro; this is a common technique for implementing macros that allow streming information to them (see, e.g., Google Test).


The documentation for this class was generated from the following file: