X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fstlplus%2Fpersistence%2Fpersistent_vector.cpp;fp=src%2Fstlplus%2Fpersistence%2Fpersistent_vector.cpp;h=0000000000000000000000000000000000000000;hb=5846afb00833cc72fe72422ca896d2387c712cb4;hp=b983d378e3dec324837b80e51b8ef1ba19f54be2;hpb=a97500609dc3c1b11f9786d32bc458eb00de4c36;p=chaz%2Fyoink diff --git a/src/stlplus/persistence/persistent_vector.cpp b/src/stlplus/persistence/persistent_vector.cpp deleted file mode 100644 index b983d37..0000000 --- a/src/stlplus/persistence/persistent_vector.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// - -// Author: Andy Rushton -// Copyright: (c) Southampton University 1999-2004 -// (c) Andy Rushton 2004-2009 -// License: BSD License, see ../docs/license.html - -//////////////////////////////////////////////////////////////////////////////// -#include "persistent_vector.hpp" - -//////////////////////////////////////////////////////////////////////////////// -// specialisation for a vector of bool which has a different implementation to a vector of anything else - -void stlplus::dump_vector_bool(stlplus::dump_context& context, const std::vector& data) - throw(stlplus::persistent_dump_failed) -{ - stlplus::dump_unsigned(context,data.size()); - unsigned size = data.size(); - unsigned bytes = ((size + 7) / 8); - for (unsigned b = 0; b < bytes; b++) - { - unsigned char byte = 0; - unsigned char mask = 1; - for (unsigned e = 0; e < 8; e++) - { - unsigned i = b*8 + e; - if (i >= size) break; - if (data[i]) byte |= mask; - mask <<= 1; - } - context.put(byte); - } -} - -void stlplus::restore_vector_bool(stlplus::restore_context& context, std::vector& data) - throw(stlplus::persistent_restore_failed) -{ - unsigned size = 0; - stlplus::restore_unsigned(context,size); - data.resize(size); - unsigned bytes = ((size + 7) / 8); - for (unsigned b = 0; b < bytes; b++) - { - unsigned char byte = context.get(); - unsigned char mask = 1; - for (unsigned e = 0; e < 8; e++) - { - unsigned i = b*8 + e; - if (i >= size) break; - data[i] = ((byte & mask) != 0); - mask <<= 1; - } - } -} - -////////////////////////////////////////////////////////////////////////////////