Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
WIP. crude surf_file_t to FileImpl conversion
[simgrid.git] / src / surf / FileImpl.hpp
1 /* Copyright (c) 2017. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SRC_SURF_FILEIMPL_HPP_
8 #define SRC_SURF_FILEIMPL_HPP_
9
10 namespace simgrid {
11 namespace surf {
12
13 class FileImpl {
14 public:
15   FileImpl(const char* path, const char* mount, sg_size_t size) : path_(path), mount_point_(mount), size_(size) {}
16   ~FileImpl() = default;
17
18   std::string name() { return path_; }
19   const char* cname() { return path_.c_str(); }
20   const char* mount() { return mount_point_.c_str(); }
21   sg_size_t size() { return size_; }
22   void setSize(sg_size_t size) { size_ = size; }
23   void setPosition(sg_size_t size) { current_position_ = size; }
24   void incrPosition(sg_size_t incr) { current_position_ += incr; }
25   sg_size_t tell() { return current_position_; }
26 private:
27   std::string path_;
28   std::string mount_point_;
29   sg_size_t size_;
30   sg_size_t current_position_ = 0;
31 };
32 }
33 }
34 #endif /* SRC_SURF_FILEIMPL_HPP_ */