NotEnoughMemoryException.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #ifndef _FASTCDR_EXCEPTIONS_NOTENOUGHMEMORYEXCEPTION_H_
  15. #define _FASTCDR_EXCEPTIONS_NOTENOUGHMEMORYEXCEPTION_H_
  16. #include "Exception.h"
  17. namespace eprosima
  18. {
  19. namespace fastcdr
  20. {
  21. namespace exception
  22. {
  23. /*!
  24. * @brief This class is thrown as an exception when the buffer's internal memory reachs its size limit.
  25. * @ingroup EXCEPTIONMODULE
  26. */
  27. class NotEnoughMemoryException : public Exception
  28. {
  29. public:
  30. /*!
  31. * @brief Default constructor.
  32. *
  33. * @param message A error message. This message pointer is copied.
  34. */
  35. Cdr_DllAPI NotEnoughMemoryException(const char* const &message) noexcept;
  36. /*!
  37. * @brief Default copy constructor.
  38. *
  39. * @param ex NotEnoughMemoryException that will be copied.
  40. */
  41. Cdr_DllAPI NotEnoughMemoryException(const NotEnoughMemoryException &ex) noexcept;
  42. #if HAVE_CXX0X
  43. /*!
  44. * @brief Default move constructor.
  45. *
  46. * @param ex NotEnoughMemoryException that will be moved.
  47. */
  48. Cdr_DllAPI NotEnoughMemoryException(NotEnoughMemoryException&& ex) noexcept;
  49. #endif
  50. /*!
  51. * @brief Assigment operation.
  52. *
  53. * @param ex NotEnoughMemoryException that will be copied.
  54. */
  55. Cdr_DllAPI NotEnoughMemoryException& operator=(const NotEnoughMemoryException &ex) noexcept;
  56. #if HAVE_CXX0X
  57. /*!
  58. * @brief Assigment operation.
  59. *
  60. * @param ex NotEnoughMemoryException that will be moved.
  61. */
  62. Cdr_DllAPI NotEnoughMemoryException& operator=(NotEnoughMemoryException&& ex) noexcept;
  63. #endif
  64. //! @brief Default constructor
  65. virtual Cdr_DllAPI ~NotEnoughMemoryException() noexcept;
  66. //! @brief This function throws the object as exception.
  67. virtual Cdr_DllAPI void raise() const;
  68. //! @brief Default message used in the library.
  69. static Cdr_DllAPI const char* const NOT_ENOUGH_MEMORY_MESSAGE_DEFAULT;
  70. };
  71. } //namespace exception
  72. } //namespace fastcdr
  73. } //namespace eprosima
  74. #endif // _FASTCDR_EXCEPTIONS_NOTENOUGHMEMORYEXCEPTION_H_