- smpi_process_set_replaying(true);
-}
-
-int Comm::attr_delete(int keyval){
- smpi_comm_key_elem elem =
- static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==nullptr)
- return MPI_ERR_ARG;
- if(elem->delete_fn!=MPI_NULL_DELETE_FN){
- void* value = nullptr;
- int flag;
- if(this->attr_get(keyval, &value, &flag)==MPI_SUCCESS){
- int ret = elem->delete_fn(this, keyval, value, &flag);
- if(ret!=MPI_SUCCESS)
- return ret;
- }
- }
- if(attributes_==nullptr)
- return MPI_ERR_ARG;
-
- xbt_dict_remove_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int));
- return MPI_SUCCESS;
-}
-
-int Comm::attr_get(int keyval, void* attr_value, int* flag){
- smpi_comm_key_elem elem =
- static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==nullptr)
- return MPI_ERR_ARG;
- if(attributes_==nullptr){
- *flag=0;
- return MPI_SUCCESS;
- }
- try {
- *static_cast<void**>(attr_value) =
- xbt_dict_get_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int));
- *flag=1;
- }
- catch (xbt_ex& ex) {
- *flag=0;
- }
- return MPI_SUCCESS;
-}
-
-int Comm::attr_put(int keyval, void* attr_value){
- if(smpi_comm_keyvals==nullptr)
- smpi_comm_keyvals = xbt_dict_new_homogeneous(nullptr);
- smpi_comm_key_elem elem =
- static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==nullptr)
- return MPI_ERR_ARG;
- int flag;
- void* value = nullptr;
- this->attr_get(keyval, &value, &flag);
- if(flag!=0 && elem->delete_fn!=MPI_NULL_DELETE_FN){
- int ret = elem->delete_fn(this, keyval, value, &flag);
- if(ret!=MPI_SUCCESS)
- return ret;
- }
- if(attributes_==nullptr)
- attributes_ = xbt_dict_new_homogeneous(nullptr);
-
- xbt_dict_set_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
- return MPI_SUCCESS;