Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Name: gdalantirecursion.h 4 : * Project: GDAL Core 5 : * Purpose: GDAL Core C++/Private declarations. 6 : * Author: Frank Warmerdam, warmerdam@pobox.com 7 : * 8 : ****************************************************************************** 9 : * Copyright (c) 1998, Frank Warmerdam 10 : * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com> 11 : * 12 : * SPDX-License-Identifier: MIT 13 : ****************************************************************************/ 14 : 15 : #ifndef GDALANTIRECURSION_H_INCLUDED 16 : #define GDALANTIRECURSION_H_INCLUDED 17 : 18 : #include <string> 19 : 20 : /************************************************************************/ 21 : /* GDALAntiRecursionGuard */ 22 : /************************************************************************/ 23 : 24 : //! @cond Doxygen_Suppress 25 : struct GDALAntiRecursionStruct; 26 : 27 : class GDALAntiRecursionGuard 28 : { 29 : GDALAntiRecursionStruct *m_psAntiRecursionStruct; 30 : std::string m_osIdentifier; 31 : int m_nDepth; 32 : 33 : GDALAntiRecursionGuard(const GDALAntiRecursionGuard &) = delete; 34 : GDALAntiRecursionGuard &operator=(const GDALAntiRecursionGuard &) = delete; 35 : 36 : public: 37 : explicit GDALAntiRecursionGuard(const std::string &osIdentifier); 38 : GDALAntiRecursionGuard(const GDALAntiRecursionGuard &other, 39 : const std::string &osIdentifier); 40 : ~GDALAntiRecursionGuard(); 41 : 42 528666 : int GetCallDepth() const 43 : { 44 528666 : return m_nDepth; 45 : } 46 : }; 47 : 48 : //! @endcond 49 : 50 : #endif