From fa5d86d82195e3bb2b4e54273eaaa1e2ee5cd9a3 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Wed, 28 Sep 2016 15:55:08 -0400 Subject: [PATCH] define interprocess vector packing --- include/fc/interprocess/container.hpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/include/fc/interprocess/container.hpp b/include/fc/interprocess/container.hpp index d9b5bfa..32f6a95 100644 --- a/include/fc/interprocess/container.hpp +++ b/include/fc/interprocess/container.hpp @@ -1,14 +1,13 @@ #pragma once -#include #include - #include #include #include #include #include #include +#include namespace fc { @@ -72,4 +71,27 @@ namespace fc { from_variant( vars[i], d[i] ); } } + + namespace raw { + namespace bip = boost::interprocess; + + template + inline void pack( Stream& s, const bip::vector& value ) { + pack( s, unsigned_int((uint32_t)value.size()) ); + auto itr = value.begin(); + auto end = value.end(); + while( itr != end ) { + fc::raw::pack( s, *itr ); + ++itr; + } + } + template + inline void unpack( Stream& s, bip::vector& value ) { + unsigned_int size; + unpack( s, size ); + value.clear(); value.resize(size); + for( auto& item : value ) + fc::raw::unpack( s, item ); + } + } }