Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:26

0001 #ifndef HeterogeneousCore_CUDAUtilities_interface_MessageLogger_h
0002 #define HeterogeneousCore_CUDAUtilities_interface_MessageLogger_h
0003 
0004 #include <sstream>
0005 #include <string>
0006 
0007 namespace cms {
0008   namespace cuda {
0009 
0010     /**
0011    * This class is a temporary measure to hide C++17 constructs in
0012    * MessaLogger from .cu files (those are mainly files that launch
0013    * kernels). It will be removed once we will be able to compile .cu
0014    * files with C++17 capable compiler.
0015    */
0016     class MessageLogger {
0017     public:
0018       MessageLogger(std::string const& category) : category_(category) {}
0019 
0020       MessageLogger(std::string&& category) : category_(std::move(category)) {}
0021 
0022       ~MessageLogger() = default;
0023 
0024       MessageLogger(MessageLogger const&) = delete;
0025       MessageLogger(MessageLogger&&) = delete;
0026       MessageLogger& operator=(MessageLogger const&) = delete;
0027       MessageLogger& operator=(MessageLogger&&) = delete;
0028 
0029       template <typename T>
0030       MessageLogger& operator<<(T const& element) {
0031         message_ << element;
0032         return *this;
0033       }
0034 
0035     protected:
0036       std::string category_;
0037       std::stringstream message_;
0038     };
0039 
0040     class LogSystem : public MessageLogger {
0041     public:
0042       LogSystem(std::string const& category) : MessageLogger(category) {}
0043       LogSystem(std::string&& category) : MessageLogger(std::move(category)) {}
0044       ~LogSystem();
0045     };
0046 
0047     class LogAbsolute : public MessageLogger {
0048     public:
0049       LogAbsolute(std::string const& category) : MessageLogger(category) {}
0050       LogAbsolute(std::string&& category) : MessageLogger(std::move(category)) {}
0051       ~LogAbsolute();
0052     };
0053 
0054     class LogError : public MessageLogger {
0055     public:
0056       LogError(std::string const& category) : MessageLogger(category) {}
0057       LogError(std::string&& category) : MessageLogger(std::move(category)) {}
0058       ~LogError();
0059     };
0060 
0061     class LogProblem : public MessageLogger {
0062     public:
0063       LogProblem(std::string const& category) : MessageLogger(category) {}
0064       LogProblem(std::string&& category) : MessageLogger(std::move(category)) {}
0065       ~LogProblem();
0066     };
0067 
0068     class LogImportant : public MessageLogger {
0069     public:
0070       LogImportant(std::string const& category) : MessageLogger(category) {}
0071       LogImportant(std::string&& category) : MessageLogger(std::move(category)) {}
0072       ~LogImportant();
0073     };
0074 
0075     class LogWarning : public MessageLogger {
0076     public:
0077       LogWarning(std::string const& category) : MessageLogger(category) {}
0078       LogWarning(std::string&& category) : MessageLogger(std::move(category)) {}
0079       ~LogWarning();
0080     };
0081 
0082     class LogPrint : public MessageLogger {
0083     public:
0084       LogPrint(std::string const& category) : MessageLogger(category) {}
0085       LogPrint(std::string&& category) : MessageLogger(std::move(category)) {}
0086       ~LogPrint();
0087     };
0088 
0089     class LogInfo : public MessageLogger {
0090     public:
0091       LogInfo(std::string const& category) : MessageLogger(category) {}
0092       LogInfo(std::string&& category) : MessageLogger(std::move(category)) {}
0093       ~LogInfo();
0094     };
0095 
0096     class LogVerbatim : public MessageLogger {
0097     public:
0098       LogVerbatim(std::string const& category) : MessageLogger(category) {}
0099       LogVerbatim(std::string&& category) : MessageLogger(std::move(category)) {}
0100       ~LogVerbatim();
0101     };
0102 
0103   }  // namespace cuda
0104 }  // namespace cms
0105 
0106 #endif  // HeterogeneousCore_CUDAUtilities_interface_MessageLogger_h