X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/48efae676c3604efffe21365b2d525e578fd22e5..872d65264714799b25eb231609c3f05bae3d03dc:/src/mc/AddressSpace.hpp?ds=sidebyside diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index a5ff9b382e..75fbcae0c7 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -7,6 +7,7 @@ #ifndef SIMGRID_MC_ADDRESS_SPACE_H #define SIMGRID_MC_ADDRESS_SPACE_H +#include #include #include #include @@ -90,6 +91,17 @@ public: static constexpr ReadOptions lazy() { return ReadOptions(1); } }; +/** A value read from another process */ +template +class Remote { +private: + char buffer[sizeof(T)]; +public: + void* data() { return buffer; } + const void* data() const { return buffer; } + constexpr std::size_t size() const { return sizeof(T); } +}; + /** A given state of a given process (abstract base class) * * Currently, this might either be: @@ -126,6 +138,12 @@ public: this->read_bytes(buffer, sizeof(T), ptr, process_index); } + template inline + void read(Remote& buffer, RemotePtr ptr, int process_index = ProcessIndexAny) + { + this->read_bytes(buffer.data(), sizeof(T), ptr, process_index); + } + /** Read a given data structure from the address space */ template inline T read(RemotePtr ptr, int process_index = ProcessIndexMissing)