2 /* Copyright (c) 2009, 2010. The SimGrid Team.
3 * All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #ifndef SURF_RESOURCE_H
10 #define SURF_RESOURCE_H
13 surf_resource_t surf_resource_new(size_t childsize,
14 surf_model_t model, char *name, xbt_dict_t props) {
15 surf_resource_t res = xbt_malloc0(childsize);
18 res->properties = props;
22 static XBT_INLINE void surf_resource_free(void* r) {
23 surf_resource_t resource = r;
26 if (resource->properties)
27 xbt_dict_free(&resource->properties);
31 static XBT_INLINE const char *surf_resource_name(const void *resource) {
32 return ((surf_resource_t)resource)->name;
35 static XBT_INLINE xbt_dict_t surf_resource_properties(const void *resource) {
36 return ((surf_resource_t)resource)->properties;
39 #endif /* SURF_RESOURCE_H */