Safir SDK Core
Loading...
Searching...
No Matches
InjectionKind.h
Go to the documentation of this file.
1#pragma once
2
8#include <Safir/Utilities/Internal/VisibilityHelpers.h>
9
10#ifdef safir_generated_Core_cpp_EXPORTS
11# define SAFIR_GENERATED_Core_API SAFIR_HELPER_DLL_EXPORT
12#else
13# define SAFIR_GENERATED_Core_API SAFIR_HELPER_DLL_IMPORT
14# define SAFIR_LIBRARY_NAME "safir_generated-Core-cpp"
15# include <Safir/Utilities/Internal/AutoLink.h>
16#endif
17#define SAFIR_GENERATED_Core_API_LOCAL SAFIR_HELPER_DLL_LOCAL
18
22namespace Safir
23{
27namespace Dob
28{
29
33
35 {
43
44
47 static Enumeration Last();
48
51
52 static std::wstring ToString(const Enumeration enumVal);
53 static Enumeration ToValue(const std::wstring & valueString);
54
55 static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 6404762710716671877LL;
56 static const Safir::Dob::Typesystem::TypeId Checksum = -9187819218818002410LL;
57
58 //Check that there is no enumeration mismatch
59 //throws an exception if there is - ConfigurationErrorException
61
63 {
64 public:
66
67 //Will throw IllegalValueException if value is not in first .. last
69 {
70 if (value < FirstOrdinal() || value > LastOrdinal())
71 {
72 throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.InjectionKind does not have such a value",__WFILE__,__LINE__);
73 }
74 m_bIsNull = false;
75 m_bIsChanged = true;
76 m_Value = value;
77 }
78
80 {
81 if (IsNull())
82 {
83 throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
84 }
85 return m_Value;
86 }
87
88 //Will throw ConfigurationErrorException if there is an enumeration mismatch
89 void SetVal(const Enumeration value)
90 {
92 SetOrdinal(value);
93 }
94
95 //Will throw ConfigurationErrorException if there is an enumeration mismatch
97 {
99 return static_cast<Enumeration>(GetOrdinal());
100 }
101
102 //Will get the value if container is not null, else the supplied default value is returned.
104 {
106 return IsNull() ? defaultVal : static_cast<Enumeration>(GetOrdinal());
107 }
108
109 //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
110 bool operator==(const Enumeration other) const
111 {CheckForMismatch(); return !IsNull() && m_Value == other;}
112
113 bool operator != (const Enumeration other) const
114 {return !(*this == other);}
115 };
116
119
120 };
121 static inline bool operator==(const InjectionKind::Enumeration first, const InjectionKind::EnumerationContainer& second)
122 {return second == first;}
123
124 static inline bool operator!=(const InjectionKind::Enumeration first, const InjectionKind::EnumerationContainer& second)
125 {return !(first == second);}
126
127} // Dob
128} // Safir
129
130
#define __WFILE__
Definition Exceptions.h:31
#define SAFIR_GENERATED_Core_API
Definition BackdoorCommand.h:18
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
static bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer &second)
Definition CallbackId.h:139
static bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer &second)
Definition CallbackId.h:142
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition Defs.h:270
DotsC_Int32 Int32
32 bit integer type.
Definition Defs.h:66
DotsC_TypeId TypeId
A unique type identifier.
Definition Defs.h:218
STL container for arrays of DOB-containers.
Definition ArrayContainer.h:59
bool m_bIsChanged
The variable containing the change flag.
Definition ContainerBase.h:134
Base class for containers of enumeration values.
Definition EnumerationContainerBase.h:51
bool IsNull() const override
Is the container set to null?
Definition EnumerationContainerBase.h:82
bool m_bIsNull
The null flag for the enumeration container.
Definition EnumerationContainerBase.h:126
EnumerationValue m_Value
The value of the enumeration container.
Definition EnumerationContainerBase.h:132
A parameter in the call was invalid.
Definition Exceptions.h:264
Thrown when an application attempts to get the value of a member that is null.
Definition Exceptions.h:396
Container for sequences of enumeration values.
Definition SequenceContainer.h:366
See the SDK Core Users Guide for information on what these values mean.
Definition InjectionKind.h:35
Safir::Dob::Typesystem::EnumerationSequenceContainer< InjectionKind > EnumerationSequenceContainer
Definition InjectionKind.h:118
static std::wstring ToString(const Enumeration enumVal)
static const Safir::Dob::Typesystem::TypeId Checksum
Definition InjectionKind.h:56
static const Safir::Dob::Typesystem::TypeId EnumerationTypeId
Definition InjectionKind.h:55
static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal()
static Safir::Dob::Typesystem::EnumerationValue LastOrdinal()
static Enumeration ToValue(const std::wstring &valueString)
static Enumeration Last()
static Safir::Dob::Typesystem::Int32 Size()
Enumeration
Definition InjectionKind.h:37
@ None
Definition InjectionKind.h:38
@ SynchronousVolatile
Definition InjectionKind.h:39
@ SynchronousPermanent
Definition InjectionKind.h:40
@ Injectable
Definition InjectionKind.h:41
Safir::Dob::Typesystem::ArrayContainer< EnumerationContainer > EnumerationContainerArray
Definition InjectionKind.h:117
static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum=Checksum)
static Enumeration First()
Enumeration ContainedType
Definition InjectionKind.h:65
void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value) override
Set the ordinal value of the enumeration container.
Definition InjectionKind.h:68
Enumeration GetValOrDefault(const Enumeration defaultVal) const
Definition InjectionKind.h:103
bool operator==(const Enumeration other) const
Definition InjectionKind.h:110
void SetVal(const Enumeration value)
Definition InjectionKind.h:89
Enumeration GetVal() const
Definition InjectionKind.h:96
Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const override
Get the ordinal value of the enumeration container.
Definition InjectionKind.h:79