COPASI API  4.16.103
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CCopasiMessage Class Reference

#include <CCopasiMessage.h>

Collaboration diagram for CCopasiMessage:
Collaboration graph
[legend]

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
 

Detailed Description

Definition at line 78 of file CCopasiMessage.h.

Member Enumeration Documentation

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

Definition at line 81 of file CCopasiMessage.h.

Constructor & Destructor Documentation

CCopasiMessage::CCopasiMessage ( void  )

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

Definition at line 148 of file CCopasiMessage.cpp.

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

148  :
149  mText(),
151  mNumber(0)
152 {}
CCopasiMessage::Type mType
std::string mText
CCopasiMessage::CCopasiMessage ( const CCopasiMessage src)

Copy constructor.

Parameters
constCCopasiMessage & src

Definition at line 154 of file CCopasiMessage.cpp.

154  :
155  mText(src.mText),
156  mType(src.mType),
157  mNumber(src.mNumber)
158 {}
CCopasiMessage::Type mType
std::string mText
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

Definition at line 160 of file CCopasiMessage.cpp.

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

162 {
163  C_INT32 TextSize = INITIALTEXTSIZE;
164  C_INT32 Printed = 0;
165 
166  char *Text = NULL;
167  Text = new char[TextSize + 1];
168 
169  va_list Arguments; // = NULL;
170  va_start(Arguments, format);
171  Printed = vsnprintf(Text, TextSize, format, Arguments);
172  va_end(Arguments);
173 
174  while (Printed < 0 || TextSize < Printed)
175  {
176  delete [] Text;
177 
178  (Printed < 0) ? TextSize *= 2 : TextSize = Printed;
179  Text = new char[TextSize + 1];
180 
181  va_list Arguments; // = NULL;
182  va_start(Arguments, format);
183  Printed = vsnprintf(Text, TextSize, format, Arguments);
184  va_end(Arguments);
185  }
186 
187  mText = Text;
188  delete[] Text;
189  mType = type;
190  mNumber = 0;
191 
192  handler();
193 }
#define C_INT32
Definition: copasi.h:90
CCopasiMessage::Type mType
void handler(const bool &_throw=false)
#define INITIALTEXTSIZE
std::string mText
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

Definition at line 195 of file CCopasiMessage.cpp.

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

197 {
198  C_INT32 i = 0;
199 
200  C_INT32 TextSize = INITIALTEXTSIZE;
201  C_INT32 Printed = 0;
202 
203  while (Messages[i].No != number && Messages[i].Text)
204  i++;
205 
206  if (!Messages[i].Text)
207  fatalError();
208 
209  char *Text = NULL;
210  Text = new char[TextSize + 1];
211 
212  va_list Arguments; // = NULL;
213  va_start(Arguments, number);
214  Printed = vsnprintf(Text, TextSize, Messages[i].Text, Arguments);
215  va_end(Arguments);
216 
217  while (Printed < 0 || TextSize < Printed)
218  {
219  delete [] Text;
220 
221  (Printed < 0) ? TextSize *= 2 : TextSize = Printed;
222  Text = new char[TextSize + 1];
223 
224  va_list Arguments; // = NULL;
225  va_start(Arguments, number);
226  Printed = vsnprintf(Text, TextSize, Messages[i].Text, Arguments);
227  va_end(Arguments);
228  }
229 
230  mText = Text;
231  delete [] Text;
232 
233  mType = type;
234  mNumber = number;
235 
236  handler();
237 }
#define fatalError()
#define C_INT32
Definition: copasi.h:90
CCopasiMessage::Type mType
void handler(const bool &_throw=false)
#define INITIALTEXTSIZE
std::string mText
const MESSAGES Messages[]
Definition: messages.h:18
CCopasiMessage::~CCopasiMessage ( void  )

Destructor.

Definition at line 359 of file CCopasiMessage.cpp.

359 {}

Member Function Documentation

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

