Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:55:05

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file corecel/io/detail/NullLoggerMessage.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <ostream>
0010 
0011 #include "corecel/Macros.hh"
0012 
0013 namespace celeritas
0014 {
0015 namespace detail
0016 {
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Stream-like helper class that \em discards everything passed to it.
0020  *
0021  * This helper class should simply eat any messages and objects passed to it.
0022  */
0023 class NullLoggerMessage
0024 {
0025   public:
0026     //!@{
0027     //! \name Type aliases
0028     using StreamManip = std::ostream& (*)(std::ostream&);
0029     //!@}
0030 
0031   public:
0032     // Default constructor.
0033     NullLoggerMessage() = default;
0034 
0035     //! Do not print this object
0036     template<class T>
0037     CELER_FORCEINLINE_FUNCTION NullLoggerMessage& operator<<(T&&)
0038     {
0039         return *this;
0040     }
0041 
0042     //! Ignore this manipulator function
0043     CELER_FORCEINLINE_FUNCTION NullLoggerMessage& operator<<(StreamManip)
0044     {
0045         return *this;
0046     }
0047 
0048     //! Do not set any state
0049     CELER_FORCEINLINE_FUNCTION void setstate(std::ostream::iostate) {}
0050 };
0051 
0052 //---------------------------------------------------------------------------//
0053 }  // namespace detail
0054 }  // namespace celeritas