-/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
void* extra_state;
int refcount;
bool deleted;
+ bool delete_attr; // if true, xbt_free(attr) on delete: used by Fortran bindings
};
namespace simgrid{
// static int keyval_id_;
template <typename T>
static int keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval,
- void* extra_state);
+ void* extra_state, bool delete_attr = false);
template <typename T> static int keyval_free(int* keyval);
template <typename T> int attr_delete(int keyval);
template <typename T> int attr_get(int keyval, void* attr_value, int* flag);
};
template <typename T>
-int Keyval::keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval, void* extra_state)
+int Keyval::keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval, void* extra_state,
+ bool delete_attr)
{
smpi_key_elem value;
value.copy_fn = copy_fn;
value.extra_state = extra_state;
value.refcount = 0;
value.deleted = false;
+ value.delete_attr = delete_attr;
*keyval = T::keyval_id_;
T::keyvals_.emplace(*keyval, std::move(value));