Definition at line 131 of file CCopasiMessage.cpp.

Referenced by main(), test000104::test_bug1744(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), and validate().

132 {
133  std::deque< CCopasiMessage >::const_iterator it = mMessageDeque.begin();
134  std::deque< CCopasiMessage >::const_iterator end = mMessageDeque.end();
135 
136  for (; it != end; ++it)
137  if (it->getNumber() == number) return true;
138 
139  return false;
140 }
static std::deque< CCopasiMessage > mMessageDeque
void CCopasiMessage::clearDeque ( )
static
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

Definition at line 93 of file CCopasiMessage.cpp.

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

Referenced by TaskWidget::commonBeforeRunTask(), TaskWidget::commonRunTask(), CQGLLayoutPainter::draw(), CQRDFTreeView::enterProtected(), exportSBML(), CCopasiDataModel::exportSBML(), CCopasiDataModel::exportSBMLToString(), TaskWidget::finishTask(), Arguments::handleCommandLine(), CQFittingWidget::loadTask(), main(), CQMiriamWidget::showEvent(), CopasiUI3Window::slotConvertToIrreversible(), CQTSSAWidget::slotDuration(), CQTrajectoryWidget::slotDuration(), CQExperimentData::slotExperimentChanged(), CopasiUI3Window::slotExportMathModelFinished(), CopasiUI3Window::slotFileOpenFinished(), CopasiUI3Window::slotFileSaveFinished(), TaskWidget::slotFinishThread(), CQTSSAWidget::slotIntervals(), CQTrajectoryWidget::slotIntervals(), CQTSSAWidget::slotIntervalSize(), CQTrajectoryWidget::slotIntervalSize(), CQCrossSectionTaskWidget::slotOutputConvergence(), CQCrossSectionTaskWidget::slotOutputCrossings(), CQCrossSectionTaskWidget::slotOutputDelay(), CQCrossSectionTaskWidget::slotUpdateConvergence(), CQCrossSectionTaskWidget::slotUpdateCrossings(), and validate().

94 {
95  std::string Text = "";
96  CCopasiMessage(*getMessage)() = chronological ? getFirstMessage : getLastMessage;
97 
98  while (!mMessageDeque.empty())
99  {
100  if (Text != "") Text += "\n";
101 
102  Text += getMessage().getText();
103  }
104 
105  return Text;
106 }
const std::string & getText() const
static CCopasiMessage getFirstMessage()
static std::deque< CCopasiMessage > mMessageDeque
static CCopasiMessage getLastMessage()
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

Definition at line 69 of file CCopasiMessage.cpp.

References CCopasiMessage(), MCCopasiMessage, and RAW.

Referenced by getAllMessageText().

70 {
71  if (mMessageDeque.empty())
73  MCCopasiMessage + 1);
74 
76  mMessageDeque.pop_front();
77 
78  return Message;
79 }
#define MCCopasiMessage
static std::deque< CCopasiMessage > mMessageDeque
struct MESSAGES Message
CCopasiMessage::Type CCopasiMessage::getHighestSeverity ( )
static

Retrieve highest severity of the messages in the dequeue.

Returns
const CCopasiMessage::Type & highestSeverity

Definition at line 119 of file CCopasiMessage.cpp.

References RAW.

Referenced by TaskWidget::commonRunTask(), TaskWidget::finishTask(), CFitProblem::initialize(), CQMiriamWidget::showEvent(), and TaskWidget::slotFinishThread().

120 {
121  CCopasiMessage::Type HighestSeverity = RAW;
122  std::deque< CCopasiMessage >::const_iterator it = mMessageDeque.begin();
123  std::deque< CCopasiMessage >::const_iterator end = mMessageDeque.end();
124 
125  for (; it != end; ++it)
126  if (it->getType() > HighestSeverity) HighestSeverity = it->getType();
127 
128  return HighestSeverity;
129 }
static std::deque< CCopasiMessage > mMessageDeque
CCopasiMessage CCopasiMessage::getLastMessage ( )
static

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

