external_packages/qpOASES-3.0beta/src/MessageHandling.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  * Copyright (C) 2007-2011 by Hans Joachim Ferreau, Andreas Potschka,
6  * Christian Kirches et al. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
36 #include <stdio.h>
37 
38 #ifdef __MATLAB__
39  #include "mex.h"
40 #endif
41 
42 #include <qpOASES/MessageHandling.hpp>
43 #include <qpOASES/Utils.hpp>
44 
45 
47 
48 
49 
52 {
53 /* miscellaneous */
54 { SUCCESSFUL_RETURN, "Successful return", VS_VISIBLE },
55 { RET_DIV_BY_ZERO, "Division by zero", VS_VISIBLE },
56 { RET_INDEX_OUT_OF_BOUNDS, "Index out of bounds", VS_VISIBLE },
57 { RET_INVALID_ARGUMENTS, "At least one of the arguments is invalid", VS_VISIBLE },
58 { RET_ERROR_UNDEFINED, "Error number undefined", VS_VISIBLE },
59 { RET_WARNING_UNDEFINED, "Warning number undefined", VS_VISIBLE },
60 { RET_INFO_UNDEFINED, "Info number undefined", VS_VISIBLE },
61 { RET_EWI_UNDEFINED, "Error/warning/info number undefined", VS_VISIBLE },
62 { RET_AVAILABLE_WITH_LINUX_ONLY, "This function is available under Linux only", VS_HIDDEN },
63 { RET_UNKNOWN_BUG, "The error occured is not yet known", VS_VISIBLE },
64 { RET_PRINTLEVEL_CHANGED, "Print level changed", VS_VISIBLE },
65 { RET_NOT_YET_IMPLEMENTED, "Requested function is not yet implemented.", VS_VISIBLE },
66 /* Indexlist */
67 { RET_INDEXLIST_MUST_BE_REORDERD, "Index list has to be reordered", VS_VISIBLE },
68 { RET_INDEXLIST_EXCEEDS_MAX_LENGTH, "Index list exceeds its maximal physical length", VS_VISIBLE },
69 { RET_INDEXLIST_CORRUPTED, "Index list corrupted", VS_VISIBLE },
70 { RET_INDEXLIST_OUTOFBOUNDS, "Physical index is out of bounds", VS_VISIBLE },
71 { RET_INDEXLIST_ADD_FAILED, "Adding indices from another index set failed", VS_VISIBLE },
72 { RET_INDEXLIST_INTERSECT_FAILED, "Intersection with another index set failed", VS_VISIBLE },
73 /* SubjectTo / Bounds / Constraints */
74 { RET_INDEX_ALREADY_OF_DESIRED_STATUS, "Index is already of desired status", VS_VISIBLE },
75 { RET_ADDINDEX_FAILED, "Adding index to index set failed", VS_VISIBLE },
76 { RET_REMOVEINDEX_FAILED, "Removing index from index set failed", VS_VISIBLE },
77 { RET_SWAPINDEX_FAILED, "Cannot swap between different indexsets", VS_VISIBLE },
78 { RET_NOTHING_TO_DO, "Nothing to do", VS_VISIBLE },
79 { RET_SETUP_BOUND_FAILED, "Setting up bound index failed", VS_VISIBLE },
80 { RET_SETUP_CONSTRAINT_FAILED, "Setting up constraint index failed", VS_VISIBLE },
81 { RET_MOVING_BOUND_FAILED, "Moving bound between index sets failed", VS_VISIBLE },
82 { RET_MOVING_CONSTRAINT_FAILED, "Moving constraint between index sets failed", VS_VISIBLE },
83 { RET_SHIFTING_FAILED, "Shifting of bounds/constraints failed", VS_VISIBLE },
84 { RET_ROTATING_FAILED, "Rotating of bounds/constraints failed", VS_VISIBLE },
85 /* QProblem */
86 { RET_QPOBJECT_NOT_SETUP, "The QP object has not been setup correctly, use another constructor", VS_VISIBLE },
87 { RET_QP_ALREADY_INITIALISED, "QProblem has already been initialised", VS_VISIBLE },
88 { RET_NO_INIT_WITH_STANDARD_SOLVER, "Initialisation via extern QP solver is not yet implemented", VS_VISIBLE },
89 { RET_RESET_FAILED, "Reset failed", VS_VISIBLE },
90 { RET_INIT_FAILED, "Initialisation failed", VS_VISIBLE },
91 { RET_INIT_FAILED_TQ, "Initialisation failed due to TQ factorisation", VS_VISIBLE },
92 { RET_INIT_FAILED_CHOLESKY, "Initialisation failed due to Cholesky decomposition", VS_VISIBLE },
93 { RET_INIT_FAILED_HOTSTART, "Initialisation failed! QP could not be solved!", VS_VISIBLE },
94 { RET_INIT_FAILED_INFEASIBILITY, "Initial QP could not be solved due to infeasibility!", VS_VISIBLE },
95 { RET_INIT_FAILED_UNBOUNDEDNESS, "Initial QP could not be solved due to unboundedness!", VS_VISIBLE },
96 { RET_INIT_FAILED_REGULARISATION, "Initialisation failed as Hessian matrix could not be regularised", VS_VISIBLE },
97 { RET_INIT_SUCCESSFUL, "Initialisation done", VS_VISIBLE },
98 { RET_OBTAINING_WORKINGSET_FAILED, "Failed to obtain working set for auxiliary QP", VS_VISIBLE },
99 { RET_SETUP_WORKINGSET_FAILED, "Failed to setup working set for auxiliary QP", VS_VISIBLE },
100 { RET_SETUP_AUXILIARYQP_FAILED, "Failed to setup auxiliary QP for initialised homotopy", VS_VISIBLE },
101 { RET_NO_EXTERN_SOLVER, "No extern QP solver available", VS_VISIBLE },
102 { RET_QP_UNBOUNDED, "QP is unbounded", VS_VISIBLE },
103 { RET_QP_INFEASIBLE, "QP is infeasible", VS_VISIBLE },
104 { RET_QP_NOT_SOLVED, "Problems occured while solving QP with standard solver", VS_VISIBLE },
105 { RET_QP_SOLVED, "QP successfully solved", VS_VISIBLE },
106 { RET_UNABLE_TO_SOLVE_QP, "Problems occured while solving QP", VS_VISIBLE },
107 { RET_INITIALISATION_STARTED, "Starting problem initialisation...", VS_VISIBLE },
108 { RET_HOTSTART_FAILED, "Unable to perform homotopy due to internal error", VS_VISIBLE },
109 { RET_HOTSTART_FAILED_TO_INIT, "Unable to initialise problem", VS_VISIBLE },
110 { RET_HOTSTART_FAILED_AS_QP_NOT_INITIALISED, "Unable to perform homotopy as previous QP is not solved", VS_VISIBLE },
111 { RET_ITERATION_STARTED, "Iteration", VS_VISIBLE },
112 { RET_SHIFT_DETERMINATION_FAILED, "Determination of shift of the QP data failed", VS_VISIBLE },
113 { RET_STEPDIRECTION_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE },
114 { RET_STEPLENGTH_DETERMINATION_FAILED, "Determination of step direction failed", VS_VISIBLE },
115 { RET_OPTIMAL_SOLUTION_FOUND, "Optimal solution of neighbouring QP found", VS_VISIBLE },
116 { RET_HOMOTOPY_STEP_FAILED, "Unable to perform homotopy step", VS_VISIBLE },
117 { RET_HOTSTART_STOPPED_INFEASIBILITY, "Premature homotopy termination because QP is infeasible", VS_VISIBLE },
118 { RET_HOTSTART_STOPPED_UNBOUNDEDNESS, "Premature homotopy termination because QP is unbounded", VS_VISIBLE },
119 { RET_WORKINGSET_UPDATE_FAILED, "Unable to update working sets according to initial guesses", VS_VISIBLE },
120 { RET_MAX_NWSR_REACHED, "Maximum number of working set recalculations performed", VS_VISIBLE },
121 { RET_CONSTRAINTS_NOT_SPECIFIED, "Problem does comprise constraints! You have to specify new constraints' bounds", VS_VISIBLE },
122 { RET_INVALID_FACTORISATION_FLAG, "Invalid factorisation flag", VS_VISIBLE },
123 { RET_UNABLE_TO_SAVE_QPDATA, "Unable to save QP data", VS_VISIBLE },
124 { RET_STEPDIRECTION_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE },
125 { RET_STEPDIRECTION_FAILED_CHOLESKY, "Abnormal termination due to Cholesky factorisation", VS_VISIBLE },
126 { RET_CYCLING_DETECTED, "Cycling detected", VS_VISIBLE },
127 { RET_CYCLING_NOT_RESOLVED, "Cycling cannot be resolved, QP is probably infeasible", VS_VISIBLE },
128 { RET_CYCLING_RESOLVED, "Cycling probably resolved", VS_VISIBLE },
129 { RET_STEPSIZE, "", VS_VISIBLE },
130 { RET_STEPSIZE_NONPOSITIVE, "", VS_VISIBLE },
131 { RET_SETUPSUBJECTTOTYPE_FAILED, "Setup of SubjectToTypes failed", VS_VISIBLE },
132 { RET_ADDCONSTRAINT_FAILED, "Addition of constraint to working set failed", VS_VISIBLE },
133 { RET_ADDCONSTRAINT_FAILED_INFEASIBILITY, "Addition of constraint to working set failed", VS_VISIBLE },
134 { RET_ADDBOUND_FAILED, "Addition of bound to working set failed", VS_VISIBLE },
135 { RET_ADDBOUND_FAILED_INFEASIBILITY, "Addition of bound to working set failed", VS_VISIBLE },
136 { RET_REMOVECONSTRAINT_FAILED, "Removal of constraint from working set failed", VS_VISIBLE },
137 { RET_REMOVEBOUND_FAILED, "Removal of bound from working set failed", VS_VISIBLE },
138 { RET_REMOVE_FROM_ACTIVESET, "Removing from active set:", VS_VISIBLE },
139 { RET_ADD_TO_ACTIVESET, "Adding to active set:", VS_VISIBLE },
140 { RET_REMOVE_FROM_ACTIVESET_FAILED, "Removing from active set failed", VS_VISIBLE },
141 { RET_ADD_TO_ACTIVESET_FAILED, "Adding to active set failed", VS_VISIBLE },
142 { RET_CONSTRAINT_ALREADY_ACTIVE, "Constraint is already active", VS_VISIBLE },
143 { RET_ALL_CONSTRAINTS_ACTIVE, "All constraints are active, no further constraint can be added", VS_VISIBLE },
144 { RET_LINEARLY_DEPENDENT, "New bound/constraint is linearly dependent", VS_VISIBLE },
145 { RET_LINEARLY_INDEPENDENT, "New bound/constraint is linearly independent", VS_VISIBLE },
146 { RET_LI_RESOLVED, "Linear indepence of active contraint matrix successfully resolved", VS_VISIBLE },
147 { RET_ENSURELI_FAILED, "Failed to ensure linear indepence of active contraint matrix", VS_VISIBLE },
148 { RET_ENSURELI_FAILED_TQ, "Abnormal termination due to TQ factorisation", VS_VISIBLE },
149 { RET_ENSURELI_FAILED_NOINDEX, "QP is infeasible", VS_VISIBLE },
150 { RET_ENSURELI_FAILED_CYCLING, "QP is infeasible", VS_VISIBLE },
151 { RET_BOUND_ALREADY_ACTIVE, "Bound is already active", VS_VISIBLE },
152 { RET_ALL_BOUNDS_ACTIVE, "All bounds are active, no further bound can be added", VS_VISIBLE },
153 { RET_CONSTRAINT_NOT_ACTIVE, "Constraint is not active", VS_VISIBLE },
154 { RET_BOUND_NOT_ACTIVE, "Bound is not active", VS_VISIBLE },
155 { RET_HESSIAN_NOT_SPD, "Projected Hessian matrix not positive definite", VS_VISIBLE },
156 { RET_HESSIAN_INDEFINITE, "Hessian matrix is indefinite", VS_VISIBLE },
157 { RET_MATRIX_SHIFT_FAILED, "Unable to update matrices or to transform vectors", VS_VISIBLE },
158 { RET_MATRIX_FACTORISATION_FAILED, "Unable to calculate new matrix factorisations", VS_VISIBLE },
159 { RET_PRINT_ITERATION_FAILED, "Unable to print information on current iteration", VS_VISIBLE },
160 { RET_NO_GLOBAL_MESSAGE_OUTPUTFILE, "No global message output file initialised", VS_VISIBLE },
161 { RET_DISABLECONSTRAINTS_FAILED, "Unable to disbable constraints", VS_VISIBLE },
162 { RET_ENABLECONSTRAINTS_FAILED, "Unable to enable constraints", VS_VISIBLE },
163 { RET_ALREADY_ENABLED, "Bound or constraint is already enabled", VS_VISIBLE },
164 { RET_ALREADY_DISABLED, "Bound or constraint is already disabled", VS_VISIBLE },
165 { RET_NO_HESSIAN_SPECIFIED, "No Hessian matrix has been specified", VS_VISIBLE },
166 { RET_USING_REGULARISATION, "Using regularisation as Hessian matrix is not positive definite", VS_VISIBLE },
167 { RET_EPS_MUST_BE_POSITVE, "Eps for regularisation must be sufficiently positive", VS_VISIBLE },
168 { RET_REGSTEPS_MUST_BE_POSITVE, "Maximum number of regularisation steps must be non-negative", VS_VISIBLE },
169 { RET_HESSIAN_ALREADY_REGULARISED, "Hessian has been already regularised", VS_VISIBLE },
170 { RET_CANNOT_REGULARISE_IDENTITY, "Identity Hessian matrix cannot be regularised", VS_VISIBLE },
171 { RET_CANNOT_REGULARISE_SPARSE, "Sparse matrix cannot be regularised as diagonal entry is missing", VS_VISIBLE },
172 { RET_NO_REGSTEP_NWSR, "No additional regularisation step could be performed due to limits", VS_VISIBLE },
173 { RET_FEWER_REGSTEPS_NWSR, "Fewer additional regularisation steps have been performed due to limits", VS_VISIBLE },
174 { RET_CHOLESKY_OF_ZERO_HESSIAN, "Cholesky decomposition of (unregularised) zero Hessian matrix", VS_VISIBLE },
175 { RET_CONSTRAINTS_ARE_NOT_SCALED, "When defining __MANY_CONSTRAINTS__, l1 norm of each constraint must be not greater than one", VS_VISIBLE },
176 { RET_ERROR_IN_CONSTRAINTPRODUCT, "Error in user-defined constraint product function", VS_VISIBLE },
177 /* SQProblem */
178 { RET_UPDATEMATRICES_FAILED, "Unable to update QP matrices", VS_VISIBLE },
179 { RET_UPDATEMATRICES_FAILED_AS_QP_NOT_SOLVED, "Unable to update matrices as previous QP is not solved", VS_VISIBLE },
180 /* Utils */
181 { RET_UNABLE_TO_OPEN_FILE, "Unable to open file", VS_VISIBLE },
182 { RET_UNABLE_TO_WRITE_FILE, "Unable to write into file", VS_VISIBLE },
183 { RET_UNABLE_TO_READ_FILE, "Unable to read from file", VS_VISIBLE },
184 { RET_FILEDATA_INCONSISTENT, "File contains inconsistent data", VS_VISIBLE },
185 /* SolutionAnalysis */
186 { RET_UNABLE_TO_ANALYSE_QPROBLEM, "Unable to analyse (S)QProblem(B) object", VS_VISIBLE },
187 /* Benchmark */
188 { RET_NWSR_SET_TO_ONE, "Maximum number of working set changes was set to 1", VS_VISIBLE },
189 { RET_UNABLE_TO_READ_BENCHMARK, "Unable to read benchmark data", VS_VISIBLE },
190 { RET_BENCHMARK_ABORTED, "Benchmark aborted", VS_VISIBLE },
191 { RET_INITIAL_QP_SOLVED, "Initial QP solved", VS_VISIBLE },
192 { RET_QP_SOLUTION_STARTED, "Solving QP no.", VS_VISIBLE },
193 { RET_BENCHMARK_SUCCESSFUL, "Benchmark terminated successfully", VS_VISIBLE },
194 { TERMINAL_LIST_ELEMENT, "", VS_HIDDEN } /* IMPORTANT: Terminal list element! */
195 };
196 
197 
198 
199 /*****************************************************************************
200  * P U B L I C *
201  *****************************************************************************/
202 
203 /*
204  * M e s s a g e H a n d l i n g
205  */
207 {
211 
212  outputFile = stdout;
213  errorCount = 0;
214 }
215 
216 /*
217  * M e s s a g e H a n d l i n g
218  */
220 {
224 
225  outputFile = _outputFile;
226  errorCount = 0;
227 }
228 
229 /*
230  * M e s s a g e H a n d l i n g
231  */
233  VisibilityStatus _warningVisibility,
234  VisibilityStatus _infoVisibility
235  )
236 {
237  errorVisibility = _errorVisibility;
238  warningVisibility = _warningVisibility;
239  infoVisibility = _infoVisibility;
240 
241  outputFile = stderr;
242  errorCount = 0;
243 }
244 
245 /*
246  * M e s s a g e H a n d l i n g
247  */
249  VisibilityStatus _errorVisibility,
250  VisibilityStatus _warningVisibility,
251  VisibilityStatus _infoVisibility
252  )
253 {
254  errorVisibility = _errorVisibility;
255  warningVisibility = _warningVisibility;
256  infoVisibility = _infoVisibility;
257 
258  outputFile = _outputFile;
259  errorCount = 0;
260 }
261 
262 
263 
264 /*
265  * M e s s a g e H a n d l i n g
266  */
268 {
272 
273  outputFile = rhs.outputFile;
274  errorCount = rhs.errorCount;
275 }
276 
277 
278 /*
279  * ~ M e s s a g e H a n d l i n g
280  */
282 {
283  if ( outputFile != 0 )
284  fclose( outputFile );
285 }
286 
287 
288 /*
289  * o p e r a t o r =
290  */
292 {
293  if ( this != &rhs )
294  {
298 
299  outputFile = rhs.outputFile;
300  errorCount = rhs.errorCount;
301  }
302 
303  return *this;
304 }
305 
306 
307 /*
308  * t h r o w E r r o r
309  */
311  returnValue Enumber,
312  const char* additionaltext,
313  const char* functionname,
314  const char* filename,
315  const unsigned long linenumber,
316  VisibilityStatus localVisibilityStatus
317  )
318 {
319  /* consistency check */
320  if ( Enumber <= SUCCESSFUL_RETURN )
322 
323  /* Call to common throwMessage function if error shall be displayed. */
324  if ( errorVisibility == VS_VISIBLE )
325  return throwMessage( Enumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"ERROR" );
326  else
327  return Enumber;
328 }
329 
330 
331 /*
332  * t h r o w W a r n i n g
333  */
335  returnValue Wnumber,
336  const char* additionaltext,
337  const char* functionname,
338  const char* filename,
339  const unsigned long linenumber,
340  VisibilityStatus localVisibilityStatus
341  )
342 {
343  /* consistency check */
344  if ( Wnumber <= SUCCESSFUL_RETURN )
346 
347  /* Call to common throwMessage function if warning shall be displayed. */
348  if ( warningVisibility == VS_VISIBLE )
349  return throwMessage( Wnumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"WARNING" );
350  else
351  return Wnumber;
352 }
353 
354 
355 /*
356  * t h r o w I n f o
357  */
359  returnValue Inumber,
360  const char* additionaltext,
361  const char* functionname,
362  const char* filename,
363  const unsigned long linenumber,
364  VisibilityStatus localVisibilityStatus
365  )
366 {
367  /* consistency check */
368  if ( Inumber < SUCCESSFUL_RETURN )
370 
371  /* Call to common throwMessage function if info shall be displayed. */
372  if ( infoVisibility == VS_VISIBLE )
373  return throwMessage( Inumber,additionaltext,functionname,filename,linenumber,localVisibilityStatus,"INFO" );
374  else
375  return Inumber;
376 }
377 
378 
379 /*
380  * r e s e t
381  */
383 {
387 
388  setOutputFile( stderr );
389  setErrorCount( 0 );
390 
391  return SUCCESSFUL_RETURN;
392 }
393 
394 
395 /*
396  * l i s t A l l M e s s a g e s
397  */
399 {
400  #ifndef __XPCTARGET__
401  int keypos = 0;
402  char myPrintfString[160];
403 
404  /* Run through whole returnValueList and print each item. */
405  while ( returnValueList[keypos].key != TERMINAL_LIST_ELEMENT )
406  {
407  snprintf( myPrintfString,160," %d - %s \n",keypos,returnValueList[keypos].data );
408  myPrintf( myPrintfString );
409 
410  ++keypos;
411  }
412  #endif
413 
414  return SUCCESSFUL_RETURN;
415 }
416 
417 
418 
419 /*****************************************************************************
420  * P R O T E C T E D *
421  *****************************************************************************/
422 
423 
424 /*
425  * t h r o w M e s s a g e
426  */
428  returnValue RETnumber,
429  const char* additionaltext,
430  const char* functionname,
431  const char* filename,
432  const unsigned long linenumber,
433  VisibilityStatus localVisibilityStatus,
434  const char* RETstring
435  )
436 {
437  #ifndef __SUPPRESSANYOUTPUT__
438  #ifndef __XPCTARGET__
439  int keypos = 0;
440  char myPrintfString[160];
441 
442  /* 1) Determine number of whitespace for output. */
443  char whitespaces[41];
444  int numberOfWhitespaces = (errorCount-1)*2;
445 
446  if ( numberOfWhitespaces < 0 )
447  numberOfWhitespaces = 0;
448 
449  if ( numberOfWhitespaces > 40 )
450  numberOfWhitespaces = 40;
451 
452  memset( whitespaces, ' ', (size_t) numberOfWhitespaces );
453  whitespaces[numberOfWhitespaces] = '\0';
454 
455  /* 2) Find error/warning/info in list. */
456  while ( returnValueList[keypos].key != TERMINAL_LIST_ELEMENT )
457  {
458  if ( returnValueList[keypos].key == RETnumber )
459  break;
460  else
461  ++keypos;
462  }
463 
464  if ( returnValueList[keypos].key == TERMINAL_LIST_ELEMENT )
465  {
467  return RETnumber;
468  }
469 
470  /* 3) Print error/warning/info. */
471  if ( ( returnValueList[keypos].globalVisibilityStatus == VS_VISIBLE ) && ( localVisibilityStatus == VS_VISIBLE ) )
472  {
473 
474  if ( errorCount > 0 )
475  {
476  snprintf( myPrintfString,160,"%s->", whitespaces );
477  myPrintf( myPrintfString );
478  }
479 
480  if ( additionaltext == 0 )
481  {
482  #ifdef __DEBUG__
483  snprintf( myPrintfString,160,"%s (%s, %s:%d): \t%s\n",
484  RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data
485  );
486  #else
487  snprintf( myPrintfString,160,"%s: %s\n",
488  RETstring,returnValueList[keypos].data
489  );
490  #endif
491  myPrintf( myPrintfString );
492  }
493  else
494  {
495  #ifdef __DEBUG__
496  snprintf( myPrintfString,160,"%s (%s, %s:%d): \t%s %s\n",
497  RETstring,functionname,filename,(int)linenumber,returnValueList[keypos].data,additionaltext
498  );
499  #else
500  snprintf( myPrintfString,160,"%s: %s %s\n",
501  RETstring,returnValueList[keypos].data,additionaltext
502  );
503  #endif
504  myPrintf( myPrintfString );
505  }
506 
507  /* take care of proper indention for subsequent error messages */
508  if ( RETstring[0] == 'E' )
509  {
510  ++errorCount;
511  }
512  else
513  {
514  if ( errorCount > 0 )
515  myPrintf( "\n" );
516  errorCount = 0;
517  }
518  }
519  #endif /* __XPCTARGET__ */
520  #endif /* __SUPPRESSANYOUTPUT__ */
521 
522  return RETnumber;
523 }
524 
525 /****************************************************************************/
526 /* S T A T I C P U B L I C */
527 /****************************************************************************/
528 
529 const char* MessageHandling::getErrorCodeMessage( const returnValue _returnValue
530  )
531 {
532  int keypos = 0;
533 
534  /* 2) Find error/warning/info in list. */
535  while ( returnValueList[keypos].key != TERMINAL_LIST_ELEMENT )
536  {
537  if ( returnValueList[keypos].key == _returnValue )
538  break;
539  else
540  ++keypos;
541  }
542 
543  if ( returnValueList[keypos].key == TERMINAL_LIST_ELEMENT )
544  {
545  return "Unknown error code";
546  }
547 
548  return (returnValueList[keypos].data != 0) ? returnValueList[keypos].data : "No message for this error code";
549 }
550 
551 
552 /*****************************************************************************
553  * G L O B A L M E S S A G E H A N D L E R *
554  *****************************************************************************/
555 
556 
559 
560 
561 /*
562  * g e t G l o b a l M e s s a g e H a n d l e r
563  */
565 {
566  return &globalMessageHandler;
567 }
568 
569 
571 
572 
573 /*
574  * end of file
575  */
#define __LINE__
returnValue throwError(returnValue Enumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
returnValue throwInfo(returnValue Inumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
Allows to pass back messages to the calling function.
void setOutputFile(myFILE *_outputFile)
#define __FUNCTION__
returnValue throwWarning(returnValue Wnumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus)
returnValue myPrintf(const char *s)
static const char * getErrorCodeMessage(const returnValue _returnValue)
BEGIN_NAMESPACE_QPOASES MessageHandling::ReturnValueList returnValueList[]
void setInfoVisibilityStatus(VisibilityStatus _infoVisibility)
returnValue setErrorCount(int _errorCount)
Handles all kind of error messages, warnings and other information.
void rhs(const real_t *x, real_t *f)
void setErrorVisibilityStatus(VisibilityStatus _errorVisibility)
returnValue throwMessage(returnValue RETnumber, const char *additionaltext, const char *functionname, const char *filename, const unsigned long linenumber, VisibilityStatus localVisibilityStatus, const char *RETstring)
#define __FILE__
void setWarningVisibilityStatus(VisibilityStatus _warningVisibility)
MessageHandling globalMessageHandler(stderr, VS_VISIBLE, VS_VISIBLE, VS_VISIBLE)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:53