HyperPlot  v1
Bin and visualise multidimensional datasets
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
MessageSerivce Class Reference

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

This is used to print all of the output from HyperPlot to a chosen output stream (by default std::cout). Access to this class is done through the precompiler definitions.

WELCOME_LOG - A welcome message in the constructor of each class ERROR_LOG - Use to print error messages to the screen INFO_LOG - Use to print useful information to the screen VERBOSE_LOG - Use for verbose information GOODBYE_LOG - A goodbye message in the destructor of each class

ERROR_COUNT - Print out how many error messages have been shown. This is useful to call at the end of the main function

Definition at line 33 of file MessageService.h.

#include <MessageService.h>

Public Types

enum  ErrorType {
  WELCOME, ERROR, INFO, VERBOSE,
  GOODBYE
}
 Define the possible error types.
 
typedef std::basic_ostream< char, std::char_traits< char > > CoutType
 
typedef CoutType &(* StandardEndLine) (CoutType &)
 

Public Member Functions

void printErrorCount ()
 
template<class T >
MessageSerivceoperator<< (const T &v)
 
MessageSerivceoperator<< (StandardEndLine manip)
 
 ~MessageSerivce ()
 

Static Public Member Functions

static MessageSerivcegetMessageService (ErrorType errorType)
 
static MessageSerivcegetMessageService ()
 

Public Attributes

std::ostream & _stream
 the output stream - by default this is std:cout
 
std::map< ErrorType, bool > _outputOptions
 
std::map< ErrorType, TString > _outputHeaders
 
bool _endlCalled
 
bool _printOrNot
 
ErrorType _errorType
 
long int _errorCount
 

Private Member Functions

 MessageSerivce ()
 

Static Private Attributes

static MessageSerivces_messageService = 0
 static variable that holds the singleton object
 

Member Typedef Documentation

typedef std::basic_ostream<char, std::char_traits<char> > MessageSerivce::CoutType

this is the type of std::cout

Definition at line 131 of file MessageService.h.

typedef CoutType&(* MessageSerivce::StandardEndLine) (CoutType &)

this is the function signature of std::endl

Definition at line 135 of file MessageService.h.

Constructor & Destructor Documentation

MessageSerivce::MessageSerivce ( )
private

constuctor

Definition at line 55 of file MessageService.cpp.

MessageSerivce::~MessageSerivce ( )

destuctor

Definition at line 88 of file MessageService.cpp.

Member Function Documentation

MessageSerivce & MessageSerivce::getMessageService ( ErrorType  errorType)
static

Static function to retrive the MessageSerivce singleton. At the same time, also change the state of the MessageSerivce.

Definition at line 8 of file MessageService.cpp.

MessageSerivce & MessageSerivce::getMessageService ( )
static

Static function to retrive the MessageSerivce singleton without altering its message state

Definition at line 40 of file MessageService.cpp.

template<class T >
MessageSerivce& MessageSerivce::operator<< ( const T &  v)
inline

This makes is possible the do messageSerivce <<

Definition at line 83 of file MessageService.h.

MessageSerivce& MessageSerivce::operator<< ( StandardEndLine  manip)
inline

define an operator<< to take in std::endl

Definition at line 139 of file MessageService.h.

void MessageSerivce::printErrorCount ( )

print how many errors messages have been sent to the output stream

Definition at line 77 of file MessageService.cpp.

Member Data Documentation

bool MessageSerivce::_endlCalled

bool was the last command sent to the steam a std::cout ?

Definition at line 61 of file MessageService.h.

long int MessageSerivce::_errorCount

Count the number of errors that happened.

Definition at line 74 of file MessageService.h.

ErrorType MessageSerivce::_errorType

The current message type of the MessageSerivce

Definition at line 70 of file MessageService.h.

std::map<ErrorType, TString> MessageSerivce::_outputHeaders

this is the string that proceeds each of the message types

Definition at line 57 of file MessageService.h.

std::map<ErrorType, bool> MessageSerivce::_outputOptions

this map decides what message types should be printed to the output stream (verbose, welcome and goodbye are off by default)

Definition at line 53 of file MessageService.h.

bool MessageSerivce::_printOrNot

For the current message type, should I be printing to the stream (means you don't have to use the map many times in a row i.e. faster)

Definition at line 66 of file MessageService.h.


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