ArmNN
 22.11
ScopedRecord Struct Reference

#include <Logging.hpp>

Public Member Functions

 ScopedRecord (const std::vector< std::shared_ptr< LogSink >> &sinks, LogSeverity level, bool enabled)
 
 ~ScopedRecord ()
 
 ScopedRecord (const ScopedRecord &)=delete
 
ScopedRecordoperator= (const ScopedRecord &)=delete
 
ScopedRecordoperator= (ScopedRecord &&)=delete
 
 ScopedRecord (ScopedRecord &&other)
 
template<typename Streamable >
ScopedRecordoperator<< (const Streamable &s)
 

Detailed Description

Definition at line 93 of file Logging.hpp.

Constructor & Destructor Documentation

◆ ScopedRecord() [1/3]

ScopedRecord ( const std::vector< std::shared_ptr< LogSink >> &  sinks,
LogSeverity  level,
bool  enabled 
)
inline

Definition at line 95 of file Logging.hpp.

References armnn::LevelToString().

96  : m_LogSinks(sinks)
97  , m_Enabled(enabled)
98  {
99  if (enabled)
100  {
101  m_Os << LevelToString(level) << ": ";
102  }
103  }
std::string LevelToString(LogSeverity level)
Definition: Logging.hpp:15

◆ ~ScopedRecord()

~ScopedRecord ( )
inline

Definition at line 105 of file Logging.hpp.

106  {
107  if (m_Enabled)
108  {
109  for (auto sink : m_LogSinks)
110  {
111  if (sink)
112  {
113  sink->Consume(m_Os.str());
114  }
115  }
116  }
117  }

◆ ScopedRecord() [2/3]

ScopedRecord ( const ScopedRecord )
delete

◆ ScopedRecord() [3/3]

ScopedRecord ( ScopedRecord &&  other)
inline

Definition at line 123 of file Logging.hpp.

124  : m_LogSinks(other.m_LogSinks)
125  , m_Os(std::move(other.m_Os))
126  , m_Enabled(other.m_Enabled)
127  {
128  // Disable the moved-from ScopedRecord, to prevent it from sending its (now empty) message to
129  // its sinks.
130  other.m_Enabled = false;
131  }

Member Function Documentation

◆ operator<<()

ScopedRecord& operator<< ( const Streamable &  s)
inline

Definition at line 134 of file Logging.hpp.

135  {
136  if (m_Enabled)
137  {
138  m_Os << s;
139  }
140  return (*this);
141  }

◆ operator=() [1/2]

ScopedRecord& operator= ( const ScopedRecord )
delete

◆ operator=() [2/2]

ScopedRecord& operator= ( ScopedRecord &&  )
delete

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