Skip to content

Commit f4b1f49

Browse files
committed
Remove experimental c++ trait-detection
1 parent 8342baf commit f4b1f49

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
@@ -360,10 +360,10 @@ namespace msgpack {
360360

361361
// ---------- CUSTOM format ----------
362362

363-
template <typename C>
364-
auto pack(const C& c) -> typename std::enable_if<has_to_msgpack<C, Packer&>::value>::type {
365-
c.to_msgpack(*this);
366-
}
363+
// template <typename C>
364+
// auto pack(const C& c) -> typename std::enable_if<has_to_msgpack<C, Packer&>::value>::type {
365+
// c.to_msgpack(*this);
366+
// }
367367

368368
// ---------- Array/Map Size format ----------
369369

src/MsgPack/Types.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,17 @@ namespace msgpack {
257257
MAP4 = 0x0F, // same as FIXMAP
258258
};
259259

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

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

272272
} // namespace msgpack
273273
} // namespace arduino

src/MsgPack/Unpacker.h

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

439439
// ---------- CUSTOM format ----------
440440

441-
template <typename C>
442-
auto unpack(C& c) -> typename std::enable_if<has_from_msgpack<C, Unpacker&>::value, bool>::type {
443-
c.from_msgpack(*this);
444-
return b_decode_success;
445-
}
441+
// template <typename C>
442+
// auto unpack(C& c) -> typename std::enable_if<has_from_msgpack<C, Unpacker&>::value, bool>::type {
443+
// c.from_msgpack(*this);
444+
// return b_decode_success;
445+
// }
446446

447447
// ---------- Array/Map Size format ----------
448448

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
@@ -48,7 +48,7 @@ class RpcFunctionWrapper: public IFunctionWrapper {
4848
// First check the parameters size
4949
if (!unpacker.isArray()){
5050
RpcError error(MALFORMED_CALL_ERR, "Unserializable parameters array");
51-
packer.serialize(error, nil);
51+
error.to_msgpack(packer);
5252
return false;
5353
}
5454

@@ -57,13 +57,13 @@ class RpcFunctionWrapper: public IFunctionWrapper {
5757
unpacker.deserialize(param_size);
5858
if (param_size.size() < sizeof...(Args)){
5959
RpcError error(MALFORMED_CALL_ERR, "Missing call parameters (WARNING: Default param resolution is not implemented)");
60-
packer.serialize(error, nil);
60+
error.to_msgpack(packer);
6161
return false;
6262
}
6363

6464
if (param_size.size() > sizeof...(Args)){
6565
RpcError error(MALFORMED_CALL_ERR, "Too many parameters");
66-
packer.serialize(error, nil);
66+
error.to_msgpack(packer);
6767
return false;
6868
}
6969

0 commit comments

Comments
 (0)