Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
common-protocol-impl.hh
Go to the documentation of this file.
1#pragma once
10
11#include "common-protocol.hh"
13
14namespace nix {
15
16/* protocol-agnostic templates */
17
18#define COMMON_USE_LENGTH_PREFIX_SERIALISER(TEMPLATE, T) \
19 TEMPLATE T CommonProto::Serialise< T >::read(const StoreDirConfig & store, CommonProto::ReadConn conn) \
20 { \
21 return LengthPrefixedProtoHelper<CommonProto, T >::read(store, conn); \
22 } \
23 TEMPLATE void CommonProto::Serialise< T >::write(const StoreDirConfig & store, CommonProto::WriteConn conn, const T & t) \
24 { \
25 LengthPrefixedProtoHelper<CommonProto, T >::write(store, conn, t); \
26 }
27
28COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename T>, std::vector<T>)
29COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename T>, std::set<T>)
30COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename... Ts>, std::tuple<Ts...>)
31
32#define COMMA_ ,
33COMMON_USE_LENGTH_PREFIX_SERIALISER(
34 template<typename K COMMA_ typename V>,
35 std::map<K COMMA_ V>)
36#undef COMMA_
37
38
39/* protocol-specific templates */
40
41}