PLCnext API Documentation  21.0.0.35466
IoException.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Commons/Exceptions/CommonException.hpp"
9 
10 namespace Arp { namespace System { namespace Commons { namespace Io
11 {
12 
15 {
16 public: // construction/destruction
17  template<typename... Args>
18  IoException(const char* message, const Args& ... args);
19  IoException(const String& message);
20  IoException(String&& message);
21  IoException(const String& message, const Exception& innerException);
22  IoException(String&& message, Exception&& innerException);
23  IoException(const IoException& arg) = default;
24  IoException(IoException&& arg) = default;
25  virtual ~IoException(void) = default;
26 
27 protected: // construction
28  IoException(ExceptionTypeId typeId, String&& message, int skipStackTraceDepth = 3);
29  IoException(ExceptionTypeId typeId, const String& message, int skipStackTraceDepth = 3);
30  IoException(ExceptionTypeId typeId, String&& message, Exception&& innerException, int skipStackTraceDepth = 3);
31  IoException(ExceptionTypeId typeId, const String& message, const Exception& innerException, int skipStackTraceDepth = 3);
32 
33 protected: // overridden operations
34  Exception::Ptr Clone(void)const override;
35 
36 private: // deleted methods
37  IoException& operator=(const IoException& arg) = delete;
38 };
39 
41 // inline methods of class IoException
42 
44 template<typename... Args>
45 inline IoException::IoException(const char* message, const Args& ... args)
46  : CommonException(ExceptionTypeId::Io, String::Format(message, args...))
47 {
48 }
49 
51 inline IoException::IoException(const String& message)
52  : CommonException(ExceptionTypeId::Io, message)
53 {
54 }
55 
58  : CommonException(ExceptionTypeId::Io, std::move(message))
59 {
60 }
61 
63 inline IoException::IoException(const String& message, const Exception& innerException)
64  : CommonException(ExceptionTypeId::Io, message, innerException)
65 {
66 }
67 
69 inline IoException::IoException(String&& message, Exception&& innerException)
70  : CommonException(ExceptionTypeId::Io, std::move(message), std::move(innerException))
71 {
72 }
73 
75 inline IoException::IoException(ExceptionTypeId typeId, String&& message, int skipStackTraceDepth)
76  : CommonException(typeId, std::move(message), skipStackTraceDepth)
77 {
78 }
79 
81 inline IoException::IoException(ExceptionTypeId typeId, const String& message, int skipStackTraceDepth)
82  : CommonException(typeId, std::move(message), skipStackTraceDepth)
83 {
84 }
85 
87 inline IoException::IoException(ExceptionTypeId typeId, String&& message, Exception&& innerException, int skipStackTraceDepth)
88  : CommonException(typeId, std::move(message), std::move(innerException), skipStackTraceDepth)
89 {
90 }
91 
93 inline IoException::IoException(ExceptionTypeId typeId, const String& message, const Exception& innerException, int skipStackTraceDepth)
94  : CommonException(typeId, message, innerException, skipStackTraceDepth)
95 {
96 }
97 
98 }}}} // end of namesapce Arp::System::Commons::Io
This is the base class of common exception classes.
Definition: CommonException.hpp:18
IoException(const char *message, const Args &... args)
Constructs an IoException instance.
Definition: IoException.hpp:45
Exception::Ptr Clone(void) const override
Clones this instance.
String Format(int indentLevel, bool withInnerException) const override
Formats this exception using the given indent level.
Namespace of the C++ standard library
This is the base class of all IO exceptions.
Definition: IoException.hpp:14
std::shared_ptr< Exception > Ptr
The smart pointer tpye of this class.
Definition: Exception.hpp:19
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:14
Root namespace for the PLCnext API
System components used by the System, Device, Plc or Io domains.
This is the base class of all Arp exception classes.
Definition: Exception.hpp:15