Returns
CCopasiMessage message

Definition at line 81 of file CCopasiMessage.cpp.

References CCopasiMessage(), MCCopasiMessage, and RAW.

Referenced by DataModelGUI::buildChangedObjects(), CFitProblem::calculate(), COptProblem::calculate(), CFitProblem::calculateCrossValidation(), CopasiUI3Window::checkPendingMessages(), CCopasiDataModel::commonAfterLoad(), CExpression::createInitialExpression(), CCopasiXMLParser::ModelParameterElement::end(), CCopasiXMLParser::ListOfModelParameterSetsElement::end(), CCopasiXMLParser::MetaboliteElement::end(), CCopasiXMLParser::CompartmentElement::end(), CCopasiXMLParser::ModelValueElement::end(), CCopasiXMLParser::EventElement::end(), CCopasiXMLParser::AssignmentElement::end(), CCopasiXMLParser::ModelElement::end(), CCopasiXMLParser::TaskElement::end(), CCopasiXMLParser::COPASIElement::end(), getAllMessageText(), handler(), CFitProblem::initialize(), CAnnotation::isValidXML(), CFunctionDB::load(), CMoietiesTask::process(), CRDFGraphConverter::SBML2Copasi(), CopasiUI3Window::slotExportSBMLToStringFinished(), FunctionWidget1::slotFcnDescriptionChanged(), CopasiUI3Window::slotFileOpenFinished(), CopasiUI3Window::slotFileSaveFinished(), CopasiUI3Window::slotImportSBMLFinished(), CopasiUI3Window::slotImportSBMLFromStringFinished(), CopasiUI3Window::slotUpdateMIRIAMFinished(), test000061::test_bug_1044(), test000047::test_delay(), test000090::test_delay_in_function(), test000082::test_export_delayAssignment_2(), test000082::test_export_delayAssignment_4(), test000082::test_export_delayAssignment_6(), test000087::test_export_reaction_flux_reference_2(), test000088::test_import_assignment_without_expression(), test000086::test_import_compartment_units_1(), test000084::test_import_compartment_units_1(), test000085::test_import_compartment_units_1(), test000083::test_import_compartment_units_1(), test000086::test_import_compartment_units_10(), test000084::test_import_compartment_units_10(), test000085::test_import_compartment_units_10(), test000083::test_import_compartment_units_10(), test000086::test_import_compartment_units_11(), test000084::test_import_compartment_units_11(), test000085::test_import_compartment_units_11(), test000083::test_import_compartment_units_11(), test000084::test_import_compartment_units_12(), test000085::test_import_compartment_units_12(), test000083::test_import_compartment_units_12(), test000084::test_import_compartment_units_13(), test000085::test_import_compartment_units_13(), test000083::test_import_compartment_units_13(), test000083::test_import_compartment_units_14(), test000084::test_import_compartment_units_14(), test000085::test_import_compartment_units_14(), test000084::test_import_compartment_units_15(), test000085::test_import_compartment_units_15(), test000083::test_import_compartment_units_15(), test000084::test_import_compartment_units_16(), test000085::test_import_compartment_units_16(), test000083::test_import_compartment_units_16(), test000083::test_import_compartment_units_17(), test000084::test_import_compartment_units_17(), test000085::test_import_compartment_units_17(), test000085::test_import_compartment_units_18(), test000084::test_import_compartment_units_18(), test000083::test_import_compartment_units_18(), test000084::test_import_compartment_units_19(), test000085::test_import_compartment_units_19(), test000083::test_import_compartment_units_19(), test000086::test_import_compartment_units_2(), test000084::test_import_compartment_units_2(), test000085::test_import_compartment_units_2(), test000083::test_import_compartment_units_2(), test000083::test_import_compartment_units_20(), test000084::test_import_compartment_units_20(), test000085::test_import_compartment_units_20(), test000083::test_import_compartment_units_21(), test000084::test_import_compartment_units_21(), test000085::test_import_compartment_units_21(), test000086::test_import_compartment_units_3(), test000084::test_import_compartment_units_3(), test000085::test_import_compartment_units_3(), test000083::test_import_compartment_units_3(), test000086::test_import_compartment_units_4(), test000085::test_import_compartment_units_4(), test000084::test_import_compartment_units_4(), test000083::test_import_compartment_units_4(), test000086::test_import_compartment_units_5(), test000084::test_import_compartment_units_5(), test000085::test_import_compartment_units_5(), test000083::test_import_compartment_units_5(), test000086::test_import_compartment_units_6(), test000085::test_import_compartment_units_6(), test000083::test_import_compartment_units_6(), test000084::test_import_compartment_units_6(), test000086::test_import_compartment_units_7(), test000084::test_import_compartment_units_7(), test000083::test_import_compartment_units_7(), test000085::test_import_compartment_units_7(), test000086::test_import_compartment_units_8(), test000084::test_import_compartment_units_8(), test000083::test_import_compartment_units_8(), test000085::test_import_compartment_units_8(), test000086::test_import_compartment_units_9(), test000084::test_import_compartment_units_9(), test000083::test_import_compartment_units_9(), test000085::test_import_compartment_units_9(), test000077::test_import_dimensionless_3(), test000077::test_import_dimensionless_4(), test000077::test_import_dimensionless_5(), test000088::test_import_eventassignment_without_expression(), test000079::test_import_fast(), test000088::test_import_initialassignment_without_expression(), test000087::test_import_reaction_flux_reference_1(), test000087::test_import_reaction_flux_reference_3(), test000062::test_kineticlaw_without_math(), test000045::test_stoichiometricExpression(), test000044::test_stoichiometricExpression(), and test000046::test_stoichiometricExpression().

