Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'master' and 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / smpi / smpi_info.cpp
index 0171e11..584ab1f 100644 (file)
@@ -1,18 +1,16 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
+/* Copyright (c) 2007-2017. 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. */
 
-#include "private.h"
-#include <vector>
-#include <xbt/ex.hpp>
+#include "src/smpi/smpi_info.hpp"
+#include "xbt/ex.hpp"
+#include "xbt/sysdep.h"
 
 namespace simgrid{
 namespace smpi{
 
-MPI_Info Info::null_id_=MPI_INFO_NULL;
-
 Info::Info():refcount_(1){
   dict_= xbt_dict_new_homogeneous(xbt_free_f);
 }
@@ -31,8 +29,8 @@ Info::~Info(){
   xbt_dict_free(&dict_);
 }
 
-void Info::ref(Info* info){
-  info->refcount_++;
+void Info::ref(){
+  refcount_++;
 }
 
 void Info::unref(Info* info){
@@ -46,8 +44,6 @@ void Info::set(char *key, char *value){
   xbt_dict_set(dict_, key, xbt_strdup(value), nullptr);
 }
 
-
-
 int Info::get(char *key, int valuelen, char *value, int *flag){
   *flag=false;
   char* tmpvalue=static_cast<char*>(xbt_dict_get_or_null(dict_, key));
@@ -93,7 +89,7 @@ int Info::get_nthkey(int n, char *key){
 
 int Info::get_valuelen(char *key, int *valuelen, int *flag){
   *flag=false;
-  char* tmpvalue=(char*)xbt_dict_get_or_null(dict_, key);
+  char* tmpvalue=static_cast<char*>(xbt_dict_get_or_null(dict_, key));
   if(tmpvalue){
     *valuelen=strlen(tmpvalue);
     *flag=true;
@@ -101,6 +97,10 @@ int Info::get_valuelen(char *key, int *valuelen, int *flag){
   return MPI_SUCCESS;
 }
 
+Info* Info::f2c(int id){
+  return static_cast<Info*>(F2C::f2c(id));
+}
+
 }
 }