COPASI API  4.40.278
CCopasiMessage Class Reference

#include <CCopasiMessage.h>

Public Types

enum  Type {
  RAW = 0 , TRACE = 1 , COMMANDLINE = 2 , WARNING = 3 ,
  ERROR = 4 , EXCEPTION = 5 , RAW_FILTERED = 128 , TRACE_FILTERED = 129 ,
  COMMANDLINE_FILTERED = 130 , WARNING_FILTERED = 131 , ERROR_FILTERED = 132 , EXCEPTION_FILTERED = 133
}
 

Public Member Functions

 CCopasiMessage ()
 
 CCopasiMessage (const CCopasiMessage &src)
 
 CCopasiMessage (Type type, const char *format,...)
 
 CCopasiMessage (Type type, size_t number,...)
 
const size_t & getNumber () const
 
const std::string & getText () const
 
const CCopasiMessage::TypegetType () const
 
CCopasiMessageoperator= (const CCopasiMessage &RHS)
 
 ~CCopasiMessage ()
 

Static Public Member Functions

static bool checkForMessage (const size_t &number)
 
static void clearDeque ()
 
static std::string getAllMessageText (const bool &chronological=true)
 
static CCopasiMessage getFirstMessage ()
 
static CCopasiMessage::Type getHighestSeverity ()
 
static CCopasiMessage getLastMessage ()
 
static const CCopasiMessagepeekFirstMessage ()
 
static const CCopasiMessagepeekLastMessage ()
 
static void setIsGUI (const bool &isGUI)
 
static size_t size ()
 

Private Member Functions

void handler (const bool &_throw=false)
 
void lineBreak ()
 

Private Attributes

size_t mNumber
 
std::string mText
 
CCopasiMessage::Type mType
 

Static Private Attributes

static bool IsGUI = false
 
static std::deque< CCopasiMessagemMessageDeque
 

Member Enumeration Documentation

◆ Type

Enumerator
RAW 
TRACE 
COMMANDLINE 
WARNING 
ERROR 
EXCEPTION 
RAW_FILTERED 
TRACE_FILTERED 
COMMANDLINE_FILTERED 
WARNING_FILTERED 
ERROR_FILTERED 
EXCEPTION_FILTERED 

Constructor & Destructor Documentation

◆ CCopasiMessage() [1/4]

CCopasiMessage::CCopasiMessage ( void  )

Default constructor. This creates a default error messages, which actually does nothing.

Referenced by getAllMessageText(), getFirstMessage(), getLastMessage(), peekFirstMessage(), and peekLastMessage().

◆ CCopasiMessage() [2/4]

CCopasiMessage::CCopasiMessage ( const CCopasiMessage src)

Copy constructor.

Parameters
constCCopasiMessage & src

◆ CCopasiMessage() [3/4]

CCopasiMessage::CCopasiMessage ( CCopasiMessage::Type  type,
const char *  format,
  ... 
)

Specified constructor. This creates a formated message.

Parameters
CCopasiMessage::Typetype (RAW|TRACE|WARNING|ERROR)
constchar * format (printf like format string)
...arguments like in printf

References C_INT32, handler(), INITIALTEXTSIZE, mNumber, mText, and mType.

◆ CCopasiMessage() [4/4]

CCopasiMessage::CCopasiMessage ( CCopasiMessage::Type  type,
size_t  number,
  ... 
)

Specified constructor. This creates a formated message.

Parameters
CCopasiMessage::Typetype (RAW|TRACE|WARNING|ERROR)
size_tnumber (message number see message.h)
...arguments like in printf

References C_INT32, fatalError, handler(), INITIALTEXTSIZE, Messages, mNumber, mText, and mType.

◆ ~CCopasiMessage()

CCopasiMessage::~CCopasiMessage ( void  )

Destructor.

Member Function Documentation

◆ checkForMessage()

bool CCopasiMessage::checkForMessage ( const size_t &  number)
static

Check whether a message with the given number is in the dequeue

Parameters
constsize_t & number
Returns
bool found

References mMessageDeque.

◆ clearDeque()

◆ getAllMessageText()

std::string CCopasiMessage::getAllMessageText ( const bool &  chronological = true)
static

Retrieve the text of all messages in the dequeue in chronological or reverse chronological order. If more than on message is in the dequeue the messages are separated by an empty line.

Returns
std::string messageTexts

References CCopasiMessage(), getFirstMessage(), getLastMessage(), getText(), and mMessageDeque.

