ArmNN
 24.08
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 100 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 102 of file Logging.hpp.

103  : m_LogSinks(sinks)
104  , m_Enabled(enabled)
105  {
106  if (enabled)
107  {
108  m_Os << LevelToString(level) << ": ";
109  }
110  }

References armnn::LevelToString().

◆ ~ScopedRecord()

~ScopedRecord ( )
inline

Definition at line 112 of file Logging.hpp.

113  {
114  if (m_Enabled)
115  {
116  for (auto sink : m_LogSinks)
117  {
118  if (sink)
119  {
120  sink->Consume(m_Os.str());
121  }
122  }
123  }
124  }

◆ ScopedRecord() [2/3]

ScopedRecord ( const ScopedRecord )
delete

◆ ScopedRecord() [3/3]

ScopedRecord ( ScopedRecord &&  other)
inline

Definition at line 130 of file Logging.hpp.

131  : m_LogSinks(other.m_LogSinks)
132  , m_Os(std::move(other.m_Os))
133  , m_Enabled(other.m_Enabled)
134  {
135  // Disable the moved-from ScopedRecord, to prevent it from sending its (now empty) message to
136  // its sinks.
137  other.m_Enabled = false;
138  }

Member Function Documentation

◆ operator<<()

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

Definition at line 141 of file Logging.hpp.

142  {
143  if (m_Enabled)
144  {
145  m_Os << s;
146  }
147  return (*this);
148  }

◆ 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:
armnn::LevelToString
std::string LevelToString(LogSeverity level)
Definition: Logging.hpp:22