Safir SDK Core
Loading...
Searching...
No Matches
PersistenceBackend.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
35 {
37 {
38 None = 0,
40 Odbc
41 };
42
43
46 static Enumeration Last();
47
50
51 static std::wstring ToString(const Enumeration enumVal);
52 static Enumeration ToValue(const std::wstring & valueString);
53
54 static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 4878269954615058785LL;
55 static const Safir::Dob::Typesystem::TypeId Checksum = 8917522224469727486LL;
56
57 //Check that there is no enumeration mismatch
58 //throws an exception if there is - ConfigurationErrorException
59 static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum = Checksum);
60
62 {
63 public:
65
66 //Will throw IllegalValueException if value is not in first .. last
68 {
69 if (value < FirstOrdinal() || value > LastOrdinal())
70 {
71 throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.PersistenceBackend does not have such a value",__WFILE__,__LINE__);
72 }
73 m_bIsNull = false;
74 m_bIsChanged = true;
75 m_Value = value;
76 }
77
79 {
80 if (IsNull())
81 {
82 throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
83 }
84 return m_Value;
85 }
86
87 //Will throw ConfigurationErrorException if there is an enumeration mismatch
88 void SetVal(const Enumeration value)
89 {
90 CheckForMismatch();
91 SetOrdinal(value);
92 }
93
94 //Will throw ConfigurationErrorException if there is an enumeration mismatch
96 {
97 CheckForMismatch();
98 return static_cast<Enumeration>(GetOrdinal());
99 }
100
101 //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
102 bool operator==(const Enumeration other) const
103 {CheckForMismatch(); return !IsNull() && m_Value == other;}
104
105 bool operator != (const Enumeration other) const
106 {return !(*this == other);}
107 };
108
111
112 };
114 {return second == first;}
115
117 {return !(first == second);}
118
119} // Dob
120} // Safir
121
122
#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:132
static bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer &second)
Definition CallbackId.h:135
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
Base class for containers of enumeration values.
Definition EnumerationContainerBase.h:51
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:362
Enumerates the different backends that DOPE can use for persistence.
Definition PersistenceBackend.h:35
static Safir::Dob::Typesystem::Int32 Size()
static Safir::Dob::Typesystem::EnumerationValue LastOrdinal()
static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum=Checksum)
static std::wstring ToString(const Enumeration enumVal)
Safir::Dob::Typesystem::ArrayContainer< EnumerationContainer > EnumerationContainerArray
Definition PersistenceBackend.h:109
static Enumeration First()
Enumeration
Definition PersistenceBackend.h:37
@ File
Definition PersistenceBackend.h:39
Safir::Dob::Typesystem::EnumerationSequenceContainer< PersistenceBackend > EnumerationSequenceContainer
Definition PersistenceBackend.h:110
static Enumeration Last()
static Enumeration ToValue(const std::wstring &valueString)
static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal()
bool operator==(const Enumeration other) const
Definition PersistenceBackend.h:102
void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value) override
Set the ordinal value of the enumeration container.
Definition PersistenceBackend.h:67
Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const override
Get the ordinal value of the enumeration container.
Definition PersistenceBackend.h:78
Enumeration GetVal() const
Definition PersistenceBackend.h:95
void SetVal(const Enumeration value)
Definition PersistenceBackend.h:88
Enumeration ContainedType
Definition PersistenceBackend.h:64