IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
ipsdk::LogMessageManager Class Reference

Log message manager for ipsdk libraries. More...

#include <LogMessageManager.h>

Inheritance diagram for ipsdk::LogMessageManager:

Public Member Functions

const std::string & getLibraryName () const
 retrieve library name
 
template<typename EnumT >
bool existsMessage (const EnumT &messageId) const
 template member for easy check whether a message is associated to a given id
 
bool existsMessage (const std::string &enumTypeStr, ipInt32 messageId) const
 check whether a message is associated to a given id
 
template<typename EnumT >
const std::string & getMessage (const EnumT &messageId)
 template member for easy retrieve a message given an id More...
 
const std::string & getMessage (const std::string &enumTypeStr, ipInt32 messageId) const
 retrieve a message given an id More...
 
void clear ()
 clear all existing messages
 
template<typename EnumT >
void removeMessage (const EnumT &messageId)
 template member for easy remove an existing message More...
 
void removeMessage (const std::string &enumTypeStr, ipInt32 messageId)
 remove an existing message More...
 
template<typename EnumT >
void addMessage (const EnumT &messageId, const std::string &messageStr)
 template member for easy add a new message More...
 
void addMessage (const std::string &enumTypeStr, ipInt32 messageId, const std::string &messageStr)
 add a new message More...
 
void readFile (const boost::filesystem::path &msgFilePath, bool bAppend, EnumStringToIntFunc enumStringToIntFunction=boost::lexical_cast< ipInt32, const std::string &>)
 read messages from a file More...
 

Static Public Member Functions

static LogMessageManagergetInstance (const std::string &libraryName)
 retrieve singleton instance of message
 

Protected Types

typedef std::map< ipInt32, std::string > MessageMap
 map associating a message id to a string
 
typedef std::map< std::string, MessageMapMessageColl
 map associating a string (an enumerate typeid) to a MessageMap
 

Protected Member Functions

Constructors and destructors
 LogMessageManager (const std::string &libraryName)
 
 ~LogMessageManager ()
 

Protected Attributes

std::string _libraryName
 library name for message manager
 
MessageColl _messageColl
 message map associating ids with corresponding message
 

Friends

template<class T >
void boost::checked_delete (T *x) BOOST_NOEXCEPT
 

Detailed Description

Log message manager for ipsdk libraries.

Author
E. Noirfalise
Date
2013/2/15

Each library is associated to a singleton instance of this class. Messages are identified by their numerical id.

Member Function Documentation

◆ getMessage() [1/2]

template<typename EnumT >
const std::string& ipsdk::LogMessageManager::getMessage ( const EnumT &  messageId)
inline

template member for easy retrieve a message given an id

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == false

◆ getMessage() [2/2]

const std::string& ipsdk::LogMessageManager::getMessage ( const std::string &  enumTypeStr,
ipInt32  messageId 
) const

retrieve a message given an id

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == false

◆ removeMessage() [1/2]

template<typename EnumT >
void ipsdk::LogMessageManager::removeMessage ( const EnumT &  messageId)
inline

template member for easy remove an existing message

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == false

◆ removeMessage() [2/2]

void ipsdk::LogMessageManager::removeMessage ( const std::string &  enumTypeStr,
ipInt32  messageId 
)

remove an existing message

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == false

◆ addMessage() [1/2]

template<typename EnumT >
void ipsdk::LogMessageManager::addMessage ( const EnumT &  messageId,
const std::string &  messageStr 
)
inline

template member for easy add a new message

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == true

◆ addMessage() [2/2]

void ipsdk::LogMessageManager::addMessage ( const std::string &  enumTypeStr,
ipInt32  messageId,
const std::string &  messageStr 
)

add a new message

Exceptions
ipsdk::IPSDKUtilExceptionif existsMessage(messageId) == true

◆ readFile()

void ipsdk::LogMessageManager::readFile ( const boost::filesystem::path &  msgFilePath,
bool  bAppend,
EnumStringToIntFunc  enumStringToIntFunction = boost::lexical_cast< ipInt32, const std::string &> 
)

read messages from a file

File must respect following format : enumTypeStr;id;message

Note
If bAppend == false, current message map will be first emptied
Template function in EnumUtils.h can be used to convert string values of enumerates to integer
Exceptions
ipsdk::IPSDKUtilExceptionif file doesn't exists or can't be acccessed
ipsdk::IPSDKUtilExceptionif invalid file format
ipsdk::IPSDKUtilExceptionif read messag id already exits

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