exceptions.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright 2016-2017 Davide Faconti
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  * *******************************************************************/
34 
35 #ifndef VARIANT_NUMBER_EXCEPTIONS_H
36 #define VARIANT_NUMBER_EXCEPTIONS_H
37 
38 #include <exception>
39 #include <string>
40 
41 namespace RosMsgParser
42 {
43 
44 class RangeException : public std::exception
45 {
46 public:
47  explicit RangeException(const char* message) : msg_(message)
48  {
49  }
50  explicit RangeException(const std::string& message) : msg_(message)
51  {
52  }
53  ~RangeException() throw()
54  {
55  }
56  const char* what() const throw()
57  {
58  return msg_.c_str();
59  }
60 
61 protected:
62  std::string msg_;
63 };
64 
65 class TypeException : public std::exception
66 {
67 public:
68  explicit TypeException(const char* message) : msg_(message)
69  {
70  }
71  explicit TypeException(const std::string& message) : msg_(message)
72  {
73  }
74  ~TypeException() throw()
75  {
76  }
77  const char* what() const throw()
78  {
79  return msg_.c_str();
80  }
81 
82 protected:
83  std::string msg_;
84 };
85 
86 } // namespace RosMsgParser
87 
88 #endif
RosMsgParser::TypeException::TypeException
TypeException(const char *message)
Definition: exceptions.hpp:100
RosMsgParser::TypeException::msg_
std::string msg_
Definition: exceptions.hpp:115
RosMsgParser::RangeException::RangeException
RangeException(const char *message)
Definition: exceptions.hpp:111
RosMsgParser::RangeException::~RangeException
~RangeException()
Definition: exceptions.hpp:117
RosMsgParser
Definition: builtin_types.hpp:34
RosMsgParser::RangeException::msg_
std::string msg_
Definition: exceptions.hpp:126
RosMsgParser::RangeException::what
const char * what() const
Definition: exceptions.hpp:120
RosMsgParser::TypeException::what
const char * what() const
Definition: exceptions.hpp:109
RosMsgParser::TypeException::~TypeException
~TypeException()
Definition: exceptions.hpp:106


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44