33 #ifndef EMANECONTROLPORTANYUTILS_HEADER_ 34 #define EMANECONTROLPORTANYUTILS_HEADER_ 36 #include "remotecontrolportapi.pb.h" 48 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT8:
51 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT8:
54 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT16:
57 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT16:
60 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT32:
63 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT32:
66 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT64:
69 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT64:
72 case EMANERemoteControlPortAPI::Any::TYPE_ANY_FLOAT:
75 case EMANERemoteControlPortAPI::Any::TYPE_ANY_DOUBLE:
78 case EMANERemoteControlPortAPI::Any::TYPE_ANY_STRING:
81 case EMANERemoteControlPortAPI::Any::TYPE_ANY_BOOLEAN:
84 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INETADDR:
96 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT8:
97 return Any{
static_cast<std::int8_t
>(any.i32value())};
99 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT8:
100 return Any{
static_cast<std::uint8_t
>(any.u32value())};
102 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT16:
103 return Any{
static_cast<std::int16_t
>(any.i32value())};
105 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT16:
106 return Any{
static_cast<std::uint16_t
>(any.u32value())};
108 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT32:
109 return Any{
static_cast<std::int32_t
>(any.i32value())};
111 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT32:
112 return Any{
static_cast<std::uint32_t
>(any.u32value())};
114 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INT64:
115 return Any{any.i64value()};
117 case EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT64:
118 return Any{any.u64value()};
120 case EMANERemoteControlPortAPI::Any::TYPE_ANY_FLOAT:
121 return Any{any.fvalue()};
123 case EMANERemoteControlPortAPI::Any::TYPE_ANY_DOUBLE:
124 return Any{any.dvalue()};
126 case EMANERemoteControlPortAPI::Any::TYPE_ANY_STRING:
127 return Any{any.svalue()};
129 case EMANERemoteControlPortAPI::Any::TYPE_ANY_BOOLEAN:
132 case EMANERemoteControlPortAPI::Any::TYPE_ANY_INETADDR:
146 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_INT64);
147 pAny->set_i64value(any.
asINT64());
151 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT64);
156 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_INT32);
157 pAny->set_i32value(any.
asINT32());
161 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT32);
166 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_INT16);
167 pAny->set_i32value(any.
asINT16());
171 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT16);
176 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_INT8);
177 pAny->set_i32value(any.
asINT8());
181 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_UINT8);
182 pAny->set_u32value(any.
asUINT8());
186 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_FLOAT);
187 pAny->set_fvalue(any.
asFloat());
191 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_DOUBLE);
196 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_INETADDR);
203 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_BOOLEAN);
204 pAny->set_bvalue(any.
asBool());
208 pAny->set_type(EMANERemoteControlPortAPI::Any::TYPE_ANY_STRING);
221 #endif // EMANECONTROLPORTANYUTILS_HEADER_ std::uint16_t asUINT16() const
std::uint8_t asUINT8() const
Any toAny(EMANERemoteControlPortAPI::Any any)
std::int32_t asINT32() const
INETAddr asINETAddr() const
std::string asString() const
std::string str(bool bWithPort=true) const
std::uint64_t asUINT64() const
Any::Type toAnyType(EMANERemoteControlPortAPI::Any::AnyType type)
std::uint32_t asUINT32() const
void convertToAny(EMANERemoteControlPortAPI::Any *pAny, const EMANE::Any &any)
std::int64_t asINT64() const
std::int8_t asINT8() const
AnyException is thrown when an exception occurs during creation or conversion of an Any...
std::int16_t asINT16() const
The Any class can contain an instance of one of any type in its support type set. ...