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 #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  OnRevokedRegistration = 0,
60  None
61  };
62 
63 
64  static Safir::Dob::Typesystem::Int32 Size();
65  static Enumeration First();
66  static Enumeration Last();
67 
68  static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal();
69  static Safir::Dob::Typesystem::EnumerationValue LastOrdinal();
70 
71  static std::wstring ToString(const Enumeration enumVal);
72  static Enumeration ToValue(const std::wstring & valueString);
73 
74  static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 5970308908204850637LL;
75  static const Safir::Dob::Typesystem::TypeId Checksum = -7711619466390804334LL;
76 
77  //Check that there is no enumeration mismatch
78  //throws an exception if there is - ConfigurationErrorException
79  static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum = Checksum);
80 
82  {
83  public:
85  //Will throw IllegalValueException if value is not in first .. last
87  {
88  if (value < FirstOrdinal() || value > LastOrdinal())
89  {
90  throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.CallbackId does not have such a value",__WFILE__,__LINE__);
91  }
92  m_bIsNull = false;
93  m_bIsChanged = true;
94  m_Value = value;
95  }
96 
98  {
99  if (IsNull())
100  {
101  throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
102  }
103  return m_Value;
104  }
105 
106  //Will throw ConfigurationErrorException if there is an enumeration mismatch
107  void SetVal(const Enumeration value)
108  {
109  CheckForMismatch();
110  SetOrdinal(value);
111  }
112 
113  //Will throw ConfigurationErrorException if there is an enumeration mismatch
115  {
116  CheckForMismatch();
117  return static_cast<Enumeration>(GetOrdinal());
118  }
119 
120  //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
121  bool operator==(const Enumeration other) const
122  {CheckForMismatch(); return !IsNull() && m_Value == other;}
123 
124  bool operator != (const Enumeration other) const
125  {return !(*this == other);}
126  };
127 
129 
130  };
131  static inline bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
132  {return second == first;}
133 
134  static inline bool operator!=(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
135  {return !(first == second);}
136 
137 } // Dob
138 } // Safir
139 
140 #endif
141 
Definition: CallbackId.h:58
Enumeration ContainedType
Definition: CallbackId.h:84
Definition: CallbackId.h:43
Definition: CallbackId.h:48
Definition: CallbackId.h:56
Definition: CallbackId.h:54
virtual void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value)
Set the ordinal value of the enumeration container.
Definition: CallbackId.h:86
DotsC_TypeId TypeId
A unique type identifier.
Definition: Defs.h:219
Definition: CallbackId.h:51
static bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:131
#define DOTS_GENERATED_Safir_API
Definition: CallbackId.h:14
Definition: CallbackId.h:55
Definition: CallbackId.h:57
Ids for all callback routines for all Dob consumers.
Definition: CallbackId.h:35
Base class for containers of enumeration values.
Definition: EnumerationContainerBase.h:50
#define __WFILE__
Definition: Exceptions.h:31
Definition: CallbackId.h:42
Definition: CallbackId.h:50
A parameter in the call was invalid.
Definition: Exceptions.h:254
Definition: CallbackId.h:41
bool operator==(const Enumeration other) const
Definition: CallbackId.h:121
Enumeration
Definition: CallbackId.h:37
Definition: CallbackId.h:59
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:114
void SetVal(const Enumeration value)
Definition: CallbackId.h:107
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Defs.h:271
Definition: CallbackId.h:49
virtual Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const
Get the ordinal value of the enumeration container.
Definition: CallbackId.h:97
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: CallbackId.h:128