Class
List
Hierarchy
Links
SDF Website
Report Documentation Issues
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
Groups
Pages
include
sdf
Exception.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Open Source Robotics Foundation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef _SDF_EXCEPTION_HH_
19
#define _SDF_EXCEPTION_HH_
20
21
#include <iostream>
22
#include <sstream>
23
#include <string>
24
25
#include "
sdf/system_util.hh
"
26
27
namespace
sdf
28
{
31
34
#define sdfthrow(msg) {std::ostringstream throwStream;\
35
throwStream << msg << std::endl << std::flush;\
36
throw sdf::Exception(__FILE__, __LINE__, throwStream.str()); }
37
40
class
SDFORMAT_VISIBLE
Exception
41
{
43
public
:
Exception
();
44
49
public
:
Exception
(
const
char
*_file,
50
int
_line,
51
std::string _msg);
52
54
public
:
virtual
~
Exception
();
55
58
public
: std::string GetErrorFile()
const
;
59
62
public
: std::string GetErrorStr()
const
;
63
65
public
:
void
Print()
const
;
66
68
private
: std::string file;
69
71
private
:
int
line;
72
74
private
: std::string str;
75
79
public
:
friend
std::ostream &operator<<(std::ostream& _out,
80
const
sdf::Exception
&_err)
81
{
82
return
_out << _err.
GetErrorStr
();
83
}
84
};
85
90
class
SDFORMAT_VISIBLE
InternalError
:
public
Exception
91
{
93
public
:
InternalError
();
94
99
public
:
InternalError
(
const
char
*_file,
int
_line,
100
const
std::string _msg);
101
103
public
:
virtual
~
InternalError
();
104
};
105
111
class
SDFORMAT_VISIBLE
AssertionInternalError
:
public
InternalError
112
{
120
public
:
AssertionInternalError
(
const
char
*_file,
121
int
_line,
122
const
std::string _expr,
123
const
std::string _function,
124
const
std::string _msg =
""
);
126
public
:
virtual
~
AssertionInternalError
();
127
};
129
}
130
131
#endif