PLCnext API Documentation  21.0.0.35466
DivisionByZeroException.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/Plc/PlcException.hpp"
9 
10 namespace Arp { namespace System { namespace Commons { namespace Plc
11 {
12 
15 {
16 public: // construction/destruction
17  template<typename... Args>
18  DivisionByZeroException(const char* message, const Args& ... args);
19  DivisionByZeroException(const String& message);
21  DivisionByZeroException(const String& message, const Exception& innerException);
22  DivisionByZeroException(String&& message, Exception&& innerException);
23  DivisionByZeroException(const DivisionByZeroException& arg) = default;
24  DivisionByZeroException(DivisionByZeroException&& arg) = default;
25  virtual ~DivisionByZeroException(void) = default;
26 
27 public: // static factory methods
28  static DivisionByZeroException Create(const String& stackTrace);
29 
30 protected: // overridden operations
31  Exception::Ptr Clone(void)const override;
32 
33 private: // deleted methods
34  DivisionByZeroException& operator=(const DivisionByZeroException& arg) = delete;
35 
36 private:
37  static const char* const defaultMessage;
38 };
39 
41 // inline methods of class DivisionByZeroException
42 
44 template<typename... Args>
45 inline DivisionByZeroException::DivisionByZeroException(const char* message, const Args& ... args)
46  : PlcException(ExceptionTypeId::PlcDivisionByZero, String::Format(message, args...))
47 {
48 }
49 
52  : PlcException(ExceptionTypeId::PlcDivisionByZero, message)
53 {
54 }
55 
58  : PlcException(ExceptionTypeId::PlcDivisionByZero, std::move(message))
59 {
60 }
61 
63 inline DivisionByZeroException::DivisionByZeroException(const String& message, const Exception& innerException)
64  : PlcException(ExceptionTypeId::PlcDivisionByZero, message, innerException)
65 {
66 }
67 
70  : PlcException(ExceptionTypeId::PlcDivisionByZero, std::move(message), std::move(innerException))
71 {
72 }
73 
74 }}}} // end of namesapce Arp::System::Commons::Plc
DivisionByZeroException(const char *message, const Args &... args)
Constructs an DivisionByZeroException instance.
Definition: DivisionByZeroException.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 exception is used when a $$$TODO$$$ occurs.
Definition: PlcException.hpp:16
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
This exception is used when a $$$TODO$$$ occurs.
Definition: DivisionByZeroException.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