X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8fea398a5a9ca83c4e6009daf964d59869388e6c..e2680c4776709548e15f400af83ffe4a2cf5eb49:/src/surf/FileImpl.hpp diff --git a/src/surf/FileImpl.hpp b/src/surf/FileImpl.hpp index 938a1b5945..eea45fccd2 100644 --- a/src/surf/FileImpl.hpp +++ b/src/surf/FileImpl.hpp @@ -7,6 +7,9 @@ #ifndef SRC_SURF_FILEIMPL_HPP_ #define SRC_SURF_FILEIMPL_HPP_ +#include "surf/surf.h" +#include + namespace simgrid { namespace surf { @@ -23,11 +26,28 @@ public: void setPosition(sg_size_t size) { current_position_ = size; } void incrPosition(sg_size_t incr) { current_position_ += incr; } sg_size_t tell() { return current_position_; } + int seek(sg_offset_t offset, int origin) + { + switch (origin) { + case SEEK_SET: + current_position_ = offset; + return 0; + case SEEK_CUR: + current_position_ += offset; + return 0; + case SEEK_END: + current_position_ = size_ + offset; + return 0; + default: + return -1; + } + } + private: std::string path_; std::string mount_point_; sg_size_t size_; - sg_size_t current_position_ = 0; + sg_size_t current_position_ = SEEK_SET; }; } }