X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bf0be0a4483ee7319c120d3b06cb68d6dce5b451..6fd166d6132c999bfa781b58a5372c7cbdfe36b2:/src/smpi/smpi_f2c.hpp diff --git a/src/smpi/smpi_f2c.hpp b/src/smpi/smpi_f2c.hpp new file mode 100644 index 0000000000..a013e04180 --- /dev/null +++ b/src/smpi/smpi_f2c.hpp @@ -0,0 +1,46 @@ +/* Handle Fortan - C conversion for MPI Types*/ + +/* Copyright (c) 2010, 2013-2015. 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. */ + +#ifndef SMPI_F2C_HPP_INCLUDED +#define SMPI_F2C_HPP_INCLUDED + +#include "private.h" + + +#define KEY_SIZE (sizeof(int) * 2 + 1) + +namespace simgrid{ +namespace smpi{ + +class F2C { + protected: + // We use a single lookup table for every type. + // Beware of collisions if id in mpif.h is not unique + static xbt_dict_t f2c_lookup_; + static int f2c_id_; + public: + static char* get_key(char* key, int id); + static char* get_key_id(char* key, int id); + static void delete_lookup(); + static xbt_dict_t lookup(); + + //Override these to handle specific values. + int add_f(); + static void free_f(int id); + int c2f(); + + //This method should be overriden in all subclasses + //to avoid casting the result when calling it. + //For the default one, the MPI_*_NULL returned is assumed to be NULL. + static F2C* f2c(int); +}; + +} +} + +#endif