Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / include / simgrid / s4u / storage.hpp
1 /* Copyright (c) 2006-2015. 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 INCLUDE_SIMGRID_S4U_STORAGE_HPP_
8 #define INCLUDE_SIMGRID_S4U_STORAGE_HPP_
9
10 #include <boost/unordered_map.hpp>
11 #include "xbt/base.h"
12 #include "simgrid/simix.h"
13
14 namespace simgrid {
15 namespace s4u {
16
17 XBT_PUBLIC_CLASS Storage {
18 private:
19         Storage(std::string name, smx_storage_t inferior);
20         virtual ~Storage();
21 public:
22         /** Retrieve a Storage by its name. It must exist in the platform file */
23         static Storage &byName(const char* name);
24         const char *name();
25         sg_size_t size_free();
26         sg_size_t size_used();
27         /** Retrieve the total amount of space of this storage element */
28         sg_size_t size();
29
30         /* TODO: missing API:
31 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
32 XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char *name, char *value,void_f_pvoid_t free_ctn);
33 XBT_PUBLIC(const char *)MSG_storage_get_property_value(msg_storage_t storage, const char *name);
34 XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar(void);
35 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage);
36 XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
37 XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
38          */
39 protected:
40         smx_storage_t inferior();
41 private:
42         static boost::unordered_map<std::string, Storage *> *storages;
43         std::string p_name;
44         smx_storage_t p_inferior;
45
46
47 public:
48         void set_userdata(void *data) {p_userdata = data;}
49         void *userdata() {return p_userdata;}
50 private:
51         void *p_userdata = NULL;
52
53 };
54
55 } /* namespace s4u */
56 } /* namespace simgrid */
57
58 #endif /* INCLUDE_SIMGRID_S4U_STORAGE_HPP_ */