PLCnext API Documentation  21.0.0.35466
IndexOutOfRangeException.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
11 {
12 
15 {
16 public: // construction/destruction
17  template<typename... Args>
18  IndexOutOfRangeException(const char* message, const Args& ... args);
19  IndexOutOfRangeException(const String& message);
21  IndexOutOfRangeException(const String& message, const Exception& innerException);
22  IndexOutOfRangeException(String&& message, Exception&& innerException);
23  IndexOutOfRangeException(const IndexOutOfRangeException& arg) = default;
24  IndexOutOfRangeException(IndexOutOfRangeException&& arg) = default;
25  virtual ~IndexOutOfRangeException(void) = default;
26 
27 protected: // overridden operations
28  Exception::Ptr Clone(void)const override;
29 
30 private: // deleted methods
31  IndexOutOfRangeException& operator=(const IndexOutOfRangeException& arg) = delete;
32 };
33 
35 // inline methods of class IndexOutOfRangeException
36 
38 template<typename... Args>
39 inline IndexOutOfRangeException::IndexOutOfRangeException(const char* message, const Args& ... args)
40  : CommonException(ExceptionTypeId::IndexOutOfRange, String::Format(message, args...))
41 {
42 }
43 
46  : CommonException(ExceptionTypeId::IndexOutOfRange, message)
47 {
48 }
49 
52  : CommonException(ExceptionTypeId::IndexOutOfRange, std::move(message))
53 {
54 }
55 
57 inline IndexOutOfRangeException::IndexOutOfRangeException(const String& message, const Exception& innerException)
58  : CommonException(ExceptionTypeId::IndexOutOfRange, message, innerException)
59 {
60 }
61 
64  : CommonException(ExceptionTypeId::IndexOutOfRange, std::move(message), std::move(innerException))
65 {
66 }
67 
68 }}} // end of namesapce Arp::System::Commons
This is the base class of common exception classes.
Definition: CommonException.hpp:18
This exception is used when an index is out of range.
Definition: IndexOutOfRangeException.hpp:14
String Format(int indentLevel, bool withInnerException) const override
Formats this exception using the given indent level.
Namespace of the C++ standard library
IndexOutOfRangeException(const char *message, const Args &... args)
Constructs an IndexOutOfRangeException instance.
Definition: IndexOutOfRangeException.hpp:39
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
Exception::Ptr Clone(void) const override
Clones this instance.
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