Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PersistenceBackend.h
Go to the documentation of this file.
1 #ifndef SAFIR_DOB_PERSISTENCEBACKEND_H_INCLUDED
2 #define SAFIR_DOB_PERSISTENCEBACKEND_H_INCLUDED
3 
8 
9 #include <Safir/Utilities/Internal/VisibilityHelpers.h>
10 
11 #ifdef dots_generated_Safir_cpp_EXPORTS
12 # define DOTS_GENERATED_Safir_API SAFIR_HELPER_DLL_EXPORT
13 #else
14 # define DOTS_GENERATED_Safir_API SAFIR_HELPER_DLL_IMPORT
15 # define SAFIR_LIBRARY_NAME "dots_generated-Safir-cpp"
16 # include <Safir/Utilities/Internal/AutoLink.h>
17 #endif
18 #define DOTS_GENERATED_Safir_API_LOCAL SAFIR_HELPER_DLL_LOCAL
19 
23 namespace Safir
24 {
28 namespace Dob
29 {
30 
36  {
38  {
39  File = 0,
40  Odbc
41  };
42 
43 
44  static Safir::Dob::Typesystem::Int32 Size();
45  static Enumeration First();
46  static Enumeration Last();
47 
48  static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal();
49  static Safir::Dob::Typesystem::EnumerationValue LastOrdinal();
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 = -6966767758476590319LL;
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  //Will throw IllegalValueException if value is not in first .. last
67  {
68  if (value < FirstOrdinal() || value > LastOrdinal())
69  {
70  throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.PersistenceBackend does not have such a value",__WFILE__,__LINE__);
71  }
72  m_bIsNull = false;
73  m_bIsChanged = true;
74  m_Value = value;
75  }
76 
78  {
79  if (IsNull())
80  {
81  throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
82  }
83  return m_Value;
84  }
85 
86  //Will throw ConfigurationErrorException if there is an enumeration mismatch
87  void SetVal(const Enumeration value)
88  {
89  CheckForMismatch();
90  SetOrdinal(value);
91  }
92 
93  //Will throw ConfigurationErrorException if there is an enumeration mismatch
95  {
96  CheckForMismatch();
97  return static_cast<Enumeration>(GetOrdinal());
98  }
99 
100  //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
101  bool operator==(const Enumeration other) const
102  {CheckForMismatch(); return !IsNull() && m_Value == other;}
103 
104  bool operator != (const Enumeration other) const
105  {return !(*this == other);}
106  };
107 
109 
110  };
112  {return second == first;}
113 
115  {return !(first == second);}
116 
117 } // Dob
118 } // Safir
119 
120 #endif
121 
Enumeration ContainedType
Definition: PersistenceBackend.h:64
#define DOTS_GENERATED_Safir_API
Definition: PersistenceBackend.h:14
Enumeration
Definition: PersistenceBackend.h:37
Definition: PersistenceBackend.h:61
DotsC_TypeId TypeId
A unique type identifier.
Definition: Defs.h:219
static bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:131
Base class for containers of enumeration values.
Definition: EnumerationContainerBase.h:50
#define __WFILE__
Definition: Exceptions.h:31
A parameter in the call was invalid.
Definition: Exceptions.h:254
Enumeration GetVal() const
Definition: PersistenceBackend.h:94
void SetVal(const Enumeration value)
Definition: PersistenceBackend.h:87
Enumerates the different backends that DOPE can use for persistence.
Definition: PersistenceBackend.h:35
virtual void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value)
Set the ordinal value of the enumeration container.
Definition: PersistenceBackend.h:66
Thrown when an application attempts to get the value of a member that is null.
Definition: Exceptions.h:394
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Defs.h:271
virtual Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const
Get the ordinal value of the enumeration container.
Definition: PersistenceBackend.h:77
bool operator==(const Enumeration other) const
Definition: PersistenceBackend.h:101
STL container for arrays of DOB-containers.
Definition: ArrayContainer.h:58
DotsC_Int32 Int32
32 bit integer type.
Definition: Defs.h:67
static bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:134
Safir::Dob::Typesystem::ArrayContainer< EnumerationContainer > EnumerationContainerArray
Definition: PersistenceBackend.h:108