pjmsg_mcap_wrapper
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef _FASTCDR_EXCEPTIONS_EXCEPTION_H_
16#define _FASTCDR_EXCEPTIONS_EXCEPTION_H_
17
18#include "../fastcdr_dll.h"
19#include <string>
20#include <exception>
21
22namespace eprosima {
23namespace fastcdr {
24namespace exception {
25/*!
26 * @brief This abstract class is used to create exceptions.
27 * @ingroup EXCEPTIONMODULE
28 */
30{
31public:
32
33 //! \brief Default destructor.
34 virtual Cdr_DllAPI ~Exception() noexcept;
35
36 //! \brief This function throws the object as exception.
37 virtual Cdr_DllAPI void raise() const = 0;
38
39 /*!
40 * @brief This function returns the error message.
41 *
42 * @return The error message.
43 */
44 virtual Cdr_DllAPI const char* what() const noexcept override;
45
46protected:
47
48 /*!
49 * @brief Default constructor.
50 *
51 * @param message A error message. This message pointer is copied.
52 */
54 const char* const& message) noexcept;
55
56 /*!
57 * @brief Default copy constructor.
58 *
59 * @param ex Exception that will be copied.
60 */
62 const Exception& ex) noexcept;
63
64 /*!
65 * @brief Default move constructor.
66 *
67 * @param ex Exception that will be moved.
68 */
70 Exception&& ex) noexcept;
71
72 /*!
73 * @brief Assigment operation.
74 *
75 * @param ex Exception that will be copied.
76 */
77 Cdr_DllAPI Exception& operator =(
78 const Exception& ex) noexcept;
79
80 /*!
81 * @brief Assigment operation.
82 *
83 * @param ex Exception that will be moved.
84 */
85 Cdr_DllAPI Exception& operator =(
86 Exception&& ex) noexcept;
87
88private:
89
90 const char* m_message;
91};
92} //namespace exception
93} //namespace fastcdr
94} //namespace eprosima
95
96#endif // _FASTCDR_EXCEPTIONS_EXCEPTION_H_
This abstract class is used to create exceptions.
Definition Exception.h:30
virtual Cdr_DllAPI ~Exception() noexcept
Default destructor.
Definition Exception.cpp:51
virtual Cdr_DllAPI void raise() const =0
This function throws the object as exception.
virtual Cdr_DllAPI const char * what() const noexcept override
This function returns the error message.
Definition Exception.cpp:55
#define Cdr_DllAPI
Definition fastcdr_dll.h:51
Definition Cdr.h:49