Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NodeStatus.h
Go to the documentation of this file.
1 #ifndef SAFIR_DOB_NODESTATUS_H_INCLUDED
2 #define SAFIR_DOB_NODESTATUS_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  Expected = 0,
42  Failed
43  };
44 
45 
46  static Safir::Dob::Typesystem::Int32 Size();
47  static Enumeration First();
48  static Enumeration Last();
49 
50  static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal();
51  static Safir::Dob::Typesystem::EnumerationValue LastOrdinal();
52 
53  static std::wstring ToString(const Enumeration enumVal);
54  static Enumeration ToValue(const std::wstring & valueString);
55 
56  static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 216107201475599334LL;
57  static const Safir::Dob::Typesystem::TypeId Checksum = 6537638296577961497LL;
58 
59  //Check that there is no enumeration mismatch
60  //throws an exception if there is - ConfigurationErrorException
61  static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum = Checksum);
62 
64  {
65  public:
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.NodeStatus 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  {
91  CheckForMismatch();
92  SetOrdinal(value);
93  }
94 
95  //Will throw ConfigurationErrorException if there is an enumeration mismatch
97  {
98  CheckForMismatch();
99  return static_cast<Enumeration>(GetOrdinal());
100  }
101 
102  //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
103  bool operator==(const Enumeration other) const
104  {CheckForMismatch(); return !IsNull() && m_Value == other;}
105 
106  bool operator != (const Enumeration other) const
107  {return !(*this == other);}
108  };
109 
111 
112  };
113  static inline bool operator==(const NodeStatus::Enumeration first, const NodeStatus::EnumerationContainer second)
114  {return second == first;}
115 
116  static inline bool operator!=(const NodeStatus::Enumeration first, const NodeStatus::EnumerationContainer second)
117  {return !(first == second);}
118 
119 } // Dob
120 } // Safir
121 
122 #endif
123 
Definition: NodeStatus.h:41
#define DOTS_GENERATED_Safir_API
Definition: NodeStatus.h:14
Definition: NodeStatus.h:40
Enumerates the status provided for a node in the entity Safir.Dob.NodeInfo.
Definition: NodeStatus.h:35
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
virtual Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const
Get the ordinal value of the enumeration container.
Definition: NodeStatus.h:79
Enumeration
Definition: NodeStatus.h:37
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
Safir::Dob::Typesystem::ArrayContainer< EnumerationContainer > EnumerationContainerArray
Definition: NodeStatus.h:110
void SetVal(const Enumeration value)
Definition: NodeStatus.h:89
Thrown when an application attempts to get the value of a member that is null.
Definition: Exceptions.h:394
Enumeration ContainedType
Definition: NodeStatus.h:66
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Defs.h:271
virtual void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value)
Set the ordinal value of the enumeration container.
Definition: NodeStatus.h:68
bool operator==(const Enumeration other) const
Definition: NodeStatus.h:103
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
Enumeration GetVal() const
Definition: NodeStatus.h:96