82 {
83  if (mMessageDeque.empty())
85  MCCopasiMessage + 1);
86 
88  mMessageDeque.pop_back();
89 
90  return Message;
91 }
#define MCCopasiMessage
static std::deque< CCopasiMessage > mMessageDeque
struct MESSAGES Message
const size_t & CCopasiMessage::getNumber ( void  ) const

Retrieves the number of the message.

Returns
"const size_t &" mNumber

Definition at line 362 of file CCopasiMessage.cpp.

References mNumber.

Referenced by CopasiUI3Window::checkPendingMessages(), TaskWidget::commonRunTask(), CModel::load(), CReaction::setScalingFactor(), CopasiUI3Window::slotFileOpenFinished(), CopasiUI3Window::slotFileSaveFinished(), test000082::test_export_delayAssignment_2(), test000082::test_export_delayAssignment_4(), test000082::test_export_delayAssignment_6(), test000088::test_import_assignment_without_expression(), test000086::test_import_compartment_units_1(), test000084::test_import_compartment_units_1(), test000085::test_import_compartment_units_1(), test000083::test_import_compartment_units_1(), test000086::test_import_compartment_units_10(), test000085::test_import_compartment_units_10(), test000084::test_import_compartment_units_10(), test000083::test_import_compartment_units_10(), test000086::test_import_compartment_units_11(), test000085::test_import_compartment_units_11(), test000084::test_import_compartment_units_11(), test000083::test_import_compartment_units_11(), test000085::test_import_compartment_units_12(), test000084::test_import_compartment_units_12(), test000083::test_import_compartment_units_12(), test000085::test_import_compartment_units_13(), test000084::test_import_compartment_units_13(), test000083::test_import_compartment_units_13(), test000085::test_import_compartment_units_14(), test000084::test_import_compartment_units_14(), test000083::test_import_compartment_units_14(), test000085::test_import_compartment_units_15(), test000084::test_import_compartment_units_15(), test000083::test_import_compartment_units_15(), test000085::test_import_compartment_units_16(), test000084::test_import_compartment_units_16(), test000083::test_import_compartment_units_16(), test000085::test_import_compartment_units_17(), test000084::test_import_compartment_units_17(), test000083::test_import_compartment_units_17(), test000083::test_import_compartment_units_18(), test000085::test_import_compartment_units_18(), test000084::test_import_compartment_units_18(), test000083::test_import_compartment_units_19(), test000085::test_import_compartment_units_19(), test000084::test_import_compartment_units_19(), test000086::test_import_compartment_units_2(), test000083::test_import_compartment_units_2(), test000084::test_import_compartment_units_2(), test000085::test_import_compartment_units_2(), test000083::test_import_compartment_units_20(), test000085::test_import_compartment_units_20(), test000084::test_import_compartment_units_20(), test000083::test_import_compartment_units_21(), test000085::test_import_compartment_units_21(), test000084::test_import_compartment_units_21(), test000086::test_import_compartment_units_3(), test000083::test_import_compartment_units_3(), test000084::test_import_compartment_units_3(), test000085::test_import_compartment_units_3(), test000086::test_import_compartment_units_4(), test000084::test_import_compartment_units_4(), test000083::test_import_compartment_units_4(), test000085::test_import_compartment_units_4(), test000086::test_import_compartment_units_5(), test000085::test_import_compartment_units_5(), test000084::test_import_compartment_units_5(), test000083::test_import_compartment_units_5(), test000086::test_import_compartment_units_6(), test000084::test_import_compartment_units_6(), test000083::test_import_compartment_units_6(), test000085::test_import_compartment_units_6(), test000086::test_import_compartment_units_7(), test000085::test_import_compartment_units_7(), test000084::test_import_compartment_units_7(), test000083::test_import_compartment_units_7(), test000086::test_import_compartment_units_8(), test000085::test_import_compartment_units_8(), test000083::test_import_compartment_units_8(), test000084::test_import_compartment_units_8(), test000086::test_import_compartment_units_9(), test000083::test_import_compartment_units_9(), test000084::test_import_compartment_units_9(), test000085::test_import_compartment_units_9(), test000077::test_import_dimensionless_3(), test000077::test_import_dimensionless_4(), test000077::test_import_dimensionless_5(), test000088::test_import_eventassignment_without_expression(), test000079::test_import_fast(), test000088::test_import_initialassignment_without_expression(), test000087::test_import_reaction_flux_reference_1(), test000087::test_import_reaction_flux_reference_3(), and test000062::test_kineticlaw_without_math().

