ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
itk::ThreadLogger Class Reference

#include <itkThreadLogger.h>

+ Inheritance diagram for itk::ThreadLogger:
+ Collaboration diagram for itk::ThreadLogger:

Public Types

using ConstPointer = SmartPointer< const Self >
 
using DelayType = unsigned int
 
enum  OperationType {
  SET_PRIORITY_LEVEL,
  SET_LEVEL_FOR_FLUSHING,
  ADD_LOG_OUTPUT,
  WRITE,
  FLUSH
}
 
using OutputType = Logger::OutputType
 
using Pointer = SmartPointer< Self >
 
using PriorityLevelEnum = Logger::PriorityLevelEnum
 
using Self = ThreadLogger
 
using Superclass = Logger
 
- Public Types inherited from itk::Logger
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Logger
 
using Superclass = LoggerBase
 
- Public Types inherited from itk::LoggerBase
using ConstPointer = SmartPointer< const Self >
 
using OutputType = MultipleLogOutput::OutputType
 
using Pointer = SmartPointer< Self >
 
using PriorityLevelEnum = LoggerBaseEnums::PriorityLevel
 
using Self = LoggerBase
 
using Superclass = Object
 
using TimeStampFormatEnum = LoggerBaseEnums::TimeStampFormat
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

void AddLogOutput (OutputType *output) override
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
void Flush () override
 
virtual DelayType GetDelay () const
 
PriorityLevelEnum GetLevelForFlushing () const override
 
virtual const char * GetNameOfClass () const
 
PriorityLevelEnum GetPriorityLevel () const override
 
virtual void SetDelay (DelayType delay)
 
void SetLevelForFlushing (PriorityLevelEnum level) override
 
void SetPriorityLevel (PriorityLevelEnum level) override
 
void Write (PriorityLevelEnum level, std::string const &content) override
 
- Public Member Functions inherited from itk::LoggerBase
virtual const char * GetName () const
 
virtual void SetName (const char *_arg)
 
virtual void SetTimeStampFormat (const TimeStampFormatEnum _arg)
 
virtual const TimeStampFormatEnumGetTimeStampFormat () const
 
virtual void SetHumanReadableFormat (const char *_arg)
 
virtual const char * GetHumanReadableFormat () const
 
virtual std::string BuildFormattedEntry (PriorityLevelEnum level, std::string const &content)
 
void Debug (std::string const &message)
 
void Info (std::string const &message)
 
void Warning (std::string const &message)
 
void Critical (std::string const &message)
 
void Error (std::string const &message)
 
void Fatal (std::string const &message)
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Logger
static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

void PrintSelf (std::ostream &os, Indent indent) const override
 
void ThreadFunction ()
 
 ThreadLogger ()
 
 ~ThreadLogger () override
 
- Protected Member Functions inherited from itk::Logger
 Logger ()
 
 ~Logger () override
 
- Protected Member Functions inherited from itk::LoggerBase
 LoggerBase ()
 
 ~LoggerBase () override
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Types

using LevelContainerType = std::queue< PriorityLevelEnum >
 
using MessageContainerType = std::queue< std::string >
 
using OperationContainerType = std::queue< OperationType >
 
using OutputContainerType = std::queue< OutputType::Pointer >
 

Private Member Functions

void InternalFlush ()
 

Private Attributes

DelayType m_Delay
 
LevelContainerType m_LevelQ
 
MessageContainerType m_MessageQ
 
std::mutex m_Mutex
 
OperationContainerType m_OperationQ
 
OutputContainerType m_OutputQ
 
bool m_TerminationRequested
 
std::thread m_Thread
 

Additional Inherited Members

- Protected Attributes inherited from itk::LoggerBase
PriorityLevelEnum m_PriorityLevel
 
PriorityLevelEnum m_LevelForFlushing
 
MultipleLogOutput::Pointer m_Output
 
RealTimeClock::Pointer m_Clock
 
TimeStampFormatEnum m_TimeStampFormat
 
std::string m_HumanReadableFormat
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

Providing logging service as a separate thread.

Author
Hee-Su Kim, Compute Science Dept. Kyungpook National University, ISIS Center, Georgetown University.

Definition at line 40 of file itkThreadLogger.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 46 of file itkThreadLogger.h.

◆ DelayType

using itk::ThreadLogger::DelayType = unsigned int

Definition at line 58 of file itkThreadLogger.h.

◆ LevelContainerType

Definition at line 132 of file itkThreadLogger.h.

◆ MessageContainerType

using itk::ThreadLogger::MessageContainerType = std::queue<std::string>
private

Definition at line 130 of file itkThreadLogger.h.

◆ OperationContainerType

Definition at line 128 of file itkThreadLogger.h.

◆ OutputContainerType

using itk::ThreadLogger::OutputContainerType = std::queue<OutputType::Pointer>
private

Definition at line 134 of file itkThreadLogger.h.

◆ OutputType

using itk::ThreadLogger::OutputType = Logger::OutputType

Definition at line 54 of file itkThreadLogger.h.

◆ Pointer

Definition at line 45 of file itkThreadLogger.h.

◆ PriorityLevelEnum

Definition at line 56 of file itkThreadLogger.h.

◆ Self

Definition at line 43 of file itkThreadLogger.h.

◆ Superclass

Definition at line 44 of file itkThreadLogger.h.

Member Enumeration Documentation

◆ OperationType

Definition of types of operations for ThreadLogger.

