Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8fb6861578b9c4241ccc693c282da710df978218
[simgrid.git] / src / include / surf / surf_resource.h
1
2 /* Copyright (c) 2009 The SimGrid Team. 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 #include "surf/surf.h"
8 #ifndef SURF_RESOURCE_H
9 #define SURF_RESOURCE_H
10
11 static XBT_INLINE void surf_resource_free(void* r) {
12   surf_resource_t resource = r;
13   if (resource->name)
14     free(resource->name);
15   if (resource->properties)
16     xbt_dict_free(&resource->properties);
17   free(resource);
18 }
19
20 static XBT_INLINE const char *surf_resource_name(const void *resource) {
21   return ((surf_resource_t)resource)->name;
22 }
23
24 static XBT_INLINE xbt_dict_t surf_resource_properties(const void *resource) {
25   return ((surf_resource_t)resource)->properties;
26 }
27
28 #endif /* SURF_RESOURCE_H */