Skip to content

Commit b182527

Browse files
committed
Remove experimental c++ trait-detection
1 parent 132974d commit b182527

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/MsgPack/Packer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ namespace msgpack {
365365

366366
// ---------- CUSTOM format ----------
367367

368-
template <typename C>
369-
auto pack(const C& c) -> typename std::enable_if<has_to_msgpack<C, Packer&>::value>::type {
370-
c.to_msgpack(*this);
371-
}
368+
// template <typename C>
369+
// auto pack(const C& c) -> typename std::enable_if<has_to_msgpack<C, Packer&>::value>::type {
370+
// c.to_msgpack(*this);
371+
// }
372372

373373
// ---------- Array/Map Size format ----------
374374

src/MsgPack/Types.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,17 @@ namespace msgpack {
260260
MAP4 = 0x0F, // same as FIXMAP
261261
};
262262

263-
template <typename ClassType, typename ArgType>
264-
using has_to_msgpack_impl = typename std::enable_if<
265-
std::is_same<decltype(&ClassType::to_msgpack), void (ClassType::*)(ArgType) const>::value>::type;
266-
template <typename ClassType, typename ArgType>
267-
using has_to_msgpack = arx::is_detected<has_to_msgpack_impl, ClassType, ArgType>;
263+
// template <typename ClassType, typename ArgType>
264+
// using has_to_msgpack_impl = typename std::enable_if<
265+
// std::is_same<decltype(&ClassType::to_msgpack), void (ClassType::*)(ArgType) const>::value>::type;
266+
// template <typename ClassType, typename ArgType>
267+
// using has_to_msgpack = arx::is_detected<has_to_msgpack_impl, ClassType, ArgType>;
268268

269-
template <typename ClassType, typename ArgType>
270-
using has_from_msgpack_impl = typename std::enable_if<
271-
std::is_same<decltype(&ClassType::from_msgpack), void (ClassType::*)(ArgType)>::value>::type;
272-
template <typename ClassType, typename ArgType>
273-
using has_from_msgpack = arx::is_detected<has_from_msgpack_impl, ClassType, ArgType>;
269+
// template <typename ClassType, typename ArgType>
270+
// using has_from_msgpack_impl = typename std::enable_if<
271+
// std::is_same<decltype(&ClassType::from_msgpack), void (ClassType::*)(ArgType)>::value>::type;
272+
// template <typename ClassType, typename ArgType>
273+
// using has_from_msgpack = arx::is_detected<has_from_msgpack_impl, ClassType, ArgType>;
274274

275275
} // namespace msgpack
276276
} // namespace arduino

src/MsgPack/Unpacker.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,11 @@ namespace msgpack {
443443

444444
// ---------- CUSTOM format ----------
445445

446-
template <typename C>
447-
auto unpack(C& c) -> typename std::enable_if<has_from_msgpack<C, Unpacker&>::value, bool>::type {
448-
c.from_msgpack(*this);
449-
return b_decode_success;
450-
}
446+
// template <typename C>
447+
// auto unpack(C& c) -> typename std::enable_if<has_from_msgpack<C, Unpacker&>::value, bool>::type {
448+
// c.from_msgpack(*this);
449+
// return b_decode_success;
450+
// }
451451

452452
// ---------- Array/Map Size format ----------
453453

src/dispatcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class RpcFunctionDispatcher {
6161

6262
// handler not found
6363
MsgPack::object::nil_t nil;
64-
packer.serialize(RpcError(FUNCTION_NOT_FOUND_ERR, name), nil);
64+
RpcError(FUNCTION_NOT_FOUND_ERR, name).to_msgpack(packer);
6565
return false;
6666
}
6767

src/wrapper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class RpcFunctionWrapper<std::function<R(Args...)>>: public IFunctionWrapper {
5757
// First check the parameters size
5858
if (!unpacker.isArray()){
5959
RpcError error(MALFORMED_CALL_ERR, "Unserializable parameters array");
60-
packer.serialize(error, nil);
60+
error.to_msgpack(packer);
6161
return false;
6262
}
6363

@@ -66,13 +66,13 @@ class RpcFunctionWrapper<std::function<R(Args...)>>: public IFunctionWrapper {
6666
unpacker.deserialize(param_size);
6767
if (param_size.size() < sizeof...(Args)){
6868
RpcError error(MALFORMED_CALL_ERR, "Missing call parameters (WARNING: Default param resolution is not implemented)");
69-
packer.serialize(error, nil);
69+
error.to_msgpack(packer);
7070
return false;
7171
}
7272

7373
if (param_size.size() > sizeof...(Args)){
7474
RpcError error(MALFORMED_CALL_ERR, "Too many parameters");
75-
packer.serialize(error, nil);
75+
error.to_msgpack(packer);
7676
return false;
7777
}
7878

0 commit comments

Comments
 (0)