X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3203ed1f4fb6f4617e94d5351661ba07e8b8f833..336a8849b0b57d576c5772a217ad13d0b8c9cc42:/src/mc/ChunkedData.hpp diff --git a/src/mc/ChunkedData.hpp b/src/mc/ChunkedData.hpp index 02e6bcc72e..bd35e3b5e5 100644 --- a/src/mc/ChunkedData.hpp +++ b/src/mc/ChunkedData.hpp @@ -1,3 +1,9 @@ +/* Copyright (c) 2014-2015. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + #ifndef SIMGRID_MC_CHUNKED_DATA_HPP #define SIMGRID_MC_CHUNKED_DATA_HPP @@ -13,18 +19,14 @@ namespace simgrid { namespace mc { +/** A byte-string represented as a sequence of chunks from a PageStor */ class ChunkedData { - PageStore* store_; + PageStore* store_ = nullptr; + /** Indices of the chunks */ std::vector pagenos_; public: - ChunkedData() : store_(nullptr) {} - ChunkedData(ChunkedData const& that) - { - store_ = that.store_; - pagenos_ = that.pagenos_; - for (std::size_t pageno : pagenos_) - store_->ref_page(pageno); - } + + ChunkedData() {} void clear() { for (std::size_t pageno : pagenos_) @@ -36,6 +38,14 @@ public: clear(); } + // Copy and move + ChunkedData(ChunkedData const& that) + { + store_ = that.store_; + pagenos_ = that.pagenos_; + for (std::size_t pageno : pagenos_) + store_->ref_page(pageno); + } ChunkedData(ChunkedData&& that) { store_ = that.store_; @@ -65,7 +75,6 @@ public: std::size_t page_count() const { return pagenos_.size(); } std::size_t pageno(std::size_t i) const { return pagenos_[i]; } const std::size_t* pagenos() const { return pagenos_.data(); } - std::size_t* pagenos() { return pagenos_.data(); } const void* page(std::size_t i) const {