11 #ifndef __OPC_UA_VARIANT_H__ 12 #define __OPC_UA_VARIANT_H__ 18 #include <boost/any.hpp> 67 typedef struct {
char array[2]; }
no;
69 template<
typename C>
static yes
test(
typename C::const_iterator *);
70 template<
typename C>
static no test(...);
72 static const bool value =
sizeof(test<T>(0)) ==
sizeof(yes);
79 template<
typename C>
static char (&
f(
typename std::enable_if <
80 std::is_same<decltype(
static_cast<typename C::const_iterator(C::*)() const
>(&C::begin)),
81 typename C::const_iterator(C::*)()
const>::value,
void >::type *))[1];
83 template<
typename C>
static char (&
f(...))[2];
85 template<
typename C>
static char (&g(
typename std::enable_if <
86 std::is_same<decltype(
static_cast<typename C::const_iterator(C::*)() const
>(&
C::end)),
87 typename C::const_iterator(C::*)()
const>::value,
void >::type *))[1];
89 template<
typename C>
static char (&g(...))[2];
91 static bool const beg_value =
sizeof(f<T>(0)) == 1;
92 static bool const end_value =
sizeof(g<T>(0)) == 1;
96 struct is_container_not_string : std::integral_constant < bool, has_const_iterator<T>::value && has_begin_end<T>::beg_value && has_begin_end<T>::end_value >
113 virtual void Visit(
bool val) = 0;
114 virtual void Visit(
const std::vector<bool> & val) = 0;
115 virtual void Visit(int8_t val) = 0;
116 virtual void Visit(
const std::vector<int8_t> & val) = 0;
117 virtual void Visit(uint8_t val) = 0;
118 virtual void Visit(
const std::vector<uint8_t> & val) = 0;
119 virtual void Visit(int16_t val) = 0;
120 virtual void Visit(
const std::vector<int16_t> & val) = 0;
121 virtual void Visit(uint16_t val) = 0;
122 virtual void Visit(
const std::vector<uint16_t> & val) = 0;
123 virtual void Visit(int32_t val) = 0;
124 virtual void Visit(
const std::vector<int32_t> & val) = 0;
125 virtual void Visit(uint32_t val) = 0;
126 virtual void Visit(
const std::vector<uint32_t> & val) = 0;
127 virtual void Visit(int64_t val) = 0;
128 virtual void Visit(
const std::vector<int64_t> & val) = 0;
129 virtual void Visit(uint64_t val) = 0;
130 virtual void Visit(
const std::vector<uint64_t> & val) = 0;
131 virtual void Visit(
float val) = 0;
132 virtual void Visit(
const std::vector<float> & val) = 0;
133 virtual void Visit(
double val) = 0;
134 virtual void Visit(
const std::vector<double> & val) = 0;
136 virtual void Visit(
const std::vector<std::string> & val) = 0;
137 virtual void Visit(
const DateTime & val) = 0;
138 virtual void Visit(
const std::vector<DateTime> & val) = 0;
139 virtual void Visit(
const Guid & val) = 0;
140 virtual void Visit(
const std::vector<Guid> & val) = 0;
141 virtual void Visit(
const ByteString & val) = 0;
142 virtual void Visit(
const std::vector<ByteString> & val) = 0;
143 virtual void Visit(
const NodeId & val) = 0;
144 virtual void Visit(
const std::vector<NodeId> & val) = 0;
145 virtual void Visit(
const StatusCode & val) = 0;
146 virtual void Visit(
const std::vector<StatusCode> & val) = 0;
148 virtual void Visit(
const std::vector<LocalizedText> & val) = 0;
150 virtual void Visit(
const std::vector<QualifiedName> & val) = 0;
151 virtual void Visit(
const Variant & val) = 0;
152 virtual void Visit(
const std::vector<Variant> & val) = 0;
154 virtual void Visit(
const std::vector<DiagnosticInfo> & val) = 0;
168 , Dimensions(var.Dimensions)
172 template <
typename T>
183 this->Value = variant.
Value;
188 template <
typename T>
228 template <
typename T>
231 return boost::any_cast<T>(
Value) == value;
241 return *
this ==
NodeId(
id);
246 return *
this ==
NodeId(
id);
251 return *
this ==
NodeId(
id);
256 return *
this ==
NodeId(
id);
260 template <
typename T>
263 return !(*
this == t);
266 bool IsArray()
const;
267 bool IsScalar()
const;
270 template <
typename T>
273 return boost::any_cast<T>(
Value);
276 template <
typename T>
277 explicit operator T()
const 292 #endif // __OPC_UA_VARIANT_H__
const uint8_t HAS_DIMENSIONS_MASK
const uint8_t HAS_ARRAY_MASK
bool operator==(const OpcUa::BrowseDescription &lhs, const OpcUa::BrowseDescription &rhs)
Variant & operator=(ReferenceId value)
Variant & operator=(ExpandedObjectId value)
Variant & operator=(ObjectId value)
bool operator==(ExpandedObjectId id) const
ObjectId VariantTypeToDataType(VariantType vt)
bool operator==(const T &value) const
bool operator==(ObjectId id) const
bool operator==(ReferenceId id) const
OPC UA Address space part. GNU LGPL.
bool operator==(MessageId id) const
std::vector< uint32_t > Dimensions
bool operator!=(const std::tm &tm1, const std::tm &tm2)
const uint8_t VALUE_TYPE_MASK
VariantType DataTypeToVariantType(const NodeId &dataType)
std::string ToString(const AttributeId &value)
Variant & operator=(const T &value)
Variant(const char *value)
bool operator==(const char *value) const
Variant & operator=(MessageId value)
Variant(const Variant &var)
Variant(ExpandedObjectId id)
Variant & operator=(const char *value)