362 {return mNumber;}
const std::string & CCopasiMessage::getText ( void  ) const
const CCopasiMessage::Type & CCopasiMessage::getType ( void  ) const

Retrieves the type of the message.

Returns
"const CCopasiMessage::Type &" mType

Definition at line 361 of file CCopasiMessage.cpp.

References mType.

Referenced by CopasiUI3Window::checkPendingMessages(), SBMLImporter::importEvents(), SBMLImporter::importInitialAssignments(), CQFittingWidget::loadTask(), test000090::test_delay_in_function(), and test000062::test_kineticlaw_without_math().

361 {return mType;}
CCopasiMessage::Type mType
void CCopasiMessage::handler ( const bool &  _throw = false)
private

The actual constructor of a message.

Parameters
constbool & throw (default: false)
textmessage text

Definition at line 239 of file CCopasiMessage.cpp.

References COMMANDLINE, COMMANDLINE_FILTERED, COptions::compareValue(), ERROR, ERROR_FILTERED, EXCEPTION, EXCEPTION_FILTERED, getLastMessage(), IsGUI, lineBreak(), LocalTimeStamp(), MCCopasiMessage, mNumber, mText, mType, RAW, RAW_FILTERED, TRACE, TRACE_FILTERED, WARNING, and WARNING_FILTERED.

Referenced by CCopasiMessage().

