aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-02 03:18:32 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-11-02 14:54:20 +0100
commitd9064c3de62982c461a36ed9997eab56d1cb9f85 (patch)
tree0689ff513a9de2c2cc9521ed447cded9ad9fd134 /include
parent00608cc1c892a0d0522ffd08127a4494d4844e19 (diff)
downloadPROJ-d9064c3de62982c461a36ed9997eab56d1cb9f85.tar.gz
PROJ-d9064c3de62982c461a36ed9997eab56d1cb9f85.zip
Add tracing framework, and improve createOperations() performance
Diffstat (limited to 'include')
-rw-r--r--include/proj/internal/Makefile.am4
-rw-r--r--include/proj/internal/tracing.hpp85
-rw-r--r--include/proj/io.hpp10
3 files changed, 96 insertions, 3 deletions
diff --git a/include/proj/internal/Makefile.am b/include/proj/internal/Makefile.am
index f5bbeb7b..ba14c2a5 100644
--- a/include/proj/internal/Makefile.am
+++ b/include/proj/internal/Makefile.am
@@ -8,4 +8,6 @@ noinst_HEADERS = \
internal.hpp \
io_internal.hpp \
lru_cache.hpp \
- include_nlohmann_json.hpp
+ include_nlohmann_json.hpp \
+ tracing.hpp
+
diff --git a/include/proj/internal/tracing.hpp b/include/proj/internal/tracing.hpp
new file mode 100644
index 00000000..6b34aa39
--- /dev/null
+++ b/include/proj/internal/tracing.hpp
@@ -0,0 +1,85 @@
+/******************************************************************************
+ *
+ * Project: PROJ
+ * Purpose: Tracing/profiling
+ * Author: Even Rouault <even dot rouault at spatialys dot com>
+ *
+ ******************************************************************************
+ * Copyright (c) 2019, Even Rouault <even dot rouault at spatialys dot com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#ifndef TRACING_HH_INCLUDED
+#define TRACING_HH_INCLUDED
+
+//! @cond Doxygen_Suppress
+
+#include <string>
+
+#include "proj/util.hpp"
+
+#ifdef ENABLE_TRACING
+
+NS_PROJ_START
+
+namespace tracing {
+
+void logTrace(const std::string &str,
+ const std::string &component = std::string());
+
+class EnterBlock {
+ public:
+ EnterBlock(const std::string &msg);
+ ~EnterBlock();
+
+ private:
+ PROJ_OPAQUE_PRIVATE_DATA
+};
+
+#define TRACING_MERGE(a, b) a##b
+#define TRACING_UNIQUE_NAME(a) TRACING_MERGE(unique_name_, a)
+
+#define ENTER_BLOCK(x) EnterBlock TRACING_UNIQUE_NAME(__LINE__)(x)
+#define ENTER_FUNCTION() ENTER_BLOCK(__FUNCTION__ + std::string("()"))
+
+} // namespace tracing
+
+NS_PROJ_END
+
+using namespace NS_PROJ::tracing;
+
+#else // ENABLE_TRACING
+
+inline void logTrace(const std::string &, const std::string & = std::string()) {
+}
+
+#define ENTER_BLOCK(x) \
+ do { \
+ } while (0);
+
+#define ENTER_FUNCTION() \
+ do { \
+ } while (0)
+
+#endif // ENABLE_TRACING
+
+//! @endcond
+
+#endif // TRACING_HH_INCLUDED
diff --git a/include/proj/io.hpp b/include/proj/io.hpp
index 37b94c1e..f8ee1c97 100644
--- a/include/proj/io.hpp
+++ b/include/proj/io.hpp
@@ -1050,7 +1050,10 @@ class PROJ_GCC_DLL AuthorityFactory {
const std::string &sourceCRSAuthName, const std::string &sourceCRSCode,
const std::string &targetCRSAuthName, const std::string &targetCRSCode,
bool usePROJAlternativeGridNames, bool discardIfMissingGrid,
- bool discardSuperseded) const;
+ bool discardSuperseded, bool tryReverseOrder = false,
+ bool reportOnlyIntersectingTransformations = false,
+ const metadata::ExtentPtr &intersectingExtent1 = nullptr,
+ const metadata::ExtentPtr &intersectingExtent2 = nullptr) const;
PROJ_DLL std::vector<operation::CoordinateOperationNNPtr>
createFromCRSCodesWithIntermediates(
@@ -1059,7 +1062,10 @@ class PROJ_GCC_DLL AuthorityFactory {
bool usePROJAlternativeGridNames, bool discardIfMissingGrid,
bool discardSuperseded,
const std::vector<std::pair<std::string, std::string>>
- &intermediateCRSAuthCodes) const;
+ &intermediateCRSAuthCodes,
+ ObjectType allowedIntermediateObjectType = ObjectType::CRS,
+ const metadata::ExtentPtr &intersectingExtent1 = nullptr,
+ const metadata::ExtentPtr &intersectingExtent2 = nullptr) const;
PROJ_DLL std::string getOfficialNameFromAlias(
const std::string &aliasedName, const std::string &tableName,