orca-robotics


INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

REPOSITORY
Interfaces
Components
Libraries
Utilities
Software Map

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
Wiki
login/pass: orca/orca

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

orcalog/exceptions.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 
00011 #ifndef ORCA_ORCALOG_EXCEPTIONS_H
00012 #define ORCA_ORCALOG_EXCEPTIONS_H
00013 
00014 /*
00015  * STRINGIZE macro converts an expression into a string-literal.
00016  * ERROR_INFO macro permits file-name and line-number data to be added to an error message.
00017  *
00018  * Adapted by Alex Brooks from Tim Bailey's version 2005.
00019  */
00020 
00021 #ifndef ERROR_MACROS_HPP_
00022 #define ERROR_MACROS_HPP_
00023 
00024 #if defined(STRINGIZE_HELPER) || defined(STRINGIZE) || defined(ERROR_INFO)
00025 #   error OrcaIceUtil error macros have already been defined elsewhere 
00026 #endif
00027 
00028 #define STRINGIZE_HELPER(exp) #exp
00029 #define STRINGIZE(exp) STRINGIZE_HELPER(exp)
00030 
00031 #define ERROR_INFO __FILE__, STRINGIZE(__LINE__)
00032 
00033 #endif
00034 
00035 #include <exception>
00036 #include <string>
00037 
00038 namespace orcalog
00039 {
00040 
00051 class Exception : public std::exception
00052 {
00053 public:
00054 
00055     Exception(const char *file, const char *line, const char *message);
00056     Exception(const char *file, const char *line, const std::string &message);
00057 
00058     virtual ~Exception() throw();
00059 
00060     virtual const char* what() const throw() { return message_.c_str(); }
00061 
00062 protected:
00063 
00064     void setMsg( const char *file, const char *line, const char *message );
00065     const char *basename( const char *s );
00066 
00067     std::string  message_;
00068 };
00069 
00071 class FileException : public orcalog::Exception
00072 {
00073 public:
00074     FileException(const char *file, const char *line, const char *message)
00075         : Exception( file, line, message ) {};
00076     FileException(const char *file, const char *line, const std::string &message)
00077         : Exception( file, line, message ) {};
00078 };
00079 
00081 class ParseException : public orcalog::Exception
00082 {
00083 public:
00084     ParseException(const char *file, const char *line, const char *message)
00085         : Exception( file, line, message ) {};
00086     ParseException(const char *file, const char *line, const std::string &message)
00087         : Exception( file, line, message ) {};
00088 };
00089 
00091 class FormatNotSupportedException : public orcalog::Exception
00092 {
00093 public:
00094     FormatNotSupportedException(const char *file, const char *line, const char *message)
00095         : Exception( file, line, message ) {};
00096     FormatNotSupportedException(const char *file, const char *line, const std::string &message)
00097         : Exception( file, line, message ) {};
00098 };
00099 
00100 } // namespace
00101 
00102 
00103 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5