INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
gbxutilacfr/exceptions.h
1/*
2 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3 * http://gearbox.sf.net/
4 * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp
5 *
6 * This distribution is licensed to you under the terms described in
7 * the LICENSE file included in this distribution.
8 *
9 */
10
11#ifndef GBXUTILACFR_EXCEPTIONS_H
12#define GBXUTILACFR_EXCEPTIONS_H
13
14#if defined (WIN32)
15 #if defined (GBXUTILACFR_STATIC)
16 #define GBXUTILACFR_EXPORT
17 #elif defined (GBXUTILACFR_EXPORTS)
18 #define GBXUTILACFR_EXPORT __declspec (dllexport)
19 #else
20 #define GBXUTILACFR_EXPORT __declspec (dllimport)
21 #endif
22#else
23 #define GBXUTILACFR_EXPORT
24#endif
25
26/*
27 * STRINGIZE macro converts an expression into a string-literal.
28 * ERROR_INFO macro permits file-name and line-number data to be added to an error message.
29 *
30 * Adapted by Alex Brooks from Tim Bailey's version 2005.
31 */
32
33#ifndef ERROR_MACROS_HPP_
34#define ERROR_MACROS_HPP_
35
36#if defined(STRINGIZE_HELPER) || defined(STRINGIZE) || defined(ERROR_INFO)
37# error GbxUtilAcfr error macros have already been defined elsewhere
38#endif
39
40#define STRINGIZE_HELPER(exp) #exp
41#define STRINGIZE(exp) STRINGIZE_HELPER(exp)
42
43#define ERROR_INFO __FILE__, STRINGIZE(__LINE__)
44
45#endif
46
47#include <exception>
48#include <string>
49
50namespace gbxutilacfr {
51
65class GBXUTILACFR_EXPORT Exception : public std::exception
66{
67public:
68 Exception(const char *file, const char *line, const std::string &message);
69
70 virtual ~Exception() throw();
71
72 virtual const char* what() const throw() { return message_.c_str(); }
73
74protected:
75 std::string toMessageString( const char *file, const char *line, const std::string &message ) const;
76
77 std::string message_;
78};
79std::string basename( const std::string &s );
80std::string dirname( const std::string &s );
81
83class GBXUTILACFR_EXPORT HardwareException : public gbxutilacfr::Exception
84{
85public:
86 HardwareException(const char *file, const char *line, const std::string &message)
87 : Exception( file, line, message ) {};
88};
89
90} // namespace
91
92
93#endif
Base class for all GbxUtilAcfr exceptions.
Definition: gbxutilacfr/exceptions.h:66
This exception is raised when something is wrong with the hardware.
Definition: gbxutilacfr/exceptions.h:84
ACFR utilities.
Definition: gbxnovatelacfr/driver.h:24
 

Generated for GearBox by  doxygen 1.4.5