X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7b6d9a992f6c0c59eff98ba72868b5b9b93afa38..1acdb6e20d63bf8987e6fbcf65e40949831a206d:/include/xbt/dynar.h diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 8aa9d0db01..747e3185a6 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -1,18 +1,17 @@ /* dynar - a generic dynamic array */ -/* Copyright (c) 2004-2007, 2009-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2004-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. */ -#ifndef _XBT_DYNAR_H -#define _XBT_DYNAR_H +#ifndef XBT_DYNAR_H +#define XBT_DYNAR_H #include /* memcpy */ -#include "xbt/base.h" /* SG_BEGIN_DECL */ -#include "xbt/function_types.h" +#include /* SG_BEGIN_DECL */ +#include SG_BEGIN_DECL() @@ -23,10 +22,12 @@ SG_BEGIN_DECL() * * For performance concerns, the content of DynArr must be homogeneous (in contrary to dictionnaries -- see the * \ref XBT_dict section). You thus have to provide the function which will be used to free the content at - * structure creation (of type void_f_ppvoid_t or void_f_pvoid_t). + * structure creation (of type void_f_pvoid_t). + * + * @deprecated If you are using C++, you might want to use `std::vector` instead. * * \section XBT_dynar_exscal Example with scalar - * \dontinclude dynar.c + * \dontinclude dynar.cpp * * \skip Vars_decl * \skip dyn @@ -64,9 +65,11 @@ SG_BEGIN_DECL() typedef struct xbt_dynar_s *xbt_dynar_t; XBT_PUBLIC(xbt_dynar_t) xbt_dynar_new(const unsigned long elm_size, void_f_pvoid_t const free_f); +XBT_PUBLIC(void) xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f); XBT_PUBLIC(void) xbt_dynar_free(xbt_dynar_t * dynar); XBT_PUBLIC(void) xbt_dynar_free_voidp(void *dynar); XBT_PUBLIC(void) xbt_dynar_free_container(xbt_dynar_t * dynar); +XBT_PUBLIC(void) xbt_dynar_free_data(xbt_dynar_t dynar); XBT_PUBLIC(void) xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots); XBT_PUBLIC(void) xbt_dynar_dump(xbt_dynar_t dynar); @@ -258,15 +261,4 @@ xbt_dynar_foreach (dyn,cpt,str) { /** @} */ SG_END_DECL() -#ifdef __cplusplus -namespace simgrid { -namespace xbt { - inline void destroy(xbt_dynar_t s) - { - xbt_dynar_free(&s); - } -} -} -#endif - -#endif /* _XBT_DYNAR_H */ +#endif /* XBT_DYNAR_H */