Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CallbackId.h
Go to the documentation of this file.
1 #ifndef SAFIR_DOB_CALLBACKID_H_INCLUDED
2 #define SAFIR_DOB_CALLBACKID_H_INCLUDED
3 
8 
9 #ifdef _MSC_VER
10 #ifdef DOTS_GENERATED_CPP_EXPORTS
11 #define GENERATED_API __declspec(dllexport)
12 #else
13 #define GENERATED_API __declspec(dllimport)
14 #ifdef _DEBUG
15 #pragma comment( lib, "dots_generated-Safir-cppd.lib" )
16 #else
17 #pragma comment( lib, "dots_generated-Safir-cpp.lib" )
18 #endif
19 #endif
20 #endif
21 #ifdef __GNUC__
22 #define GENERATED_API
23 #endif
24 
28 namespace Safir
29 {
33 namespace Dob
34 {
35 
40  struct GENERATED_API CallbackId
41  {
43  {
44  OnRevokedRegistration = 0,
65  None
66  };
67 
68 
69  static Safir::Dob::Typesystem::Int32 Size();
70  static Enumeration First();
71  static Enumeration Last();
72 
73  static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal();
74  static Safir::Dob::Typesystem::EnumerationValue LastOrdinal();
75 
76  static std::wstring ToString(const Enumeration enumVal);
77  static Enumeration ToValue(const std::wstring & valueString);
78 
79  static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 5970308908204850637LL;
80  static const Safir::Dob::Typesystem::TypeId Checksum = -7711619466390804334LL;
81 
82  //Check that there is no enumeration mismatch
83  //throws an exception if there is - ConfigurationErrorException
84  static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum = Checksum);
85 
87  {
88  public:
90  //Will throw IllegalValueException if value is not in first .. last
92  {
93  if (value < FirstOrdinal() || value > LastOrdinal())
94  {
95  throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.CallbackId does not have such a value",__WFILE__,__LINE__);
96  }
97  m_bIsNull = false;
98  m_bIsChanged = true;
99  m_Value = value;
100  }
101 
103  {
104  if (IsNull())
105  {
106  throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
107  }
108  return m_Value;
109  }
110 
111  //Will throw ConfigurationErrorException if there is an enumeration mismatch
112  void SetVal(const Enumeration value)
113  {
114  CheckForMismatch();
115  SetOrdinal(value);
116  }
117 
118  //Will throw ConfigurationErrorException if there is an enumeration mismatch
120  {
121  CheckForMismatch();
122  return static_cast<Enumeration>(GetOrdinal());
123  }
124 
125  //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
126  bool operator==(const Enumeration other) const
127  {CheckForMismatch(); return !IsNull() && m_Value == other;}
128 
129  bool operator != (const Enumeration other) const
130  {return !(*this == other);}
131  };
132 
134 
135  };
136  static inline bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
137  {return second == first;}
138 
139  static inline bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
140  {return !(first == second);}
141 
142 } // Dob
143 } // Safir
144 
145 #endif
146 
Definition: CallbackId.h:63
Enumeration ContainedType
Definition: CallbackId.h:89
Definition: CallbackId.h:48
Definition: CallbackId.h:53
Definition: CallbackId.h:61
Definition: CallbackId.h:59
virtual void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value)
Set the ordinal value of the enumeration container.
Definition: CallbackId.h:91
DotsC_TypeId TypeId
A unique type identifier.
Definition: Dob/Typesystem/Defs.h:221
Definition: CallbackId.h:56
static bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:136
Definition: CallbackId.h:60
Definition: CallbackId.h:62
Ids for all callback routines for all Dob consumers.
Definition: CallbackId.h:40
Base class for containers of enumeration values.
Definition: EnumerationContainerBase.h:50
#define __WFILE__
Definition: Exceptions.h:31
Definition: CallbackId.h:47
Definition: CallbackId.h:55
A parameter in the call was invalid.
Definition: Exceptions.h:254
Definition: CallbackId.h:46
bool operator==(const Enumeration other) const
Definition: CallbackId.h:126
Enumeration
Definition: CallbackId.h:42
Definition: CallbackId.h:64
Thrown when an application attempts to get the value of a member that is null.
Definition: Exceptions.h:394
Enumeration GetVal() const
Definition: CallbackId.h:119
void SetVal(const Enumeration value)
Definition: CallbackId.h:112
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Dob/Typesystem/Defs.h:273
Definition: CallbackId.h:54
virtual Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const
Get the ordinal value of the enumeration container.
Definition: CallbackId.h:102
STL container for arrays of DOB-containers.
Definition: ArrayContainer.h:58
DotsC_Int32 Int32
32 bit integer type.
Definition: Dob/Typesystem/Defs.h:69
static bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:139
Safir::Dob::Typesystem::ArrayContainer< EnumerationContainer > EnumerationContainerArray
Definition: CallbackId.h:133