Turi Create  4.0
ipc_deserializer_minimal.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef CPPIPC_IPC_DESERIALIZER_MINIMAL_HPP
7 #define CPPIPC_IPC_DESERIALIZER_MINIMAL_HPP
8 #include <type_traits>
9 #include <core/storage/serialization/iarchive.hpp>
10 #include <core/system/cppipc/ipc_object_base.hpp>
11 
12 namespace turi {
13 namespace archive_detail {
14 
15 template <typename OutArcType, typename T>
16 struct serialize_impl<OutArcType, std::shared_ptr<T>, false,
17  typename std::enable_if<std::is_convertible<T*, cppipc::ipc_object_base*>::value>::type
18  > {
19  inline static
20  void
21  exec(OutArcType& oarc, const std::shared_ptr<T> value) {
22  oarc << (*value);
23  }
24 };
25 
26 
27 template <typename InArcType, typename T>
28 struct deserialize_impl<InArcType, std::shared_ptr<T>, false,
29  typename std::enable_if<std::is_convertible<T*, cppipc::ipc_object_base*>::value>::type
30  > {
31  inline static
32  void exec(InArcType& iarc, std::shared_ptr<T>& value) {
33  iarc >> (*value);
34  }
35 };
36 } // archive_detail
37 } // turicreate
38 
39 #endif
STL namespace.