240 {
241  std::string Text = mText;
242 
243  switch (mType)
244  {
245  case RAW:
246  mText = "";
247  break;
248 
249  case TRACE:
250  mText = ">TRACE ";
251  mText += LocalTimeStamp();
252  mText += "<\n";
253  break;
254 
255  case WARNING:
256  mText = ">WARNING ";
257  mText += LocalTimeStamp();
258  mText += "<\n";
259  break;
260 
261  case COMMANDLINE:
262  if (IsGUI)
263  {
264  mText = ">WARNING ";
265  }
266  else
267  {
268  mText = ">ERROR ";
269  }
270 
271  mText += LocalTimeStamp();
272  mText += "<\n";
273  break;
274 
275  case ERROR:
276  mText = ">ERROR ";
277  mText += LocalTimeStamp();
278  mText += "<\n";
279  break;
280 
281  case EXCEPTION:
282  mText = ">EXCEPTION ";
283  mText += LocalTimeStamp();
284  mText += "<\n";
285  break;
286 
287  case RAW_FILTERED:
288  mText = ">RAW(filtered) ";
289  mText += LocalTimeStamp();
290  mText += "<\n";
291  break;
292 
293  case TRACE_FILTERED:
294  mText = ">TRACE(filtered) ";
295  mText += LocalTimeStamp();
296  mText += "<\n";
297  break;
298 
300  mText = ">COMMANDLINE(filtered) ";
301  mText += LocalTimeStamp();
302  mText += "<\n";
303  break;
304 
305  case WARNING_FILTERED:
306  mText = ">WARNING(filtered) ";
307  mText += LocalTimeStamp();
308  mText += "<\n";
309  break;
310 
311  case ERROR_FILTERED:
312  mText = ">ERROR(filtered) ";
313  mText += LocalTimeStamp();
314  mText += "<\n";
315  break;
316 
317  case EXCEPTION_FILTERED:
318  mText = ">EXCEPTION(filtered) ";
319  mText += LocalTimeStamp();
320  mText += "<\n";
321  break;
322  }
323 
324  mText += Text;
325 
326  if (mType != RAW) lineBreak();
327 
328  // Remove the message: No more messages.
329  if (mMessageDeque.size() == 1 &&
330  mMessageDeque.back().getNumber() == MCCopasiMessage + 1)
331  getLastMessage();
332 
333  mMessageDeque.push_back(*this);
334 
335  // All messages are printed to std::cerr
336  if (COptions::compareValue("Verbose", true) &&
337  mNumber != MCCopasiMessage + 1)
338  {
339  std::cerr << mText << std::endl;
340 
341 #ifdef COPASI_DEBUG_TRACE
342  DebugFile << mText << std::endl;
343 #endif // COPASI_DEBUG_TRACE
344  }
345 
346  if (mType == EXCEPTION)
347  throw CCopasiException(*this);
348 }
std::string LocalTimeStamp()
Definition: utility.cpp:53
static bool IsGUI
CCopasiMessage::Type mType
#define MCCopasiMessage
static std::deque< CCopasiMessage > mMessageDeque
static bool compareValue(const std::string &name, const CType &value)
Definition: COptions.h:128
std::string mText
static CCopasiMessage getLastMessage()
void CCopasiMessage::lineBreak ( )
private

Inserts line breaks in the message text.

Definition at line 364 of file CCopasiMessage.cpp.

References mText.

Referenced by handler().

365 {
366  std::string Search("\n");
367  std::string Replace("\n ");
368  std::string::size_type pos = 0;
369 
370  while (true)
371  {
372  pos = mText.find(Search, pos);
373 
374  if (pos == std::string::npos)
375  break;
376 
377  mText.replace(pos, Search.length(), Replace);
378 
379  pos += Replace.length();
380  }
381 }
std::string mText
CCopasiMessage & CCopasiMessage::operator= ( const CCopasiMessage RHS)

