Cortex  10.0.0-a4
Public Member Functions | Protected Attributes | List of all members
IECore::OStreamMessageHandler Class Reference

#include <OStreamMessageHandler.h>

+ Inheritance diagram for IECore::OStreamMessageHandler:

Public Member Functions

 IE_CORE_DECLAREMEMBERPTR (OStreamMessageHandler)
 
 OStreamMessageHandler (std::ostream &stream)
 
 OStreamMessageHandler (std::ostream *stream)
 
void handle (Level level, const std::string &context, const std::string &message) override
 
- Public Member Functions inherited from IECore::MessageHandler
 IE_CORE_DECLAREMEMBERPTR (MessageHandler)
 
- Public Member Functions inherited from IECore::RefCounted
 IE_CORE_DECLAREMEMBERPTR (RefCounted)
 
void addRef () const
 Add a reference to the current object.
 
void removeRef () const
 Remove a reference from the current object.
 
RefCount refCount () const
 Returns the current reference count.
 

Static Public Member Functions

Shared message handlers

These functions return static instances of some default message handlers that can be shared by everyone.

static OStreamMessageHandlercErrHandler ()
 
static OStreamMessageHandlercOutHandler ()
 
- Static Public Member Functions inherited from IECore::MessageHandler
static MessageHandlercurrentHandler ()
 
static void output (Level level, const std::string &context, const std::string &message)
 Output a message to the current handler.
 
static void output (Level level, const std::string &context, const boost::format &message)
 Output a message to the current handler.
 
static void setDefaultHandler (const MessageHandlerPtr &handler)
 
static MessageHandlergetDefaultHandler ()
 
static std::string levelAsString (Level level)
 Returns a readable string representation of the specified message level.
 
static Level stringAsLevel (const std::string &level)
 Returns a message level based on the specified string (case is ignored).
 

Protected Attributes

std::ostream * m_stream
 

Additional Inherited Members

- Public Types inherited from IECore::MessageHandler
enum  Level {
  Error = 0, Warning = 1, Info = 2, Debug = 3,
  Invalid = 4
}
 
- Public Types inherited from IECore::RefCounted
typedef size_t RefCount
 

Detailed Description

This class implements a simple MessageHandler to write to a std::ostream object.

Constructor & Destructor Documentation

IECore::OStreamMessageHandler::OStreamMessageHandler ( std::ostream &  stream)

Creates a message handler to output to the specified stream. The handler does not own the stream and will not attempt to delete it. This form of the constructor is intended primarily for outputing to default streams such as std::cerr.

IECore::OStreamMessageHandler::OStreamMessageHandler ( std::ostream *  stream)

Creates a message handler to output to the specified stream. The handler takes ownerwship of the passed stream and will delete it on destruction.

Member Function Documentation

void IECore::OStreamMessageHandler::handle ( Level  level,
const std::string &  context,
const std::string &  message 
)
overridevirtual

Must be implemented by subclasses to output the message appropriately. Client code should use MessageHandler::output() rather than call this directly.

Implements IECore::MessageHandler.


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