OpenVSP API Documentation
3.52.0
Loading...
Searching...
No Matches
geom_api
APIErrorMgr.h
1
//
2
// This file is released under the terms of the NASA Open Source Agreement (NOSA)
3
// version 1.3 as detailed in the LICENSE file which accompanies this software.
4
//
5
6
// API.h: interface for the Vehicle Class and Vehicle Mgr Singleton.
7
// J.R Gloudemans
8
//
10
11
#if !defined(APIERRORMGR__INCLUDED_)
12
#define APIERRORMGR__INCLUDED_
13
14
#include "APIDefines.h"
15
#include "MessageMgr.h"
16
17
#include <string>
18
#include <stack>
19
#include <vector>
20
21
using
std::string;
22
using
std::stack;
23
using
std::vector;
24
25
class
Vehicle;
26
27
namespace
vsp
28
{
29
30
31
//======================== Error Object ================================//
38
class
ErrorObj
39
{
40
public
:
46
ErrorObj();
51
ErrorObj(
ERROR_CODE
err_code,
const
string
& err_str );
56
ErrorObj(
const
ErrorObj& from );
57
~ErrorObj() {}
58
106
107
ERROR_CODE
GetErrorCode
()
108
109
{
110
return
m_ErrorCode;
111
}
112
152
153
string
GetErrorString
()
154
155
{
156
return
m_ErrorString;
157
}
158
159
ERROR_CODE
m_ErrorCode;
160
string
m_ErrorString;
161
166
void
NoError()
167
{
168
m_ErrorCode =
VSP_OK
;
169
m_ErrorString =
"No Error"
;
170
}
171
};
172
173
174
//======================== Error Mgr ================================//
184
class
ErrorMgrSingleton :
public
MessageBase
185
{
186
public
:
187
226
227
bool
GetErrorLastCallFlag
();
// Did the last call have an error?
228
269
270
int
GetNumTotalErrors
();
// Total number of errors on stack
271
322
323
ErrorObj
PopLastError
();
// Pop last error off stack
324
376
377
ErrorObj
GetLastError
();
// Get last error but leave on stack
378
384
bool
PopErrorAndPrint( FILE* stream );
385
426
427
void
SilenceErrors
() { m_PrintErrors =
false
; };
428
467
468
void
PrintOnErrors
() { m_PrintErrors =
true
; };
469
470
476
void
AddError(
ERROR_CODE
code,
const
string
& desc );
481
void
NoError();
482
488
virtual
void
MessageCallback(
const
MessageBase* from,
const
MessageData& data );
489
514
515
static
ErrorMgrSingleton&
getInstance
()
516
{
517
static
ErrorMgrSingleton instance;
518
return
instance;
519
}
520
521
private
:
522
523
bool
m_PrintErrors;
524
bool
m_ErrorLastCallFlag;
525
stack< ErrorObj > m_ErrorStack;
526
531
ErrorMgrSingleton
();
532
~ErrorMgrSingleton
();
533
ErrorMgrSingleton
(
ErrorMgrSingleton
const
& copy ) =
delete
;
// Not Implemented
534
ErrorMgrSingleton
& operator=(
ErrorMgrSingleton
const
& copy ) =
delete
;
// Not Implemented
535
};
536
537
#define ErrorMgr ErrorMgrSingleton::getInstance()
538
539
}
540
541
#endif
// !defined(APIERRORMGR__INCLUDED_)
542
vsp::ErrorMgrSingleton
Definition
APIErrorMgr.h:185
vsp::ErrorObj
Definition
APIErrorMgr.h:39
vsp::ErrorMgrSingleton::getInstance
static ErrorMgrSingleton & getInstance()
Definition
APIErrorMgr.h:515
vsp::ErrorMgrSingleton::GetNumTotalErrors
int GetNumTotalErrors()
vsp::ErrorMgrSingleton::PrintOnErrors
void PrintOnErrors()
Definition
APIErrorMgr.h:468
vsp::ErrorMgrSingleton::PopLastError
ErrorObj PopLastError()
vsp::ErrorObj::GetErrorString
string GetErrorString()
Definition
APIErrorMgr.h:153
vsp::ErrorMgrSingleton::GetLastError
ErrorObj GetLastError()
vsp::ErrorMgrSingleton::GetErrorLastCallFlag
bool GetErrorLastCallFlag()
vsp::ErrorMgrSingleton::SilenceErrors
void SilenceErrors()
Definition
APIErrorMgr.h:427
vsp::ErrorObj::GetErrorCode
ERROR_CODE GetErrorCode()
Definition
APIErrorMgr.h:107
vsp::ERROR_CODE
ERROR_CODE
Definition
APIDefines.h:508
vsp::VSP_OK
@ VSP_OK
Definition
APIDefines.h:509
Generated on
for OpenVSP API Documentation by
1.18.0