From 0ee297eaef992265e8ccbf2cd4f8bde9a217a9fe Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 29 Dec 2018 19:27:30 +0100 Subject: Experimantal C API: add a proj_assign_context() for advanced usage --- src/ctx.cpp | 17 +++++++++++++++++ src/proj_experimental.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/src/ctx.cpp b/src/ctx.cpp index ab51d6c1..1742ee87 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -29,6 +29,7 @@ #include #include +#include "proj_experimental.h" #include "proj_internal.h" #include "projects.h" @@ -63,6 +64,22 @@ void pj_set_ctx( projPJ pj, projCtx ctx ) pj->ctx = ctx; } +/************************************************************************/ +/* proj_assign_context() */ +/************************************************************************/ + +/** \brief Re-assign a context to a PJ* object. + * + * This may be useful if the PJ* has been created with a context that is + * thread-specific, and is later used in another thread. In that case, + * the user may want to assign another thread-specific context to the + * object. + */ +void proj_assign_context( PJ* pj, PJ_CONTEXT* ctx ) +{ + pj_set_ctx( pj, ctx ); +} + /************************************************************************/ /* pj_get_default_ctx() */ /************************************************************************/ diff --git a/src/proj_experimental.h b/src/proj_experimental.h index 9c72dbfe..292a3baf 100644 --- a/src/proj_experimental.h +++ b/src/proj_experimental.h @@ -892,6 +892,12 @@ PJ_OBJ PROJ_DLL *proj_obj_create_conversion_equal_earth( /**@}*/ +/*! @cond Doxygen_Suppress */ + +void PROJ_DLL proj_assign_context( PJ* pj, PJ_CONTEXT* ctx ); + +/*! @endcond */ + #ifdef __cplusplus } #endif -- cgit v1.2.3