Assignment operator.

Definition at line 351 of file CCopasiMessage.cpp.

References mNumber, mText, and mType.

352 {
353  mText = RHS.mText;
354  mType = RHS.mType;
355  mNumber = RHS.mNumber;
356 
357  return *this;
358 }
CCopasiMessage::Type mType
std::string mText
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

Definition at line 51 of file CCopasiMessage.cpp.

References CCopasiMessage(), MCCopasiMessage, and RAW.

52 {
53  if (mMessageDeque.empty())
55  MCCopasiMessage + 1);
56 
57  return mMessageDeque.front();
58 }
#define MCCopasiMessage
static std::deque< CCopasiMessage > mMessageDeque
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

Definition at line 60 of file CCopasiMessage.cpp.

References CCopasiMessage(), MCCopasiMessage, and RAW.

Referenced by TaskWidget::commonRunTask(), SBMLImporter::createCModelFromSBMLDocument(), CQGLLayoutPainter::draw(), TaskWidget::finishTask(), SBMLImporter::importEvent(), SBMLImporter::importEvents(), SBMLImporter::importFunctionDefinitions(), SBMLImporter::importInitialAssignments(), CFitProblem::initialize(), CFunctionDB::load(), CQFittingWidget::loadTask(), CopasiUI3Window::slotExportMathModelFinished(), FunctionWidget1::slotFcnDescriptionChanged(), and CopasiUI3Window::slotFileSaveFinished().

61 {
62  if (mMessageDeque.empty())
64  MCCopasiMessage + 1);
65 
66  return mMessageDeque.back();
67 }
#define MCCopasiMessage
static std::deque< CCopasiMessage > mMessageDeque
void CCopasiMessage::setIsGUI ( const bool &  isGUI)
static

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

Parameters
constbool & isGUI

Definition at line 143 of file CCopasiMessage.cpp.

References IsGUI.

Referenced by CCopasiRootContainer::init().

144 {
145  IsGUI = isGUI;
146 }
static bool IsGUI
size_t CCopasiMessage::size ( )
static

Retrieve the size of the dequeue

Returns
size_t size

Definition at line 114 of file CCopasiMessage.cpp.

