-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInterface.cpp
More file actions
768 lines (682 loc) · 27 KB
/
Interface.cpp
File metadata and controls
768 lines (682 loc) · 27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
//---------------------------------------------------------------------------
#include <iostream>
#include <string.h>
//#include <conio.h>
#include <math.h>
#include "Interface.h"
using namespace std;
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// DoIntroduction()
/////////////////////////////////////////////////////////////////////////////
void DoIntroduction()
{
WriteIntroductoryScreen();
WritePrompt();
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// ExternalErrorHandler()
/////////////////////////////////////////////////////////////////////////////
void ExternalErrorHandler( modelErr stcErr, int iModelState, bool batch )
{
//Go through the error types we know of
if ( NEED_FILE == stcErr.iErrorCode )
WriteNeedFile();
else if ( BAD_FILE == stcErr.iErrorCode )
WriteBadFile( stcErr );
else if ( MODEL_NOT_READY == stcErr.iErrorCode )
WriteNotReadyToRun();
else if ( BAD_FILE_TYPE == stcErr.iErrorCode )
WriteBadFileType( stcErr );
else if ( BAD_XML_FILE == stcErr.iErrorCode )
WriteBadXMLFile( stcErr );
else if ( DATA_MISSING == stcErr.iErrorCode )
WriteDataMissingFromFile( stcErr );
else if ( BAD_DATA == stcErr.iErrorCode )
WriteBadData( stcErr );
else if ( ILLEGAL_OP == stcErr.iErrorCode )
WriteIllegalOp( stcErr );
else if ( DATA_READ_ONLY == stcErr.iErrorCode )
WriteDataReadOnly( stcErr );
else if ( CANT_FIND_OBJECT == stcErr.iErrorCode )
WriteCantFindObject( stcErr );
else if ( TREE_WRONG_TYPE == stcErr.iErrorCode )
WriteTreeWrongType( stcErr );
else if ( ACCESS_VIOLATION == stcErr.iErrorCode )
WriteAccessViolation( stcErr );
else if ( UNKNOWN == stcErr.iErrorCode )
WriteUnknownError( stcErr );
else
WriteUnknownError( stcErr );
if ( !batch )
{
if ( No_Data == iModelState )
WriteNotReadyToRun();
else
WriteModelReady();
WritePrompt();
}
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// SendMessage()
/////////////////////////////////////////////////////////////////////////////
void SendMessage( modelMsg stcMsg, bool batch )
{
using namespace std;
modelErr stcErr; //we'll use this to translate the message structure to
//an error structure to pass to writing functions
//Go through the message types we know of
if ( MODEL_READY == stcMsg.iMessageCode )
{
WriteModelReady();
WritePrompt();
}
else if ( MODEL_NOT_READY == stcMsg.iMessageCode )
{
WriteModelNotReady();
WritePrompt();
}
else if ( MODEL_PAUSED == stcMsg.iMessageCode )
{
WriteModelPaused();
WritePrompt();
}
else if ( RUN_COMPLETE == stcMsg.iMessageCode )
{
int iFirst = 0, iSecond = 0; //the two timesteps we expect
unsigned long iRunTime = 0;
//parse out the timesteps
string::size_type pos;
std::string strData = stcMsg.sMoreInfo;
if ( "" != strData )
{
pos = strData.find( "," );
if ( string::npos != pos )
{
iFirst = atoi( strData.substr( 0, pos ).c_str() );
strData = strData.substr( pos + 1 ); //trim off first arg
pos = strData.find( "," );
iSecond = atoi( strData.substr( 0, pos ).c_str() );
iRunTime = atoi( strData.substr( pos + 1 ).c_str() );
}
else
iFirst = atoi( strData.c_str() );
}
WriteRunComplete( iFirst, iSecond, iRunTime );
WritePrompt();
}
else if ( BAD_ARGUMENT == stcMsg.iMessageCode )
{
WriteBadArgument( stcMsg );
WritePrompt();
}
else if ( BAD_COMMAND == stcMsg.iMessageCode )
{
WriteBadCommand();
WritePrompt();
}
else if ( COMMAND_DONE == stcMsg.iMessageCode )
{
WritePrompt();
}
else if ( INFO == stcMsg.iMessageCode )
{
cout << "\t" << stcMsg.sMoreInfo << "\n";
}
else if ( NEED_FILE == stcMsg.iMessageCode )
{
WriteNeedFile();
if ( !batch ) WritePrompt();
}
else if ( BAD_FILE == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteBadFile( stcErr );
if ( !batch ) WritePrompt();
}
else if ( BAD_FILE_TYPE == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteBadFileType( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( BAD_XML_FILE == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteBadXMLFile( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( DATA_MISSING == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteDataMissingFromFile( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( BAD_DATA == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteBadData( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( DATA_READ_ONLY == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteDataReadOnly( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( CANT_FIND_OBJECT == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteCantFindObject( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( TREE_WRONG_TYPE == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteTreeWrongType( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else if ( UNKNOWN == stcMsg.iMessageCode )
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteUnknownError( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
else
{
stcErr.iErrorCode = stcMsg.iMessageCode;
stcErr.sFunction = stcMsg.sFunction;
stcErr.sMoreInfo = stcMsg.sMoreInfo;
WriteUnknownError( stcErr );
if ( !batch ) WriteNotReadyToRun();
if ( !batch ) WritePrompt();
}
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// CheckForMessage()
/////////////////////////////////////////////////////////////////////////////
modelMsg CheckForMessage(string sAppPath)
{
using namespace std;
modelMsg stcMsg; //what this function will return
//This may not even be needed for Linux
//Did the user hit any keys? If so, send a message of "paused"
// if ( 0 != kbhit() )
// stcMsg.iMessageCode = MODEL_PAUSED;
// else //no keys hit
stcMsg.iMessageCode = NO_MESSAGE;
return stcMsg;
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// GetMessage()
/////////////////////////////////////////////////////////////////////////////
modelMsg GetMessage()
{
using namespace std;
const int iLineSize = 250; //max number of characters we expect to receive
//from a command line argument
modelMsg stcMsg; //the message structure we will return
char cInBuf[iLineSize]; //in buffer
string strCommandLine, //what the user types on the command line - for
//parsing
strCommand, //this captures the actual command parsed out of the
//command line
strArg; //this captures the additional arguments to the command
//that will be passed in the message structure
string::size_type pos; //for string parsing operations
while ( 1 )
{
//Get what the user typed on the command line
cin.getline( cInBuf, iLineSize );
strCommandLine = cInBuf;
//Parse out the command - if there's a space in what we captured, then the
//first part is the command
pos = strCommandLine.find_first_of( " " );
if ( pos == string::npos )
{
strCommand = strCommandLine;
strArg = "";
}
else
{
strCommand = strCommandLine.substr( 0, pos );
strArg = strCommandLine.substr( pos + 1 );
}
//If this was a help request, handle it in this function rather than
//passing it on
if ( "help" == strCommand )
{
if ( "" == strArg )
{
WriteGeneralHelp();
WritePrompt();
}
else if ( "input" == strArg )
{
WriteInputHelp();
WritePrompt();
}
else if ( "run" == strArg )
{
WriteRunHelp();
WritePrompt();
}
else if ( "quit" == strArg )
{
WriteQuitHelp();
WritePrompt();
}
else
{
WriteBadCommand();
WritePrompt();
}
} //end of if ("help" = strCommand)
else
{ //not help
//Put the arguments, if any, into the message structure
stcMsg.sMoreInfo = strArg;
//Figure out what the message is
if ( "quit" == strCommand )
{
stcMsg.iMessageCode = QUIT;
return stcMsg;
}
else if ( "run" == strCommand )
{
stcMsg.iMessageCode = RUN;
return stcMsg;
}
else if ( "input" == strCommand )
{
stcMsg.iMessageCode = INPUT_FILE;
return stcMsg;
}
else
{ //unrecognized message
stcMsg.iMessageCode = UNKNOWN;
//Put the message command back into the string
stcMsg.sMoreInfo = strCommandLine;
return stcMsg;
}
} //end of else
} //end of while (1)
return stcMsg;
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WritePrompt()
/////////////////////////////////////////////////////////////////////////////
void WritePrompt()
{
using namespace std;
cout << "SORTIE:> ";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteIntroductoryScreen()
/////////////////////////////////////////////////////////////////////////////
void WriteIntroductoryScreen()
{
using namespace std;
cout << "*************************************\n";
cout << " SORTIE \n";
cout << "*************************************\n";
cout << "Model Status: Not ready to run.\n\n";
cout << "To enter a parameter file: Type \"input \" followed by the path ";
cout << "and name of the parameter file.\n\n";
cout << "For a list of all commands with examples, type \"help\". To end, ";
cout << "type \"quit\".\n";
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteBadCommand()
/////////////////////////////////////////////////////////////////////////////
void WriteBadCommand()
{
using namespace std;
cout << "I do not understand that command. Type \"help\" for a list" << " of commands.\n\n";
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteGeneralHelp()
/////////////////////////////////////////////////////////////////////////////
void WriteGeneralHelp()
{
using namespace std;
cout << "\n\n*************************************\n";
cout << " SORTIE HELP \n";
cout << "*************************************\n\n";
cout << "Note: Case is important. Type all commands in lowercase.\n";
cout << "Type the desired command, then a space, then any required";
cout << " arguments.\n\n";
cout << "Command Arguments Purpose\n";
cout << "------------------------------------------------\n";
cout << " help Optional - Displays the help screen.\n";
cout << " command\n";
cout << " quit (None) Exits SORTIE.\n\n";
cout << " input File path and whether Gives SORTIE a file to read.\n";
cout << " to keep current set-\n";
cout << " tings (true/false)\n\n";
cout << " run Optional - number of Runs the model.\n";
cout << " timesteps to run\n\n";
// cout << " reset (None) Resets the current timestep\n";
// cout << " to 1, leaving current trees.\n";
// cout << " pause (None) Pauses the run.\n\n";
cout << "For more information on a given command, type \"help\" followed by";
cout << " the name of the command - i.e. \"help input\".\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteInputHelp()
/////////////////////////////////////////////////////////////////////////////
void WriteInputHelp()
{
using namespace std;
cout << "\n\n****************************************\n";
cout << "INPUT HELP\n\n";
cout << "PURPOSE: This feeds an input file to SORTIE. This must be used at"
<< " the beginning of a run to input a parameter file. This may be used"
<< " at anytime after, including during the run, for updating and chang" << "ing settings.\n\n";
cout << "ARGUMENTS: The first argument is the full path and filename of the"
<< " file to read. The second argument, optional, is a true/false for"
<< " whether or not to keep current data. For instance, if you are"
<< " entering a tree map file, this indicates whether or not to keep the"
<< " current trees. This argument does not apply in all cases.\n\n";
cout << "EXAMPLE: input c:\\sortie\\parameterfile.xml false\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteRunHelp()
/////////////////////////////////////////////////////////////////////////////
void WriteRunHelp()
{
using namespace std;
cout << "\n\n****************************************\n";
cout << "RUN HELP\n\n";
cout << "PURPOSE: This starts the SORTIE run. You must have input a" << " parameter file for this to work.\n\n";
cout << "ARGUMENTS: There is an optional argument for a number of timesteps"
<< " to run. For instance, typing \"run 5\" runs the model for the next"
<< " five timesteps, at which point the model pauses to await commands."
<< " Leaving off this argument causes the model to run to the end.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WritePauseHelp()
/////////////////////////////////////////////////////////////////////////////
void WritePauseHelp()
{
;
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteQuitHelp()
/////////////////////////////////////////////////////////////////////////////
void WriteQuitHelp()
{
using namespace std;
cout << "QUIT HELP\n\n";
cout << "PURPOSE: This quits SORTIE.\n\n";
cout << "ARGUMENTS: None.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteResetHelp()
/////////////////////////////////////////////////////////////////////////////
void WriteResetHelp()
{
using namespace std;
cout << "RESET HELP\n\n";
cout << "PURPOSE: This resets the current timestep back to one. This does"
<< " not change the current tree set or reload the parameter file. You"
<< " might use this to start a new run after one has just finished,"
<< " using the same settings on that set of trees.\n";
cout << "ARGUMENTS: None.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteNeedFile()
/////////////////////////////////////////////////////////////////////////////
void WriteNeedFile()
{
using namespace std;
cerr << "I need a file path and name with the input command. Please type"
<< " \"input\" again and follow it with a complete file path and" << " name.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteBadFile()
/////////////////////////////////////////////////////////////////////////////
void WriteBadFile( modelErr stcErr )
{
using namespace std;
cerr << "SORTIE could not open or read this file.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " The file is: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteModelReady()
/////////////////////////////////////////////////////////////////////////////
void WriteModelReady()
{
using namespace std;
cout << "Model status: Ready to run.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteModelNotReady()
/////////////////////////////////////////////////////////////////////////////
void WriteModelNotReady()
{
using namespace std;
cout << "Model status: Not ready to run.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteBadArgument()
/////////////////////////////////////////////////////////////////////////////
void WriteBadArgument( modelMsg stcMsg )
{
using namespace std;
cerr << "I did not understand the argument(s) to the last command.";
if (stcMsg.sMoreInfo.length() != 0 )
cerr << " More information: " << stcMsg.sMoreInfo;
cerr << " Please use the \"help\" command for more information.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteNotReadyToRun()
/////////////////////////////////////////////////////////////////////////////
void WriteNotReadyToRun()
{
using namespace std;
cout << "The model is not ready to run.\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteRunComplete()
/////////////////////////////////////////////////////////////////////////////
void WriteRunComplete( int iCurrentTimestep, int iNumTimesteps, unsigned long iRunTime )
{
using namespace std;
char cTime[20], cTime2[20];
int iTemp;
//Calc number of hours
iTemp = (int)floor( (double)(iRunTime / 3600) );
sprintf( cTime, "%d", iTemp );
strcat( cTime, ":" );
iRunTime -= ( iTemp * 3600 );
//Calc number of minutes
iTemp = (int)floor( (double)(iRunTime / 60) );
sprintf( cTime2, "%s%d", cTime, iTemp );
strcat( cTime2, ":" );
iRunTime -= ( iTemp * 60 );
//Add number of seconds
sprintf( cTime, "%s%lu", cTime2, iRunTime );
cout << "The requested run is complete.\n" << "Timesteps completed: " << iCurrentTimestep << " out of " << iNumTimesteps
<< ". Run time: " << cTime << ".\n";
}
//----------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
// WriteModelPaused()
/////////////////////////////////////////////////////////////////////////////
void WriteModelPaused()
{
using namespace std;
cout << "The run is paused. To start the model where it left off, type"
<< " \"run\" (if you entered a number of timesteps to run earlier, it"
<< " will still run to that point). Or, enter another command.\n";
}
//----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteBadFileType()
////////////////////////////////////////////////////////////////////////////
void WriteBadFileType( modelErr stcErr )
{
using namespace std;
cerr << "SORTIE cannot process this file type.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " The file is: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteBadXMLFile()
////////////////////////////////////////////////////////////////////////////
void WriteBadXMLFile( modelErr stcErr )
{
using namespace std;
cerr << "This XML file is not well-formed or is invalid. It cannot" << " be parsed.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " The file is: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteDataMissingFromFile()
////////////////////////////////////////////////////////////////////////////
void WriteDataMissingFromFile( modelErr stcErr )
{
using namespace std;
cerr << "This file is missing data.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteBadData()
////////////////////////////////////////////////////////////////////////////
void WriteBadData( modelErr stcErr )
{
using namespace std;
cerr << "The model has attempted to use bad or invalid data.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteIllegalOp()
////////////////////////////////////////////////////////////////////////////
void WriteIllegalOp( modelErr stcErr )
{
using namespace std;
cerr << "The model has attempted to perform an illegal operation.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteDataReadOnly()
////////////////////////////////////////////////////////////////////////////
void WriteDataReadOnly( modelErr stcErr )
{
using namespace std;
cerr << "The model has attempted to write to a read-only piece of data.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteCantFindObject()
////////////////////////////////////////////////////////////////////////////
void WriteCantFindObject( modelErr stcErr )
{
using namespace std;
cerr << "The model is unable to find a needed object.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteTreeWrongType()
////////////////////////////////////////////////////////////////////////////
void WriteTreeWrongType( modelErr stcErr )
{
using namespace std;
cerr << "A tree is of the wrong type.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteAccessViolation()
////////////////////////////////////////////////////////////////////////////
void WriteAccessViolation( modelErr stcErr )
{
using namespace std;
cerr << "There was an access violation.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
// WriteUnknownError()
////////////////////////////////////////////////////////////////////////////
void WriteUnknownError( modelErr stcErr )
{
using namespace std;
cerr << "An unknown error has occurred.";
if (stcErr.sMoreInfo.length() != 0 )
cerr << " More information: " << stcErr.sMoreInfo;
cerr << " The function which passed this error is: " << stcErr.sFunction << "\n\n";
}
//---------------------------------------------------------------------------