Statistics
| Branch: | Revision:

root / src / nedxml / nedexception.h @ 68da4f12

History | View | Annotate | Download (1.51 KB)

1 01873262 Georg Kunz
//==========================================================================
2
// nedexception.h  -
3
//
4
//                     OMNeT++/OMNEST
5
//            Discrete System Simulation in C++
6
//
7
//==========================================================================
8
9
/*--------------------------------------------------------------*
10
  Copyright (C) 2002-2008 Andras Varga
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16
17
#ifndef __NEDEXCEPTION_H
18
#define __NEDEXCEPTION_H
19
20
#include <string>
21
#include <exception>
22
#include <stdexcept>
23
#include "nedxmldefs.h"
24
25
NAMESPACE_BEGIN
26
27
class NEDElement;
28
29
/**
30
 * Low-level routines throw an exception instead of calling NEDErrorStore->add().
31
 */
32
class NEDXML_API NEDException : public std::runtime_error
33
{
34
  protected:
35
    std::string errormsg;
36
37
  public:
38
    /**
39
     * The error message can be generated in a printf-like manner.
40
     */
41
    NEDException(const char *messagefmt,...);
42
43
    /**
44
     * The error message can be generated in a printf-like manner.
45
     */
46
    NEDException(NEDElement *context, const char *messagefmt,...);
47
48
    /**
49
     * Empty desctructor with throw clause for gcc.
50
     */
51
    virtual ~NEDException() throw() {}
52
53
    /**
54
     * Returns the text of the error. Redefined from std::exception.
55
     */
56
    virtual const char *what() const throw() {return errormsg.c_str();}
57
};
58
59
60
NAMESPACE_END
61
62
63
#endif