Referenced by CCopasiDataModel::commonAfterLoad(), CExpression::createInitialExpression(), CCopasiXMLParser::ModelParameterElement::end(), CCopasiXMLParser::ListOfModelParameterSetsElement::end(), CCopasiXMLParser::MetaboliteElement::end(), CCopasiXMLParser::CompartmentElement::end(), CCopasiXMLParser::ModelValueElement::end(), CCopasiXMLParser::EventElement::end(), CCopasiXMLParser::AssignmentElement::end(), CCopasiXMLParser::ModelElement::end(), CQRDFTreeView::enterProtected(), CODEExporterXPPAUT::exportSingleLine(), CAnnotation::isValidXML(), CMoietiesTask::process(), CRDFGraphConverter::SBML2Copasi(), CQMiriamWidget::showEvent(), CQExperimentData::slotExperimentChanged(), TaskWidget::slotFinishThread(), test000089::test_bug1412(), test000104::test_bug1744(), test000061::test_bug_1044(), test000082::test_export_delayAssignment_2(), test000082::test_export_delayAssignment_4(), test000082::test_export_delayAssignment_6(), test000087::test_export_reaction_flux_reference_1(), test000087::test_export_reaction_flux_reference_2(), test000088::test_import_assignment_without_expression(), test000086::test_import_compartment_units_1(), test000085::test_import_compartment_units_1(), test000084::test_import_compartment_units_1(), test000083::test_import_compartment_units_1(), test000086::test_import_compartment_units_10(), test000083::test_import_compartment_units_10(), test000085::test_import_compartment_units_10(), test000084::test_import_compartment_units_10(), test000086::test_import_compartment_units_11(), test000083::test_import_compartment_units_11(), test000085::test_import_compartment_units_11(), test000084::test_import_compartment_units_11(), test000083::test_import_compartment_units_12(), test000085::test_import_compartment_units_12(), test000084::test_import_compartment_units_12(), test000083::test_import_compartment_units_13(), test000085::test_import_compartment_units_13(), test000084::test_import_compartment_units_13(), test000085::test_import_compartment_units_14(), test000083::test_import_compartment_units_14(), test000084::test_import_compartment_units_14(), test000083::test_import_compartment_units_15(), test000085::test_import_compartment_units_15(), test000084::test_import_compartment_units_15(), test000084::test_import_compartment_units_16(), test000083::test_import_compartment_units_16(), test000085::test_import_compartment_units_16(), test000084::test_import_compartment_units_17(), test000083::test_import_compartment_units_17(), test000085::test_import_compartment_units_17(), test000084::test_import_compartment_units_18(), test000083::test_import_compartment_units_18(), test000085::test_import_compartment_units_18(), test000084::test_import_compartment_units_19(), test000085::test_import_compartment_units_19(), test000083::test_import_compartment_units_19(), test000086::test_import_compartment_units_2(), test000085::test_import_compartment_units_2(), test000084::test_import_compartment_units_2(), test000083::test_import_compartment_units_2(), test000084::test_import_compartment_units_20(), test000083::test_import_compartment_units_20(), test000085::test_import_compartment_units_20(), test000084::test_import_compartment_units_21(), test000085::test_import_compartment_units_21(), test000083::test_import_compartment_units_21(), test000086::test_import_compartment_units_3(), test000085::test_import_compartment_units_3(), test000084::test_import_compartment_units_3(), test000083::test_import_compartment_units_3(), test000086::test_import_compartment_units_4(), test000085::test_import_compartment_units_4(), test000084::test_import_compartment_units_4(), test000083::test_import_compartment_units_4(), test000086::test_import_compartment_units_5(), test000084::test_import_compartment_units_5(), test000085::test_import_compartment_units_5(), test000083::test_import_compartment_units_5(), test000086::test_import_compartment_units_6(), test000085::test_import_compartment_units_6(), test000083::test_import_compartment_units_6(), test000084::test_import_compartment_units_6(), test000086::test_import_compartment_units_7(), test000083::test_import_compartment_units_7(), test000085::test_import_compartment_units_7(), test000084::test_import_compartment_units_7(), test000086::test_import_compartment_units_8(), test000084::test_import_compartment_units_8(), test000083::test_import_compartment_units_8(), test000085::test_import_compartment_units_8(), test000086::test_import_compartment_units_9(), test000083::test_import_compartment_units_9(), test000084::test_import_compartment_units_9(), test000085::test_import_compartment_units_9(), test000077::test_import_dimensionless_3(), test000077::test_import_dimensionless_4(), test000077::test_import_dimensionless_5(), test000088::test_import_eventassignment_without_expression(), test000079::test_import_fast(), test000088::test_import_initialassignment_without_expression(), test000087::test_import_reaction_flux_reference_1(), test000087::test_import_reaction_flux_reference_3(), and test000062::test_kineticlaw_without_math().

115 {
116  return mMessageDeque.size();
117 }
static std::deque< CCopasiMessage > mMessageDeque

Member Data Documentation

bool CCopasiMessage::IsGUI = false
staticprivate

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

Definition at line 132 of file CCopasiMessage.h.

Referenced by handler(), and setIsGUI().

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.

Definition at line 125 of file CCopasiMessage.h.

size_t CCopasiMessage::mNumber
private

Message Number

Definition at line 118 of file CCopasiMessage.h.

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

std::string CCopasiMessage::mText
private

Message text.

Definition at line 108 of file CCopasiMessage.h.

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

CCopasiMessage::Type CCopasiMessage::mType
private

Message type.

Definition at line 113 of file CCopasiMessage.h.

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


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