-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMessages.h
More file actions
90 lines (75 loc) · 3.98 KB
/
Messages.h
File metadata and controls
90 lines (75 loc) · 3.98 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
#ifndef MESSAGESH
#define MESSAGESH
#include <string>
//---------------------------------------------------------------------------
/**
* @file Messages.h
ERROR AND MESSAGE PASSING
This defines a set of codes that can be used to pass errors and messages.
The modelErr structure is used to pass fatal errors. These errors stop
processing and cause the erasure of all data. This puts the model in a state
ready to be initialized once again.
The modelMsg structure is used to pass non-fatal errors and messages. These
stop processing but do not cause data erasure. An object passing one of
these messages is responsible for internal data cleanup.
The structures use C-style strings. std::strings will cause memory problems
because this is a DLL (this is a Borland issue).
Copyright 2003 Charles D. Canham.
*/
/**This is the structure for sending and receiving messages*/
struct modelMsg {
int iMessageCode; /**<Integer message code. See constants.*/
std::string sMoreInfo, /**<String to hold additional information, if
needed, according to the message code*/
sFunction; /**<Function in which the error occurred -
probably not for user consumption*/
};
/**Error reporting structure*/
struct modelErr {
int iErrorCode; /**<Error code. See constants.*/
std::string sMoreInfo, /**<String to hold additional information, if
needed, according to the error code*/
sFunction; /**<Fnction in which the error occurred -
probably not for user consumption*/
};
//*****************************************
// Message and error codes - which these are
// depends on the structure they are passed in
//*****************************************
const int UNKNOWN = 0; /**<Message of unknown type*/
const int NO_MESSAGE = 1; /**<No message to pass*/
//Commands - these will probably never be used as errors
const int PAUSE_RUN = 2; /**<Request to pause run*/
const int RUN = 3; /**<Request to run model*/
const int INPUT_FILE = 4; /**<Request to input file*/
const int QUIT = 5; /**<Request to quit model*/
//For communicating model status
const int MODEL_READY = 6; /**<Model is in ready state*/
const int MODEL_NOT_READY = 7; /**<Model is not in ready state*/
const int MODEL_PAUSED = 8; /**<Model is paused*/
const int RUN_COMPLETE = 9; /**<Requested run is complete*/
const int COMMAND_DONE = 10; /**<Model is finished executing command*/
const int INFO = 11; /**<Message in the cMoreInfo string should be
passed to the user*/
//Runtime error codes
const int BAD_ARGUMENT = 12; /**<A bad or missing argument has been passed
from the interface for a command*/
const int BAD_COMMAND = 13; /**<A bad command has been passed from the
interface*/
const int CANT_FIND_OBJECT= 14; /**<An object could not be found*/
const int TREE_WRONG_TYPE = 15; /**<A tree was not of an expected type*/
const int ACCESS_VIOLATION= 16; /**<An access violation occurred*/
//File error codes
const int BAD_FILE = 17; /**<Bad file name or path - couldn't
open the file*/
const int BAD_FILE_TYPE = 18; /**<A file was not an expected type*/
const int BAD_XML_FILE = 19; /**<XML file is malformed or invalid*/
const int NEED_FILE = 20; /**<Expected file name and didn't get one*/
//Data errors - add'l data should have name of data piece
const int DATA_MISSING = 21; /**<Couldn't find needed data in file*/
const int BAD_DATA = 22; /**<Data was scrambled, of incorrect type, or
otherwise invalid*/
const int DATA_READ_ONLY = 23; /**<Data isn't accessible for writing*/
const int ILLEGAL_OP = 24; /**<Illegal operation*/
//---------------------------------------------------------------------------
#endif