Enumerator
SET_PRIORITY_LEVEL 
SET_LEVEL_FOR_FLUSHING 
ADD_LOG_OUTPUT 
WRITE 
FLUSH 

Definition at line 61 of file itkThreadLogger.h.

Constructor & Destructor Documentation

◆ ThreadLogger()

itk::ThreadLogger::ThreadLogger ( )
protected

Constructor

◆ ~ThreadLogger()

itk::ThreadLogger::~ThreadLogger ( )
overrideprotected

Destructor

Member Function Documentation

◆ AddLogOutput()

void itk::ThreadLogger::AddLogOutput ( OutputType output)
overridevirtual

Registers another output stream with the multiple output.

Reimplemented from itk::LoggerBase.

◆ CreateAnother()

virtual::itk::LightObject::Pointer itk::ThreadLogger::CreateAnother ( ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Logger.

◆ Flush()

void itk::ThreadLogger::Flush ( )
overridevirtual

Set/Get the type of format used for reporting the time stamp of a given log message. The main options are REALVALUE and HUMANREADABLE. REALVALUE will report the time in seconds as a double number. HUMANREADABLE will report the time in formatted text such as '2007 May 7 09:23:14'

See also
SetHumanReadableFormat()

Reimplemented from itk::LoggerBase.

◆ GetDelay()

virtual DelayType itk::ThreadLogger::GetDelay ( ) const
virtual

Get the delay in milliseconds between checks to see if there are any low priority messages to be processed.

◆ GetLevelForFlushing()

PriorityLevelEnum itk::ThreadLogger::GetLevelForFlushing ( ) const
overridevirtual

Set/Get the type of format used for reporting the time stamp of a given log message. The main options are REALVALUE and HUMANREADABLE. REALVALUE will report the time in seconds as a double number. HUMANREADABLE will report the time in formatted text such as '2007 May 7 09:23:14'

See also
SetHumanReadableFormat()

Reimplemented from itk::LoggerBase.

◆ GetNameOfClass()

virtual const char* itk::ThreadLogger::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::Logger.

◆ GetPriorityLevel()

PriorityLevelEnum itk::ThreadLogger::GetPriorityLevel ( ) const
overridevirtual

Get the priority level for the current logger. Only messages that have priorities equal or greater than the one set here will be posted to the current outputs.

Reimplemented from itk::LoggerBase.

◆ InternalFlush()

void itk::ThreadLogger::InternalFlush ( )
private

◆ New()

static Pointer itk::ThreadLogger::New ( )
static

New macro for creation of a Smart Pointer

◆ PrintSelf()

void itk::ThreadLogger::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotectedvirtual

Print contents of a ThreadLogger

Reimplemented from itk::LoggerBase.

◆ SetDelay()

virtual void itk::ThreadLogger::SetDelay ( DelayType  delay)
virtual

Set the delay in milliseconds between checks to see if there are any low priority messages to be processed.

◆ SetLevelForFlushing()

void itk::ThreadLogger::SetLevelForFlushing ( PriorityLevelEnum  level)
overridevirtual

Set/Get the type of format used for reporting the time stamp of a given log message. The main options are REALVALUE and HUMANREADABLE. REALVALUE will report the time in seconds as a double number. HUMANREADABLE will report the time in formatted text such as '2007 May 7 09:23:14'

See also
SetHumanReadableFormat()

Reimplemented from itk::LoggerBase.

◆ SetPriorityLevel()

void itk::ThreadLogger::SetPriorityLevel ( PriorityLevelEnum  level)
overridevirtual

Set the priority level for the current logger. Only messages that have priorities equal or greater than the one set here will be posted to the current outputs.

Reimplemented from itk::LoggerBase.

◆ ThreadFunction()

void itk::ThreadLogger::ThreadFunction ( )
protected

◆ Write()

void itk::ThreadLogger::Write ( PriorityLevelEnum  level,
std::string const &  content 
)
overridevirtual

Set/Get the type of format used for reporting the time stamp of a given log message. The main options are REALVALUE and HUMANREADABLE. REALVALUE will report the time in seconds as a double number. HUMANREADABLE will report the time in formatted text such as '2007 May 7 09:23:14'

See also
SetHumanReadableFormat()

Reimplemented from itk::LoggerBase.

Member Data Documentation

◆ m_Delay

DelayType itk::ThreadLogger::m_Delay
private

Definition at line 150 of file itkThreadLogger.h.

◆ m_LevelQ

LevelContainerType itk::ThreadLogger::m_LevelQ
private

Definition at line 144 of file itkThreadLogger.h.

◆ m_MessageQ

MessageContainerType itk::ThreadLogger::m_MessageQ
private

Definition at line 142 of file itkThreadLogger.h.

◆ m_Mutex

std::mutex itk::ThreadLogger::m_Mutex
mutableprivate

Definition at line 148 of file itkThreadLogger.h.

◆ m_OperationQ

OperationContainerType itk::ThreadLogger::m_OperationQ
private

Definition at line 140 of file itkThreadLogger.h.

◆ m_OutputQ

OutputContainerType itk::ThreadLogger::m_OutputQ
private

Definition at line 146 of file itkThreadLogger.h.

◆ m_TerminationRequested

bool itk::ThreadLogger::m_TerminationRequested
private

Definition at line 138 of file itkThreadLogger.h.

◆ m_Thread

std::thread itk::ThreadLogger::m_Thread
private

Definition at line 136 of file itkThreadLogger.h.


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