Referenced by addMessagesToStream(), CDataModel::exportSBML(), CDataModel::exportSBMLToString(), CDataModel::exportSEDML(), and CDataModel::exportSEDMLToString().

◆ getFirstMessage()

CCopasiMessage CCopasiMessage::getFirstMessage ( )
static

This function retrieves the first message created in COPASI. Consecutive calls allow for the retrieval of all generated messages in chronological order. If no more messages are in the dequeue the message (MCCopasiMessage + 1, "Message (1): No more messages." is returned.

Returns
CCopasiMessage message

References CCopasiMessage(), MCCopasiMessage, mMessageDeque, and RAW.

Referenced by getAllMessageText().

◆ getHighestSeverity()

CCopasiMessage::Type CCopasiMessage::getHighestSeverity ( )
static

Retrieve highest severity of the messages in the dequeue.

Returns
const CCopasiMessage::Type & highestSeverity

References mMessageDeque, and RAW.

Referenced by addMessagesToStream(), and CFitProblem::initialize().

◆ getLastMessage()

◆ getNumber()

const size_t & CCopasiMessage::getNumber ( void  ) const

Retrieves the number of the message.

Returns
"const size_t &" mNumber

References mNumber.

Referenced by CModel::load().

◆ getText()

const std::string & CCopasiMessage::getText ( void  ) const

◆ getType()

const CCopasiMessage::Type & CCopasiMessage::getType ( void  ) const

Retrieves the type of the message.

Returns
"const CCopasiMessage::Type &" mType

References mType.

◆ handler()

void CCopasiMessage::handler ( const bool &  _throw = false)
private

◆ lineBreak()

void CCopasiMessage::lineBreak ( )
private

Inserts line breaks in the message text.

References mText.

Referenced by handler().

◆ operator=()

CCopasiMessage & CCopasiMessage::operator= ( const CCopasiMessage RHS)

Assignment operator.

References mNumber, mText, and mType.

◆ peekFirstMessage()

const CCopasiMessage & CCopasiMessage::peekFirstMessage ( )
static

This function peeks at the first message created in COPASI. If no more messages are in the dequeue the message (MCCopasiMessage + 1, "Message (1): No more messages." is returned.

Returns
const CCopasiMessage & message

References CCopasiMessage(), MCCopasiMessage, mMessageDeque, and RAW.

◆ peekLastMessage()

const CCopasiMessage & CCopasiMessage::peekLastMessage ( )
static

This function peeks at the last message created in COPASI. If no more messages are in the dequeue the message (MCCopasiMessage + 1, "Message (1): No more messages." is returned.

Returns
const CCopasiMessage & message

References CCopasiMessage(), MCCopasiMessage, mMessageDeque, and RAW.

Referenced by SBMLImporter::createCModelFromSBMLDocument(), SBMLImporter::importEvent(), SBMLImporter::importEvents(), SBMLImporter::importFunctionDefinitions(), SBMLImporter::importInitialAssignments(), CFitProblem::initialize(), and CFunctionDB::load().

◆ setIsGUI()

void CCopasiMessage::setIsGUI ( const bool &  isGUI)
static

Set whether the messages are created from COPASI as GUI or commandline. This method is called from CRootContainer::init and there should be no need to call it otherwise.

Parameters
constbool & isGUI

References IsGUI.

Referenced by CRootContainer::init().

◆ size()

Member Data Documentation

◆ IsGUI

bool CCopasiMessage::IsGUI = false
staticprivate

A flag indicating whether the COPASI is running as commandline or GUI

Referenced by handler(), and setIsGUI().

◆ mMessageDeque

std::deque< CCopasiMessage > CCopasiMessage::mMessageDeque
staticprivate

The stack of messages. Each message created with one of the specific constructors is automatically added to the stack.

Referenced by checkForMessage(), clearDeque(), getAllMessageText(), getFirstMessage(), getHighestSeverity(), getLastMessage(), handler(), peekFirstMessage(), peekLastMessage(), and size().

◆ mNumber

size_t CCopasiMessage::mNumber
private

Message Number

Referenced by CCopasiMessage(), getNumber(), handler(), and operator=().

◆ mText

std::string CCopasiMessage::mText
private

Message text.

Referenced by CCopasiMessage(), getText(), handler(), lineBreak(), and operator=().

◆ mType

CCopasiMessage::Type CCopasiMessage::mType
private

Message type.

Referenced by CCopasiMessage(), getType(), handler(), and operator=().


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