WPILibC++
2020.3.2
Error.h
1
/*----------------------------------------------------------------------------*/
2
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
3
/* Open Source Software - may be modified and shared by FRC teams. The code */
4
/* must be accompanied by the FIRST BSD license file in the root directory of */
5
/* the project. */
6
/*----------------------------------------------------------------------------*/
7
8
#pragma once
9
10
#include <stdint.h>
11
12
#include <string>
13
14
#include <wpi/StringRef.h>
15
#include <wpi/Twine.h>
16
17
#ifdef _WIN32
18
#pragma push_macro("GetMessage")
19
#undef GetMessage
20
#endif
21
22
#include "frc/Base.h"
23
24
namespace
frc
{
25
26
class
ErrorBase;
27
31
class
Error
{
32
public
:
33
using
Code = int;
34
35
Error
() =
default
;
36
Error
(Code code,
const
wpi::Twine
& contextMessage,
wpi::StringRef
filename,
37
wpi::StringRef
function
,
int
lineNumber,
38
const
ErrorBase
* originatingObject);
39
40
bool
operator<(
const
Error
& rhs)
const
;
41
42
Code GetCode()
const
;
43
std::string GetMessage()
const
;
44
std::string GetFilename()
const
;
45
std::string GetFunction()
const
;
46
int
GetLineNumber()
const
;
47
const
ErrorBase
* GetOriginatingObject()
const
;
48
double
GetTimestamp()
const
;
49
void
Clear();
50
void
Set(Code code,
const
wpi::Twine
& contextMessage,
wpi::StringRef
filename,
51
wpi::StringRef
function
,
int
lineNumber,
52
const
ErrorBase
* originatingObject);
53
54
private
:
55
void
Report();
56
57
Code m_code = 0;
58
std::string m_message;
59
std::string m_filename;
60
std::string m_function;
61
int
m_lineNumber = 0;
62
const
ErrorBase
* m_originatingObject =
nullptr
;
63
double
m_timestamp = 0.0;
64
};
65
66
}
// namespace frc
67
68
#ifdef _WIN32
69
#pragma pop_macro("GetMessage")
70
#endif
frc::ErrorBase
Base class for most objects.
Definition:
ErrorBase.h:104
wpi::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:49
frc::Error
Error object represents a library error.
Definition:
Error.h:31
frc
A class that enforces constraints on the differential drive kinematics.
Definition:
SPIAccelerometerSim.h:16
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:
Twine.h:85
wpilibc
src
main
native
include
frc
Error.h
Generated on Fri Feb 21 2020 08:50:37 for WPILibC++ by
1.8.16