-/* Copyright (c) 2014-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2023. 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. */
#include "src/mc/remote/RemotePtr.hpp"
#include "src/mc/sosp/PageStore.hpp"
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
/** A byte-string represented as a sequence of chunks from a PageStore
*
}
ChunkedData& operator=(ChunkedData&& that) noexcept
{
- this->clear();
- store_ = that.store_;
- that.store_ = nullptr;
- pagenos_ = std::move(that.pagenos_);
- that.pagenos_.clear();
+ if (this != &that) {
+ this->clear();
+ store_ = that.store_;
+ that.store_ = nullptr;
+ pagenos_ = std::move(that.pagenos_);
+ that.pagenos_.clear();
+ }
return *this;
}
/** Get a view of the chunk indices */
const std::size_t* pagenos() const { return pagenos_.data(); }
- /** Get a a pointer to a chunk */
+ /** Get a pointer to a chunk */
void* page(std::size_t i) const { return store_->get_page(pagenos_[i]); }
ChunkedData(PageStore& store, const AddressSpace& as, RemotePtr<void> addr, std::size_t page_count);
};
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc
#endif