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 #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 NodeStatus
41  {
43  {
44  Expected = 0,
47  Failed
48  };
49 
50 
51  static Safir::Dob::Typesystem::Int32 Size();
52  static Enumeration First();
53  static Enumeration Last();
54 
55  static Safir::Dob::Typesystem::EnumerationValue FirstOrdinal();
56  static Safir::Dob::Typesystem::EnumerationValue LastOrdinal();
57 
58  static std::wstring ToString(const Enumeration enumVal);
59  static Enumeration ToValue(const std::wstring & valueString);
60 
61  static const Safir::Dob::Typesystem::TypeId EnumerationTypeId = 216107201475599334LL;
62  static const Safir::Dob::Typesystem::TypeId Checksum = 6537638296577961497LL;
63 
64  //Check that there is no enumeration mismatch
65  //throws an exception if there is - ConfigurationErrorException
66  static void CheckForMismatch(const Safir::Dob::Typesystem::TypeId checksum = Checksum);
67 
69  {
70  public:
72  //Will throw IllegalValueException if value is not in first .. last
74  {
75  if (value < FirstOrdinal() || value > LastOrdinal())
76  {
77  throw Safir::Dob::Typesystem::IllegalValueException(L"The enumerated type Safir.Dob.NodeStatus does not have such a value",__WFILE__,__LINE__);
78  }
79  m_bIsNull = false;
80  m_bIsChanged = true;
81  m_Value = value;
82  }
83 
85  {
86  if (IsNull())
87  {
88  throw Safir::Dob::Typesystem::NullException(L"Value is null",__WFILE__,__LINE__);
89  }
90  return m_Value;
91  }
92 
93  //Will throw ConfigurationErrorException if there is an enumeration mismatch
94  void SetVal(const Enumeration value)
95  {
96  CheckForMismatch();
97  SetOrdinal(value);
98  }
99 
100  //Will throw ConfigurationErrorException if there is an enumeration mismatch
102  {
103  CheckForMismatch();
104  return static_cast<Enumeration>(GetOrdinal());
105  }
106 
107  //compare an enumerationcontainer with a value, will return false if the container is null or the values are not equal
108  bool operator==(const Enumeration other) const
109  {CheckForMismatch(); return !IsNull() && m_Value == other;}
110 
111  bool operator != (const Enumeration other) const
112  {return !(*this == other);}
113  };
114 
116 
117  };
118  static inline bool operator==(const NodeStatus::Enumeration first, const NodeStatus::EnumerationContainer second)
119  {return second == first;}
120 
121  static inline bool operator!=(const NodeStatus::Enumeration first, const NodeStatus::EnumerationContainer second)
122  {return !(first == second);}
123 
124 } // Dob
125 } // Safir
126 
127 #endif
128 
Definition: NodeStatus.h:46
Definition: NodeStatus.h:45
Enumerates the status provided for a node in the entity Safir.Dob.NodeInfo.
Definition: NodeStatus.h:40
DotsC_TypeId TypeId
A unique type identifier.
Definition: Dob/Typesystem/Defs.h:221
static bool operator==(const CallbackId::Enumeration first, const CallbackId::EnumerationContainer second)
Definition: CallbackId.h:136
virtual Safir::Dob::Typesystem::EnumerationValue GetOrdinal() const
Get the ordinal value of the enumeration container.
Definition: NodeStatus.h:84
Enumeration
Definition: NodeStatus.h:42
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:115
void SetVal(const Enumeration value)
Definition: NodeStatus.h:94
Thrown when an application attempts to get the value of a member that is null.
Definition: Exceptions.h:394
Enumeration ContainedType
Definition: NodeStatus.h:71
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Dob/Typesystem/Defs.h:273
virtual void SetOrdinal(const Safir::Dob::Typesystem::EnumerationValue value)
Set the ordinal value of the enumeration container.
Definition: NodeStatus.h:73
bool operator==(const Enumeration other) const
Definition: NodeStatus.h:108
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
Enumeration GetVal() const
Definition: NodeStatus.h:101