X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/206d7d160214aa24cde2adc4dfc25a3b4abba2cd..4bcfd40036f842e976d329cd0cee7349b8e0f4d6:/src/mc/AddressSpace.hpp diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index 5c4f51529d..a7658e6a8f 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2008-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2008-2019. 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. */ @@ -7,17 +6,8 @@ #ifndef SIMGRID_MC_ADDRESS_SPACE_H #define SIMGRID_MC_ADDRESS_SPACE_H -#include -#include -#include -#include -#include - -#include -#include - #include "src/mc/mc_forward.hpp" -#include "src/mc/RemotePtr.hpp" +#include "src/mc/remote/RemotePtr.hpp" namespace simgrid { namespace mc { @@ -50,7 +40,7 @@ class ReadOptions { public: constexpr ReadOptions() : value_(0) {} - constexpr operator bool() const { return value_ != 0; } + explicit constexpr operator bool() const { return value_ != 0; } constexpr bool operator!() const { return value_ == 0; } constexpr ReadOptions operator|(ReadOptions const& that) const @@ -109,16 +99,17 @@ public: */ class AddressSpace { private: - Process* process_; + RemoteClient* process_; + public: - AddressSpace(Process* process) : process_(process) {} - virtual ~AddressSpace(); + explicit AddressSpace(RemoteClient* process) : process_(process) {} + virtual ~AddressSpace() = default; - /** The process of this addres space + /** The process of this address space * * This is where we can get debug informations, memory layout, etc. */ - simgrid::mc::Process* process() const { return process_; } + simgrid::mc::RemoteClient* process() const { return process_; } /** Read data from the address space * @@ -160,11 +151,10 @@ public: /** Read a string of known size */ std::string read_string(RemotePtr address, std::size_t len) const { - // TODO, use std::vector with .data() in C++17 to avoid useless copies - std::vector buffer(len); - buffer[len] = '\0'; - this->read_bytes(buffer.data(), len, address); - return std::string(buffer.data(), buffer.size()); + std::string res; + res.resize(len); + this->read_bytes(&res[0], len, address); + return res; } };