Nix 2.36.0
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
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( \
24 const StoreDirConfig & store, CommonProto::WriteConn conn, const T & t) \
25 { \
26 LengthPrefixedProtoHelper<CommonProto, T>::write(store, conn, t); \
27 }
28
29COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename T>, std::vector<T>)
30#define COMMA_ ,
31COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename T COMMA_ typename Compare>, std::set<T COMMA_ Compare>)
32COMMON_USE_LENGTH_PREFIX_SERIALISER(template<typename... Ts>, std::tuple<Ts...>)
33
34COMMON_USE_LENGTH_PREFIX_SERIALISER(
35 template<typename K COMMA_ typename V COMMA_ typename Compare>, std::map<K COMMA_ V COMMA_ Compare>)
36#undef COMMA_
37
38/* protocol-specific templates */
39
40} // namespace nix