diff --git a/externals/coda-oss/.gitignore b/externals/coda-oss/.gitignore
index d96301f3b..40c572955 100644
--- a/externals/coda-oss/.gitignore
+++ b/externals/coda-oss/.gitignore
@@ -1,52 +1,55 @@
-*.swp
-*~
-*.pyc
-__pycache__/
-# Build artifacts
-
-install/
-install-*/
-target/
-
-# Conan
-modules/drivers/**/build
-test_package/build/
-
-# CMake
-_deps/
-*.cmake
-CMakeCache.txt
-CMakeFiles/
-*_config.h
-Makefile
-modules/**/Makefile
-out/
-
-# Waf
-.waf-*
-waf-*
-.waf3-*
-waf3-*
-.lock-waf*
-build/waf*/
-
-# Eclipse
-.project
-.cproject
-
-# Drivers
-modules/drivers/fftw/fftw-2.1.*/
-modules/drivers/jpeg/jpeg-9/
-modules/drivers/jpeg/jpeg-9d/
-modules/drivers/j2k/openjpeg/openjpeg-2.3.*_mod/
-modules/drivers/pcre/pcre2-10.*/
-modules/drivers/uuid/e2fsprogs-1.*-uuid/
-modules/drivers/xml/xerces/xerces-c-*/
-modules/drivers/zlib/zlib-1.2.*/
-
-# VS
-.vs/
-project.sln
-.depproj/
-
-CMakeSettings.json
\ No newline at end of file
+*.swp
+*~
+*.pyc
+__pycache__/
+# Build artifacts
+
+install/
+install-*/
+target/
+
+# Conan
+modules/drivers/**/build
+test_package/build/
+
+# CMake
+_deps/
+*.cmake
+CMakeCache.txt
+CMakeFiles/
+*_config.h
+Makefile
+modules/**/Makefile
+out/
+
+# Waf
+.waf-*
+waf-*
+.waf3-*
+waf3-*
+.lock-waf*
+build/waf*/
+
+# Eclipse
+.project
+.cproject
+
+# Drivers
+modules/drivers/fftw/fftw-2.1.*/
+modules/drivers/jpeg/jpeg-9/
+modules/drivers/jpeg/jpeg-9d/
+modules/drivers/j2k/openjpeg/openjpeg-2.3.*_mod/
+modules/drivers/pcre/pcre2-10.*/
+modules/drivers/uuid/e2fsprogs-1.*-uuid/
+modules/drivers/xml/xerces/xerces-c-*/
+modules/drivers/zlib/zlib-1.2.*/
+
+# VS
+.vs/
+project.sln
+.depproj/
+*.tlog
+**/x64/
+*.vcxproj.user
+
+CMakeSettings.json
diff --git a/externals/coda-oss/build/build.py b/externals/coda-oss/build/build.py
index 25daa2215..a78599549 100644
--- a/externals/coda-oss/build/build.py
+++ b/externals/coda-oss/build/build.py
@@ -672,11 +672,11 @@ def getPlatform(pwd=None, default=None):
for loc in locs:
if not exists(loc): continue
try:
- out = subprocess.Popen('chmod +x %s' % loc, shell=True)
+ out = subprocess.Popen('chmod +x %s' % loc, shell=True, universal_newlines=True)
out.close()
except:{}
try:
- out = subprocess.Popen(loc, shell=True, stdout=PIPE).stdout
+ out = subprocess.Popen(loc, shell=True, stdout=subprocess.PIPE, universal_newlines=True).stdout
platform = out.readline()
platform = platform.strip('\n')
out.close()
@@ -1678,7 +1678,7 @@ def getSolarisFlags(compilerName):
# If they don't, default to the old -xtarget flags
# TODO: Is there a cleaner way to do this with check_cc() instead?
bitFlag64 = '-xtarget=generic64'
- (out, err) = subprocess.Popen([compilerName, '-flags'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+ (out, err) = subprocess.Popen([compilerName, '-flags'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
for line in out.split('\n'):
if re.match(r'-m64.*', line):
diff --git a/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj b/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj
new file mode 100644
index 000000000..af7e4000c
--- /dev/null
+++ b/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj
@@ -0,0 +1,504 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16.0
+ Win32Proj
+ {9997e895-5161-4ddf-8f3f-099894cb2f21}
+ codaoss
+ 10.0
+ coda-oss-lite
+
+
+
+ DynamicLibrary
+ true
+ v143
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+
+ EnableAllWarnings
+ true
+ _DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL
+ true
+ pch.h
+ cli\include\;coda_oss\include;config\include\;except\include\;gsl\include\;io\include\;math\include\;math.linear\include\;math.poly\include\;mem\include\;polygon\include\;std\include\;str\include\;sys\include\;types\include\;units\include\
+ Use
+ pch.h
+ true
+ Guard
+ true
+ ProgramDatabase
+
+
+
+
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL
+ true
+ pch.h
+ cli\include\;coda_oss\include;config\include\;except\include\;gsl\include\;io\include\;math\include\;math.linear\include\;math.poly\include\;mem\include\;polygon\include\;std\include\;str\include\;sys\include\;types\include\;units\include\
+ Use
+ pch.h
+ true
+ Guard
+ true
+
+
+
+
+ true
+ true
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj.filters b/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj.filters
new file mode 100644
index 000000000..1125cbccc
--- /dev/null
+++ b/externals/coda-oss/modules/c++/coda-oss-lite.vcxproj.filters
@@ -0,0 +1,1004 @@
+
+
+
+
+
+
+ config
+
+
+ config
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ coda_oss
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ types
+
+
+ types
+
+
+ types
+
+
+ types
+
+
+ types
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ mem
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ units
+
+
+ units
+
+
+ units
+
+
+ math.linear
+
+
+ math.linear
+
+
+ math.linear
+
+
+ math.linear
+
+
+ math.linear
+
+
+ math.linear
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ math.poly
+
+
+ polygon
+
+
+ polygon
+
+
+ polygon
+
+
+ config
+
+
+ include
+
+
+ cli
+
+
+ cli
+
+
+ cli
+
+
+ cli
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ except
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ str
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ sys
+
+
+ types
+
+
+ types
+
+
+ mem
+
+
+ mem
+
+
+ math
+
+
+ math
+
+
+ math
+
+
+ math.linear
+
+
+ polygon
+
+
+ math\unittests
+
+
+ math\unittests
+
+
+ math\unittests
+
+
+ math\unittests
+
+
+ math\unittests
+
+
+ math\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ math.linear\unittests
+
+
+ str\unittests
+
+
+ str\unittests
+
+
+ units\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ mem\unittests
+
+
+ cli
+
+
+ cli
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+ io
+
+
+
+
+ {89602880-5929-45e9-a603-d13f81972397}
+
+
+ {619ad1da-f21c-4027-9b5d-23f08225b96f}
+
+
+ {59f3d9a1-06d3-4779-aef2-cc55223c3017}
+
+
+ {3051f4b6-dad4-47ea-b4bd-d25d9e09f782}
+
+
+ {44a8dfa7-099c-4dd5-87b6-3b05ce13580b}
+
+
+ {d714ac63-ef19-4629-a13f-59b550604842}
+
+
+ {d8059280-e435-4365-be67-865195b9e813}
+
+
+ {3613caf2-18d1-4af7-bfa0-a3712a44da45}
+
+
+ {0e318d08-1ee3-4644-a299-a81e436c9a32}
+
+
+ {6d8f380f-54e3-4d0d-bd1a-a2edd0efbaa7}
+
+
+ {1bf84676-4c62-4e2b-b943-59bf82f89126}
+
+
+ {b3d7f0e3-2e9f-4a19-b181-27cace7536c0}
+
+
+ {15f9b62f-d17e-4d84-bc34-de6fd5fbcb33}
+
+
+ {f2544ccb-0933-44c7-af39-cd986982af3d}
+
+
+ {82d38fbe-b150-411a-8843-b584142c07ad}
+
+
+ {d17adbee-6720-4a93-b45f-2a05eb6a4620}
+
+
+ {4cee5537-9ac0-4bb8-9b9f-78aae69d0084}
+
+
+ {55522351-e752-4be8-9139-f7ac4b91a66d}
+
+
+ {6a70a638-d58c-4e34-87c1-6d1115690de8}
+
+
+ {9050a469-23a5-4da0-92b1-a07a8e52e9fc}
+
+
+ {de76f131-1cd6-4c3d-aa9c-37ca3b5079f0}
+
+
+ {cc681a99-da96-483e-a92a-eab0ea3a0ec0}
+
+
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ gsl
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ std
+
+
+ sys
+
+
+
\ No newline at end of file
diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
index 9374afd14..f1f8d72a8 100644
--- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
+++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
@@ -58,10 +58,6 @@
#endif
#endif // CODA_OSS_cplusplus
-#if CODA_OSS_cplusplus < 201103L
-#error "Must compile with C++11 or greater."
-#endif
-
// Define a few macros as that's less verbose than testing against a version number
#define CODA_OSS_cpp11 (CODA_OSS_cplusplus >= 201103L)
#define CODA_OSS_cpp14 (CODA_OSS_cplusplus >= 201402L)
@@ -69,4 +65,8 @@
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L)
#define CODA_OSS_cpp23 0
+#if !CODA_OSS_cpp11
+#error "Must compile with C++11 or greater."
+#endif
+
#endif // CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/config/include/config/Exports.h b/externals/coda-oss/modules/c++/config/include/config/Exports.h
new file mode 100644
index 000000000..6b77d9fd7
--- /dev/null
+++ b/externals/coda-oss/modules/c++/config/include/config/Exports.h
@@ -0,0 +1,54 @@
+#ifndef CODA_OSS_config_Exports_h_INCLUDED_
+#define CODA_OSS_config_Exports_h_INCLUDED_
+#pragma once
+
+#include "config/compiler_extensions.h"
+
+// Need to specify how this code will be consumed, either CODA_OSS_LIB (static library)
+// or CODA_OSS_DLL (aka "shared" library). For DLLs, it needs to be set for BOTH
+// "exporting" (building this code) and "importing" (consuming).
+//
+// Use Windows naming conventions (DLL, LIB) because this really only matters for _MSC_VER, see below.
+#if !defined(CODA_OSS_LIB) && !defined(CODA_OSS_DLL)
+ #define CODA_OSS_LIB 1
+ //#define CODA_OSS_DLL 1
+#endif
+#if defined(CODA_OSS_LIB) && defined(CODA_OSS_DLL)
+ #error "Both CODA_OSS_LIB and CODA_OSS_DLL are #define'd'"
+#endif
+#if defined(CODA_OSS_EXPORTS) && defined(CODA_OSS_LIB)
+ #error "Can't export from a LIB'"
+#endif
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the CODA_OSS_EXPORTS
+// symbol defined on the command line. This symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// CODA_OSS_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+// https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html
+#ifdef CODA_OSS_EXPORTS
+ #define CODA_OSS_API CODA_OSS_library_export
+#else
+ // Either building a static library (no CODA_OSS_EXPORTS) or
+ // importing (not building) a shared library.
+
+ // We need to know whether we're consuming (importing) a DLL or static LIB
+ // The default is a static LIB as that's what existing code/builds expect.
+ #ifdef CODA_OSS_DLL
+ // Actually, it seems that the linker is able to figure this out from the .LIB, so
+ // there doesn't seem to be a need for __declspec(dllimport). Clients don't
+ // need to #define CODA_OSS_DLL ... ? Well, almost ... it looks
+ // like __declspec(dllimport) is needed to get virtual "inline"s (e.g.,
+ // destructors) correct.
+ #define CODA_OSS_API CODA_OSS_library_import
+ #else
+ #define CODA_OSS_API /* "importing" a static LIB */
+ #endif
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(disable: 4251) // '...' : class '...' needs to have dll-interface to be used by clients of struct '...'
+#endif
+
+#endif // CODA_OSS_config_Exports_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/config/include/config/compiler_extensions.h b/externals/coda-oss/modules/c++/config/include/config/compiler_extensions.h
index 774ff1d51..1ce9ac953 100644
--- a/externals/coda-oss/modules/c++/config/include/config/compiler_extensions.h
+++ b/externals/coda-oss/modules/c++/config/include/config/compiler_extensions.h
@@ -23,8 +23,6 @@
#define CODA_OSS_config_compiler_extentions_h_INCLUDED_
#pragma once
-#include
-
#ifndef CODA_OSS_attribute_noinline_DEFINED_
#define CODA_OSS_attribute_noinline_DEFINED_ 1
@@ -144,4 +142,32 @@
} while (0);
#endif
+#if !defined(CODA_OSS_library_export) && !defined(CODA_OSS_library_import)
+
+ #if defined(__GNUC__) // && HAVE_VISIBILITY
+ // https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html
+ #define CODA_OSS_library_export __attribute__((visibility("default")))
+
+ // For GCC, there's no difference in consuming ("importing") an .a or .so
+ #define CODA_OSS_library_import /* no __declspec(dllimport) for GCC */
+
+ #elif defined(_MSC_VER) // && (defined(_WINDLL) && !defined(_LIB))
+ #define CODA_OSS_library_export __declspec(dllexport)
+
+ // Actually, it seems that the linker is able to figure this out from the .LIB,
+ // so there doesn't seem to be a need for __declspec(dllimport). Clients don't
+ // need to #define NITRO_NITFCPP_DLL ... ? Well, almost ... it looks
+ // like __declspec(dllimport) is needed to get virtual "inline"s (e.g.,
+ // destructors) correct.
+ #define CODA_OSS_library_import __declspec(dllimport)
+
+ #else
+ // https://stackoverflow.com/a/2164853/8877
+ #define CODA_OSS_library_export /* do nothing and hope for the best? */
+ #define CODA_OSS_library_import /* do nothing and hope for the best? */
+ #pragma warning Unknown dynamic link import semantics.
+ #endif
+
+#endif
+
#endif // CODA_OSS_config_compiler_extentions_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/except/include/except/Context.h b/externals/coda-oss/modules/c++/except/include/except/Context.h
index bc397e302..c2e683016 100644
--- a/externals/coda-oss/modules/c++/except/include/except/Context.h
+++ b/externals/coda-oss/modules/c++/except/include/except/Context.h
@@ -27,7 +27,8 @@
#include
#include
-#include
+
+#include "config/Exports.h"
/*!
* \file
@@ -44,7 +45,7 @@ namespace except
* This class contains information such as the file, line,
* function and time
*/
-struct Context final
+struct CODA_OSS_API Context final
{
/*!
* Constructor
diff --git a/externals/coda-oss/modules/c++/except/include/except/Throwable.h b/externals/coda-oss/modules/c++/except/include/except/Throwable.h
index d07d769b5..ac322a974 100644
--- a/externals/coda-oss/modules/c++/except/include/except/Throwable.h
+++ b/externals/coda-oss/modules/c++/except/include/except/Throwable.h
@@ -32,6 +32,8 @@
#include // std::accumulate
#include
+#include "config/Exports.h"
+#include "config/compiler_extensions.h"
#include "except/Trace.h"
/*!
@@ -52,7 +54,7 @@ namespace except
*/
class Throwable11;
-class Throwable
+class CODA_OSS_API Throwable
{
void doGetBacktrace();
template
@@ -337,7 +339,6 @@ class Throwable11 : public std::exception
mutable std::string mWhat;
std::vector mBacktrace;
};
-
}
#endif // CODA_OSS_except_Throwable_h_INCLUDED_
diff --git a/externals/coda-oss/modules/c++/except/include/except/Trace.h b/externals/coda-oss/modules/c++/except/include/except/Trace.h
index a7accbb2c..08f8baad7 100644
--- a/externals/coda-oss/modules/c++/except/include/except/Trace.h
+++ b/externals/coda-oss/modules/c++/except/include/except/Trace.h
@@ -40,7 +40,7 @@ namespace except
* \class Trace
* \brief Holds stack of context information
*/
-struct Trace final
+struct CODA_OSS_API Trace final
{
/*!
* Gets size of stack
@@ -99,7 +99,7 @@ struct Trace final
std::list mStack;
};
-std::ostream& operator<<(std::ostream& os, const Trace& t);
+CODA_OSS_API std::ostream& operator<<(std::ostream& os, const Trace& t);
}
#endif
diff --git a/externals/coda-oss/modules/c++/framework.h b/externals/coda-oss/modules/c++/framework.h
new file mode 100644
index 000000000..4b63b165b
--- /dev/null
+++ b/externals/coda-oss/modules/c++/framework.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#pragma warning(push)
+#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception.
+#pragma warning(disable: 4514) // '...': unreferenced inline function has been removed
+#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch
+#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define NOMINMAX // no min()/max() macros
+#include
+#include
+#include
+#pragma comment(lib, "Ws2_32")
+#pragma warning(pop)
diff --git a/externals/coda-oss/modules/c++/include/TestCase.h b/externals/coda-oss/modules/c++/include/TestCase.h
index df87d7990..4d7461e0e 100644
--- a/externals/coda-oss/modules/c++/include/TestCase.h
+++ b/externals/coda-oss/modules/c++/include/TestCase.h
@@ -36,25 +36,71 @@
# define IS_NAN(X) X != X
-namespace coda_oss { namespace test {
+namespace test {
inline void diePrintf(const char* format, const std::string& testName, const char* s)
{
sys::diePrintf(format, testName.c_str(), s);
}
+template
+inline void diePrintf(const char* format, const std::string& testName, const TX& X)
+{
+ diePrintf(format, testName, str::toString(X).c_str());
+}
inline void diePrintf(const char* format, const std::string& testName, const char* file, const char* func, int line)
{
sys::diePrintf(format, testName.c_str(), file, func, line);
}
+template
+inline void diePrintf(const char* format, const std::string& testName, const char* file, const char* func, int line,
+ const TX& X)
+{
+ sys::diePrintf(format, testName.c_str(), file, func, line,
+ str::toString(X).c_str());
+}
template
inline void diePrintf(const char* format, const std::string& testName, const char* file, const char* func, int line,
- TX1&& X1, TX2&& X2)
+ const TX1& X1, const TX2& X2)
{
sys::diePrintf(format, testName.c_str(), file, func, line,
str::toString(X1).c_str(), str::toString(X2).c_str());
}
+template
+inline void diePrintf_eq(const std::string& testName, const char* file, const char* func, int line,
+ const TX1& X1, const TX2& X2)
+{
+ diePrintf("%s (%s,%s,%d): FAILED: Recv'd %s, Expected %s\n", testName, file, func, line, X1, X2);
+}
+#define CODA_OSS_test_diePrintf_eq_(X1, X2) test::diePrintf_eq(testName, __FILE__, SYS_FUNC, __LINE__, X1, X2)
+
+template
+inline void diePrintf_eq_msg(const std::string& testName, const TMsg& msg, const char* file, int line,
+ const TX1& X1, const TX2& X2)
+{
+ sys::diePrintf("%s (%s,%d): FAILED (%s): Recv'd %s, Expected %s\n", testName.c_str(), file, line, (msg).c_str(),
+ str::toString((X1)).c_str(), str::toString((X2)).c_str());
+}
+#define CODA_OSS_test_diePrintf_eq_msg_(msg, X1, X2) test::diePrintf_eq_msg(testName, msg, __FILE__, __LINE__, X1, X2)
+
+template
+inline void diePrintf_ne(const std::string& testName, const char* file, const char* func, int line,
+ const TX1& X1, const TX2& X2)
+{
+ diePrintf("%s (%s,%s,%d): FAILED: Recv'd %s should not equal %s\n", testName, file, func, line, X1, X2);
+}
+#define CODA_OSS_test_diePrintf_not_eq_(X1, X2) test::diePrintf_ne(testName, __FILE__, SYS_FUNC, __LINE__, X1, X2)
+
+template
+inline void diePrintf_ne_msg(const std::string& testName, const TMsg& msg, const char* file, int line,
+ const TX1& X1, const TX2& X2)
+{
+ sys::diePrintf("%s (%s,%d): FAILED (%s): Recv'd %s should not equal %s\n", testName.c_str(), file, line, (msg).c_str(),
+ str::toString((X1)).c_str(), str::toString((X2)).c_str());
+}
+#define CODA_OSS_test_diePrintf_not_eq_msg_(msg, X1, X2) test::diePrintf_ne_msg(testName, msg, __FILE__, __LINE__, X1, X2)
+
template
inline void check(TFunc f, const std::string& testName)
{
@@ -65,7 +111,7 @@ inline void check(TFunc f, const std::string& testName)
}
catch (const except::Throwable& ex)
{
- diePrintf("%s: FAILED: Exception thrown: %s\n", testName, ex.toString().c_str());
+ diePrintf("%s: FAILED: Exception thrown: %s\n", testName, ex.toString());
}
catch (const except::Throwable11& ex)
{
@@ -74,7 +120,7 @@ inline void check(TFunc f, const std::string& testName)
}
template
-inline void assert_(TX&& X, const std::string& testName, const char* file, const char* func, int line)
+inline void assert_(const TX& X, const std::string& testName, const char* file, const char* func, int line)
{
if (!X)
{
@@ -83,16 +129,24 @@ inline void assert_(TX&& X, const std::string& testName, const char* file, const
}
template
-inline void assert_null(TX&& X, const std::string& testName, const char* file, const char* func, int line)
+inline void assert_null(const TX& X, const std::string& testName, const char* file, const char* func, int line)
{
if ((X != nullptr) || (!(X == nullptr)))
{
diePrintf("%s (%s,%s,%d): FAILED: Value should be NULL\n", testName, file, func, line);
}
}
+template
+inline void assert_not_null(const TX& X, const std::string& testName, const char* file, const char* func, int line)
+{
+ if ((X == nullptr) || (!(X != nullptr)))
+ {
+ diePrintf("%s (%s,%s,%d): FAILED: Value should *not* be NULL\n", testName, file, func, line);
+ }
+}
template
-inline void test_assert_false(TX&& X, const std::string& testName, const char* file, const char* func, int line)
+inline void test_assert_false(const TX& X, const std::string& testName, const char* file, const char* func, int line)
{
if (X)
{
@@ -101,7 +155,7 @@ inline void test_assert_false(TX&& X, const std::string& testName, const char*
}
template
-inline void test_assert_true(TX&& X, const std::string& testName, const char* file, const char* func, int line)
+inline void test_assert_true(const TX& X, const std::string& testName, const char* file, const char* func, int line)
{
if (!X)
{
@@ -109,105 +163,37 @@ inline void test_assert_true(TX&& X, const std::string& testName, const char* f
}
}
-// These cause warnings (or even errors, depending on compile settings) if the types have different signedness.
-// assert_eq(v.size(), 1, ...);
-/*
-template
-inline void assert_eq(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- if ((X1 != X2) || (!(X1 == X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Recv'd %s, Expected %s\n", testName, file, func, line, X1, X2);
- }
-}
-template
-inline void assert_eq_msg(const std::string& msg, TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, int line)
-{
- if ((X1 != X2) || (!(X1 == X2)))
- {
- die_printf("%s (%s,%d): FAILED (%s): Recv'd %s, Expected %s\n", testName.c_str(), file, line,
- msg.c_str(), str::toString(X1).c_str(), str::toString(X2).c_str());
- }
-}
+// You might be tempted to write something like
+// template
+// inline void assert_eq(const TX1& X1, const TX2& X2, ...) {}
+// A nice thought, but the compiler is able to do more implicit conversions when the code is "inline"
+// if (!(X1 == X2)) { ... }
+// behaves differently when it is in the functon (X1 and X2 are arguments). An easy example
+// is std::vector::size() (size_t) compared to a literal 1 which is an "int" not "size_t".
-template
-inline void assert_not_eq(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- if ((X1 == X2) || (!(X1 != X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Recv'd %s should not equal %s\n", testName, file, func, line, X1, X2);
- }
-}
-*/
template
-inline void assert_almost_eq_eps(TX1&& X1, TX2&& X2, TEPS&& EPS,
+inline void assert_almost_eq_eps(const TX1& X1, const TX2& X2, const TEPS& EPS,
const std::string& testName, const char* file, const char* func, int line)
{
const auto abs_difference = std::abs(X1 - X2);
if (abs_difference > EPS || IS_NAN(abs_difference))
- {
- diePrintf("%s (%s,%d): FAILED: Recv'd %s, Expected %s\n", testName, file, func, line, X1, X2);
- }
-}
-template
-inline void assert_almost_eq(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- const auto abs_difference = std::abs(X1 - X2);
- if (abs_difference > std::numeric_limits::epsilon() || IS_NAN(abs_difference))
{
diePrintf("%s (%s,%s,%d): FAILED: Recv'd %s, Expected %s\n", testName, file, func, line, X1, X2);
}
}
-/*
-template
-inline void assert_greater_eq(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- if ((X1 < X2) || (!(X1 >= X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Value should be greater than or equal\n", testName, file, func, line);
- }
-}
-
-template
-inline void assert_greater(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- if ((X1 <= X2) || (!(X1 > X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Value should be greater than\n", testName, file, func, line);
- }
-}
-
template
-inline void assert_lesser_eq(TX1&& X1, TX2&& X2,
+inline void assert_almost_eq(const TX1& X1, const TX2& X2,
const std::string& testName, const char* file, const char* func, int line)
{
- if ((X1 > X2) || (!(X1 <= X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Value should be less than or equal\n", testName, file, func, line);
- }
+ const auto eps = std::numeric_limits::epsilon();
+ assert_almost_eq_eps(X1, X2, eps, testName, file, func, line);
}
-template
-inline void assert_lesser(TX1&& X1, TX2&& X2,
- const std::string& testName, const char* file, const char* func, int line)
-{
- if ((X1 >= X2) || (!(X1 < X2)))
- {
- diePrintf("%s (%s,%s,%d): FAILED: Value should be less than\n", testName, file, func, line);
- }
-}
-*/
template
-inline void fail(Tmsg&& msg,
+inline void fail(const Tmsg& msg,
const std::string& testName, const char* file, const char* func, int line)
{
- die_printf("%s (%s,%s,%d): FAILED: %s\n", testName.c_str(), file, func, line, str::toString(msg).c_str());
+ diePrintf("%s (%s,%s,%d): FAILED: %s\n", testName, file, func, line, msg);
}
template
@@ -277,32 +263,23 @@ inline int main(TFunc f)
}
return EXIT_FAILURE;
}
-}}
-#define TEST_CHECK(X) coda_oss::test::check([&](const std::string& testName) { X(testName); }, #X)
-#define TEST_ASSERT(X) coda_oss::test::assert_(X, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_NULL(X) coda_oss::test::assert_null(X, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_FALSE(X) coda_oss::test::test_assert_false(X, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_TRUE(X) coda_oss::test::test_assert_true(X, testName, __FILE__, SYS_FUNC, __LINE__)
-/*
-#define TEST_ASSERT_EQ(X1, X2) coda_oss::test::assert_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_EQ_MSG(msg, X1, X2) coda_oss::test::assert_eq_msg(msg, X1, X2, testName, __FILE__, __LINE__)
-#define TEST_ASSERT_NOT_EQ(X1, X2) coda_oss::test::assert_not_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-*/
-#define TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, EPS) coda_oss::test::assert_almost_eq_eps(X1, X2, EPS, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_ALMOST_EQ(X1, X2) coda_oss::test::assert_almost_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-/*
-#define TEST_ASSERT_GREATER_EQ(X1, X2) coda_oss::test::assert_greater_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_GREATER(X1, X2) coda_oss::test::assert_greater(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_LESSER_EQ(X1, X2) coda_oss::test::assert_lesser_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_ASSERT_LESSER(X1, X2) coda_oss::test::assert_lesser(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
-*/
-#define TEST_FAIL(msg) coda_oss::test::fail(msg, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_EXCEPTION(X) coda_oss::test::exception([&](){(X);}, testName, __FILE__, SYS_FUNC, __LINE__)
-#define TEST_THROWS(X) coda_oss::test::throws([&](){(X);}, testName, __FILE__, SYS_FUNC, __LINE__)
-# define TEST_SPECIFIC_EXCEPTION(X, Y) coda_oss::test::specific_exception([&](){(X);}, \
+}
+#define TEST_CHECK(X) test::check([&](const std::string& testName) { X(testName); }, #X)
+#define TEST_ASSERT(X) test::assert_(X, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_NULL(X) test::assert_null(X, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_NOT_NULL(X) test::assert_not_null(X, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_FALSE(X) test::test_assert_false(X, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_TRUE(X) test::test_assert_true(X, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, EPS) test::assert_almost_eq_eps(X1, X2, EPS, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_ASSERT_ALMOST_EQ(X1, X2) test::assert_almost_eq(X1, X2, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_FAIL(msg) test::fail(msg, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_EXCEPTION(X) test::exception([&](){(X);}, testName, __FILE__, SYS_FUNC, __LINE__)
+#define TEST_THROWS(X) test::throws([&](){(X);}, testName, __FILE__, SYS_FUNC, __LINE__)
+# define TEST_SPECIFIC_EXCEPTION(X, Y) test::specific_exception([&](){(X);}, \
"%s (%s,%s,%d): FAILED: Should have thrown exception: " # Y , testName, __FILE__, SYS_FUNC, __LINE__)
# define TEST_CASE(X) void X(std::string testName)
-#define TEST_MAIN(X) int main(int argc, char** argv) { return coda_oss::test::main([&](){X;}); }
+#define TEST_MAIN(X) int main() { return test::main([&](){X;}); }
+#define TEST_MAIN_ARGS(X) int main(int argc, char* argv[]) { return test::main([&](){X;}); }
/*
# define TEST_CHECK(X) try{ X(std::string(#X)); std::cerr << #X << ": PASSED" << std::endl; } \
catch(const except::Throwable& ex) { die_printf("%s: FAILED: Exception thrown: %s\n", std::string(#X).c_str(), ex.toString().c_str()); } \
@@ -312,18 +289,22 @@ inline int main(TFunc f)
# define TEST_ASSERT_FALSE(X) if ((X)) { die_printf("%s (%s,%s,%d): FAILED: Value should evaluate to false\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
# define TEST_ASSERT_TRUE(X) if (!(X)) { die_printf("%s (%s,%s,%d): FAILED: Value should evaluate to true\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
*/
-# define TEST_ASSERT_EQ(X1, X2) if ((X1) != (X2)) { die_printf("%s (%s,%s,%d): FAILED: Recv'd %s, Expected %s\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__, str::toString(X1).c_str(), str::toString(X2).c_str()); }
-# define TEST_ASSERT_EQ_MSG(msg, X1, X2) if ((X1) != (X2)) die_printf("%s (%s,%d): FAILED (%s): Recv'd %s, Expected %s\n", testName.c_str(), __FILE__, __LINE__, (msg).c_str(), str::toString((X1)).c_str(), str::toString((X2)).c_str());
-# define TEST_ASSERT_NOT_EQ(X1, X2) if ((X1) == (X2)) { die_printf("%s (%s,%s,%d): FAILED: Recv'd %s should not equal %s\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__, str::toString(X1).c_str(), str::toString(X2).c_str()); }
-# define TEST_ASSERT_NOT_EQ_MSG(msg, X1, X2) if ((X1) == (X2)) die_printf("%s (%s,%d): FAILED (%s): Recv'd %s should not equal %s\n", testName.c_str(), __FILE__, __LINE__, (msg).c_str(), str::toString((X1)).c_str(), str::toString((X2)).c_str());
-/*
-# define TEST_ASSERT_ALMOST_EQ_EPS(X1, X2, EPS) if (std::abs((X1) - (X2)) > EPS || IS_NAN(std::abs((X1) - (X2)))) die_printf("%s (%s,%d): FAILED: Recv'd %s, Expected %s\n", testName.c_str(), __FILE__, __LINE__, str::toString((X1)).c_str(), str::toString((X2)).c_str());
-# define TEST_ASSERT_ALMOST_EQ(X1, X2) if (std::abs((X1) - (X2)) > std::numeric_limits::epsilon() || IS_NAN(std::abs((X1) - (X2)))) { die_printf("%s (%s,%s,%d): FAILED: Recv'd %s, Expected %s\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__, str::toString(X1).c_str(), str::toString(X2).c_str()); }
-*/
-# define TEST_ASSERT_GREATER_EQ(X1, X2) if ((X1) < X2) { die_printf("%s (%s,%s,%d): FAILED: Value should be greater than or equal\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
-# define TEST_ASSERT_GREATER(X1, X2) if ((X1) <= X2) { die_printf("%s (%s,%s,%d): FAILED: Value should be greater than\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
-# define TEST_ASSERT_LESSER_EQ(X1, X2) if ((X1) > X2) { die_printf("%s (%s,%s,%d): FAILED: Value should be less than or equal\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
-# define TEST_ASSERT_LESSER(X1, X2) if ((X1) >= X2) { die_printf("%s (%s,%s,%d): FAILED: Value should be less than\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); }
+//#define CODA_OSS_test_eq_(X1, X2) (((X1) == (X2)) && ((X2) == (X1))) // X1 == X2 means X2 == X1
+#define CODA_OSS_test_eq_(X1, X2) ((X1) == (X2)) // above breaks CODA :-(
+//#define CODA_OSS_test_ne_(X1, X2) (((X1) != (X2)) && ((X2) != (X1))) // X1 != X2 means X2 != X1
+#define CODA_OSS_test_ne_(X1, X2) ((X1) != (X2)) // above breaks CODA :-(
+//#define CODA_OSS_test_ne(X1, X2) (CODA_OSS_test_ne_(X1, X2) && !CODA_OSS_test_eq_(X1, X2))
+#define CODA_OSS_test_ne(X1, X2) CODA_OSS_test_ne_(X1, X2) // above breaks CODA :-(
+#define TEST_ASSERT_EQ(X1, X2) if (CODA_OSS_test_ne((X1), (X2))) { CODA_OSS_test_diePrintf_eq_(X1, X2); }
+#define TEST_ASSERT_EQ_MSG(msg, X1, X2) if (CODA_OSS_test_ne((X1), (X2))) { CODA_OSS_test_diePrintf_eq_msg_(msg, X1, X2); }
+//#define CODA_OSS_test_eq(X1, X2) (CODA_OSS_test_eq_(X1, X2) && !CODA_OSS_test_ne_(X1, X2))
+#define CODA_OSS_test_eq(X1, X2) CODA_OSS_test_eq_(X1, X2) // above breaks CODA :-(
+#define TEST_ASSERT_NOT_EQ(X1, X2) if (CODA_OSS_test_eq((X1), (X2))) { CODA_OSS_test_diePrintf_not_eq_(X1, X2); }
+#define TEST_ASSERT_NOT_EQ_MSG(msg, X1, X2) if (CODA_OSS_test_eq((X1), (X2))) { CODA_OSS_test_diePrintf_not_eq_msg_(msg, X1, X2); }
+# define TEST_ASSERT_GREATER_EQ(X1, X2) if ((X1) < X2) { test::diePrintf("%s (%s,%s,%d): FAILED: Value should be greater than or equal\n", testName, __FILE__, SYS_FUNC, __LINE__); }
+# define TEST_ASSERT_GREATER(X1, X2) if ((X1) <= X2) { test::diePrintf("%s (%s,%s,%d): FAILED: Value should be greater than\n", testName, __FILE__, SYS_FUNC, __LINE__); }
+# define TEST_ASSERT_LESSER_EQ(X1, X2) if ((X1) > X2) { test::diePrintf("%s (%s,%s,%d): FAILED: Value should be less than or equal\n", testName, __FILE__, SYS_FUNC, __LINE__); }
+# define TEST_ASSERT_LESSER(X1, X2) if ((X1) >= X2) { test::diePrintf("%s (%s,%s,%d): FAILED: Value should be less than\n", testName, __FILE__, SYS_FUNC, __LINE__); }
/*
# define TEST_FAIL(msg) die_printf("%s (%s,%s,%d): FAILED: %s\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__, str::toString(msg).c_str());
# define TEST_EXCEPTION(X) try{ (X); die_printf("%s (%s,%s,%d): FAILED: Should have thrown exception\n", testName.c_str(), __FILE__, SYS_FUNC, __LINE__); } catch (const except::Throwable&){} catch (const except::Throwable11&){}
diff --git a/externals/coda-oss/modules/c++/io/source/ByteStream.cpp b/externals/coda-oss/modules/c++/io/source/ByteStream.cpp
index 4f557e558..73d70457b 100644
--- a/externals/coda-oss/modules/c++/io/source/ByteStream.cpp
+++ b/externals/coda-oss/modules/c++/io/source/ByteStream.cpp
@@ -42,6 +42,7 @@ sys::Off_T io::ByteStream::seek(sys::Off_T offset, Whence whence)
mPosition = mData.size() - offset;
}
break;
+ case CURRENT:
default:
mPosition += offset;
break;
diff --git a/externals/coda-oss/modules/c++/io/source/PipeStream.cpp b/externals/coda-oss/modules/c++/io/source/PipeStream.cpp
index 2e178ce47..d25658380 100644
--- a/externals/coda-oss/modules/c++/io/source/PipeStream.cpp
+++ b/externals/coda-oss/modules/c++/io/source/PipeStream.cpp
@@ -20,6 +20,10 @@
*
*/
#include "io/PipeStream.h"
+#undef min
+#undef max
+
+#include "gsl/gsl.h"
using namespace io;
@@ -32,7 +36,7 @@ sys::SSize_T io::PipeStream::readImpl(void* buffer, size_t numBytes)
size_t bytesLeft = numBytes;
while (bytesLeft && !feof(pipe))
{
- sys::SSize_T bytesRead = fread(cStr, 1, bytesLeft, pipe);
+ const auto bytesRead = fread(cStr, 1, bytesLeft, pipe);
if (bytesRead > 0)
{
bytesLeft -= bytesRead;
@@ -48,7 +52,7 @@ sys::SSize_T io::PipeStream::readImpl(void* buffer, size_t numBytes)
if (bytesLeft == numBytes)
return IS_EOF;
- return numBytes - bytesLeft;
+ return gsl::narrow(numBytes - bytesLeft);
}
sys::SSize_T io::PipeStream::readln(sys::byte *cStr,
@@ -61,7 +65,7 @@ sys::SSize_T io::PipeStream::readln(sys::byte *cStr,
// get the next line or return null
if (fgets(cStr, static_cast(strLenPlusNullByte), pipe) != NULL)
{
- return strlen(cStr);
+ return gsl::narrow(strlen(cStr));
}
// throw if error reading stream
@@ -79,30 +83,30 @@ sys::SSize_T io::PipeStream::streamTo(OutputStream& soi,
{
while (!feof(mExecPipe.getPipe()))
{
- sys::SSize_T bytesRead = read(mCharString.get(), mBufferSize);
+ const auto bytesRead = read(mCharString.get(), mBufferSize);
if (bytesRead > 0)
{
- soi.write(mCharString.get(), bytesRead);
+ soi.write(mCharString.get(), gsl::narrow(bytesRead));
totalBytesRead += bytesRead;
}
}
}
else
{
- sys::Size_T bytesLeft = numBytes;
+ auto bytesLeft = gsl::narrow(numBytes);
while (bytesLeft && !feof(mExecPipe.getPipe()))
{
// don't read more bytes than streaming forward or buff size
- sys::SSize_T bytesRead = read(mCharString.get(),
+ const auto bytesRead = read(mCharString.get(),
std::min(bytesLeft, mBufferSize));
if (bytesRead > 0)
{
- soi.write(mCharString.get(), bytesRead);
+ soi.write(mCharString.get(), gsl::narrow(bytesRead));
bytesLeft -= bytesRead;
}
}
- totalBytesRead = numBytes - bytesLeft;
+ totalBytesRead = gsl::narrow(numBytes - bytesLeft);
}
// check if didn't read any bytes before end of file
diff --git a/externals/coda-oss/modules/c++/math.linear/include/math/linear/Vector.h b/externals/coda-oss/modules/c++/math.linear/include/math/linear/Vector.h
index 40bd8c8cd..06089d856 100644
--- a/externals/coda-oss/modules/c++/math.linear/include/math/linear/Vector.h
+++ b/externals/coda-oss/modules/c++/math.linear/include/math/linear/Vector.h
@@ -395,7 +395,7 @@ template class Vector
* comparisons of types other than just Vectors
* including fixed type VectorN and std::vector
*/
- template bool operator==(const Vector_T& v) const
+ template bool operator_eq(const Vector_T& v) const
{
size_t sz = v.size();
for (size_t i = 0; i < sz; ++i)
@@ -405,12 +405,6 @@ template class Vector
return true;
}
- //! Negate the equality operator
- template bool operator!=(const Vector_T& v) const
- {
- return !(*this == v);
- }
-
/*!
* serialize out to a boost stream
*/
@@ -465,6 +459,17 @@ operator*(_T scalar, const Vector<_T>& v)
return v * scalar;
}
+template
+inline bool operator==(const Vector& lhs, const Vector_T& rhs)
+{
+ return lhs.operator_eq(rhs);
+}
+template
+inline bool operator!=(const Vector& lhs, const Vector_T& rhs)
+{
+ return !(lhs == rhs);
+}
+
/*!
* Pretty(?)-print vector
*/
diff --git a/externals/coda-oss/modules/c++/math.linear/include/math/linear/VectorN.h b/externals/coda-oss/modules/c++/math.linear/include/math/linear/VectorN.h
index 32b6fc8af..6e9b7c177 100644
--- a/externals/coda-oss/modules/c++/math.linear/include/math/linear/VectorN.h
+++ b/externals/coda-oss/modules/c++/math.linear/include/math/linear/VectorN.h
@@ -342,7 +342,7 @@ template class VectorN
return v2;
}
- template bool operator==(const Vector_T& v) const
+ template bool operator_eq(const Vector_T& v) const
{
const auto sz = v.size();
for (size_t i = 0; i < sz; ++i)
@@ -353,11 +353,6 @@ template class VectorN
return true;
}
- template bool operator!=(const Vector_T& v) const
- {
- return !(*this == v);
- }
-
};
template VectorN<3, _T> cross(const VectorN<3, _T>& u,
@@ -402,6 +397,18 @@ template
}
return os;
}
+
+template
+inline bool operator==(const VectorN& lhs, const Vector_T& rhs)
+{
+ return lhs.operator_eq(rhs);
+}
+template
+inline bool operator!=(const VectorN& lhs, const Vector_T& rhs)
+{
+ return !(lhs == rhs);
+}
+
} // linear
} // math
diff --git a/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp b/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp
index 9fc40954d..1a4df6d46 100644
--- a/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp
+++ b/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp
@@ -2,12 +2,11 @@
#include "TestCase.h"
#include "math/linear/Vector.h"
-using namespace math::linear;
-using namespace std;
-
TEST_CASE(testDefaultConstructor)
{
+ using namespace math::linear;
+
Vector v;
TEST_ASSERT_EQ(v.size(), static_cast(0));
}
@@ -15,6 +14,8 @@ TEST_CASE(testDefaultConstructor)
TEST_CASE(testScalarConstructor)
{
+ using namespace math::linear;
+
Vector v(3, 42);
TEST_ASSERT_EQ(v.size(), static_cast(3));
TEST_ASSERT_EQ(v[0], 42);
@@ -26,6 +27,8 @@ TEST_CASE(testScalarConstructor)
TEST_CASE(testRawConstructor)
{
+ using namespace math::linear;
+
double raw[] = {1,2,3};
Vector v(3, raw);
TEST_ASSERT_EQ(v.size(), static_cast(3));
@@ -37,6 +40,8 @@ TEST_CASE(testRawConstructor)
TEST_CASE(testCopyConstructor)
{
+ using namespace math::linear;
+
Vector vsrc(3);
vsrc[0] = 1;
vsrc[1] = 2;
@@ -55,10 +60,9 @@ TEST_CASE(testCopyConstructor)
TEST_CASE(testStdVectorConstructor)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ std::vector stdvec{10, 11, 12};
Vector v(stdvec);
TEST_ASSERT_EQ(v.size(), static_cast(3));
@@ -78,6 +82,8 @@ TEST_CASE(testStdVectorConstructor)
TEST_CASE(testAssignmentOperator)
{
+ using namespace math::linear;
+
Vector vsrc(2);
vsrc[0] = 42;
vsrc[1] = 99;
@@ -92,6 +98,8 @@ TEST_CASE(testAssignmentOperator)
TEST_CASE(testScalarAssignment)
{
+ using namespace math::linear;
+
Vector v(5, 123.456);
TEST_ASSERT_EQ(v.size(), static_cast(5));
for (int i = 0; i < 5; i++)
@@ -105,10 +113,9 @@ TEST_CASE(testScalarAssignment)
TEST_CASE(testStdVectorAssignment)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ const std::vector stdvec{10, 11, 12};
Vector v(20, -1);
v = stdvec;
@@ -121,6 +128,8 @@ TEST_CASE(testStdVectorAssignment)
TEST_CASE(testDotProduct)
{
+ using namespace math::linear;
+
Vector vd1(5, 2);
Vector vd2(5, 3);
const double dotprod(vd1.dot(vd2));
@@ -142,10 +151,9 @@ TEST_CASE(testDotProduct)
TEST_CASE(testNorm)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ const std::vector stdvec{10, 11, 12};
Vector vnorm1(stdvec);
const double norm(vnorm1.norm());
const double arg(10.*10 + 11.*11 + 12.*12);
@@ -156,6 +164,8 @@ TEST_CASE(testNorm)
TEST_CASE(testNormalize)
{
+ using namespace math::linear;
+
Vector vnorm(4, 4.0);
vnorm.normalize();
TEST_ASSERT_EQ(vnorm[0], 0.5);
@@ -167,6 +177,8 @@ TEST_CASE(testNormalize)
TEST_CASE(testScale)
{
+ using namespace math::linear;
+
Vector vscale(2,4.0);
vscale.scale(1.0 / 4.0);
TEST_ASSERT_EQ(vscale[0], 1.0);
@@ -175,6 +187,8 @@ TEST_CASE(testScale)
TEST_CASE(testUnit)
{
+ using namespace math::linear;
+
Vector v(4,4.0);
Vector vunit = v.unit();
TEST_ASSERT_EQ(vunit[0], 0.5);
@@ -185,6 +199,8 @@ TEST_CASE(testUnit)
TEST_CASE(testOperatorPlusEquals)
{
+ using namespace math::linear;
+
Vector v1(3, 1);
Vector v2(3, -1);
@@ -205,6 +221,8 @@ TEST_CASE(testOperatorPlusEquals)
TEST_CASE(testOperatorPlus)
{
+ using namespace math::linear;
+
Vector v1(3, 42);
Vector v2(3, 11);
Vector v3;
@@ -231,6 +249,8 @@ TEST_CASE(testOperatorPlus)
TEST_CASE(testOperatorMinusEquals)
{
+ using namespace math::linear;
+
//TODO: Vector& operator-=(const Vector& v)
Vector v1(5, 13);
Vector v2(5, -5);
@@ -247,6 +267,8 @@ TEST_CASE(testOperatorMinusEquals)
TEST_CASE(testNegate)
{
+ using namespace math::linear;
+
Vector X(3);
Vector Y(3);
X[0] = Y[2] = 1.;
@@ -258,6 +280,8 @@ TEST_CASE(testNegate)
TEST_CASE(testAdd)
{
+ using namespace math::linear;
+
Vector v1(3, 2.4);
Vector v2(3, 1.4);
@@ -284,6 +308,8 @@ TEST_CASE(testAdd)
TEST_CASE(testSubtract)
{
+ using namespace math::linear;
+
Vector v1(3, 2.4);
Vector v2(3, 1.4);
@@ -310,6 +336,8 @@ TEST_CASE(testSubtract)
TEST_CASE(testOperatorMinus)
{
+ using namespace math::linear;
+
Vector v1(4), v2(4);
for (int i = 0; i < 4; i++)
{
@@ -336,6 +364,8 @@ TEST_CASE(testOperatorMinus)
TEST_CASE(testOperatorTimesEquals)
{
+ using namespace math::linear;
+
Vector v1(4);
for (int i = 0; i < 4; i++)
v1[i] = i;
@@ -356,6 +386,8 @@ TEST_CASE(testOperatorTimesEquals)
TEST_CASE(testOperatorTimesEqualsScalar)
{
+ using namespace math::linear;
+
Vector v1(5);
for (int i = 0; i < 5; i++)
v1[i] = i;
@@ -369,6 +401,8 @@ TEST_CASE(testOperatorTimesEqualsScalar)
TEST_CASE(testOperatorTimesScalar)
{
+ using namespace math::linear;
+
Vector v1(5);
for (int i = 0; i < 5; i++)
v1[i] = i;
@@ -383,6 +417,8 @@ TEST_CASE(testOperatorTimesScalar)
TEST_CASE(testElementDivision)
{
+ using namespace math::linear;
+
Vector numerator(3);
numerator[0] = 0;
numerator[1] = 1;
@@ -402,6 +438,8 @@ TEST_CASE(testElementDivision)
TEST_CASE(testOperatorTimes)
{
+ using namespace math::linear;
+
Vector v1(4);
Vector v2(4);
for (int i = 0; i < 4; i++)
@@ -417,6 +455,8 @@ TEST_CASE(testOperatorTimes)
TEST_CASE(testOperatorDivide)
{
+ using namespace math::linear;
+
Vector v1(4);
Vector v2(4);
for (int i = 0; i < 4; i++)
@@ -430,11 +470,7 @@ TEST_CASE(testOperatorDivide)
TEST_ASSERT_EQ(v3[i], i / (i + 2.));
}
-
-
-
-int main()
-{
+TEST_MAIN(
TEST_CHECK(testDefaultConstructor);
TEST_CHECK(testScalarConstructor);
TEST_CHECK(testRawConstructor);
@@ -475,6 +511,4 @@ int main()
//TODO: template math::linear::Vector<_T> operator*(const math::linear::Matrix2D<_T>& m, const math::linear::Vector<_T>& v)
//TODO: template math::linear::Vector<_T> operator*(_T scalar, const math::linear::Vector<_T>& v)
//TODO: template std::ostream& operator<<(std::ostream& os, const math::linear::Vector<_T>& v)
-
- return EXIT_SUCCESS;
-}
+)
diff --git a/externals/coda-oss/modules/c++/math.linear/unittests/test_VectorN.cpp b/externals/coda-oss/modules/c++/math.linear/unittests/test_VectorN.cpp
index 26bdc186c..148cd4c18 100644
--- a/externals/coda-oss/modules/c++/math.linear/unittests/test_VectorN.cpp
+++ b/externals/coda-oss/modules/c++/math.linear/unittests/test_VectorN.cpp
@@ -33,12 +33,10 @@
#include "TestCase.h"
#include "math/linear/VectorN.h"
-using namespace math::linear;
-using namespace std;
-
-
TEST_CASE(testDefaultConstructor)
{
+ using namespace math::linear;
+
// Solaris doesn't like arrays of zero size unless you use -features=zla,
// so I've omitted this test.
//VectorN<0, double> v0;
@@ -54,6 +52,8 @@ TEST_CASE(testDefaultConstructor)
TEST_CASE(testScalarConstructor)
{
+ using namespace math::linear;
+
VectorN<3,double> v(42);
TEST_ASSERT_EQ(v.size(), static_cast(3));
TEST_ASSERT_EQ(v[0], 42);
@@ -64,6 +64,8 @@ TEST_CASE(testScalarConstructor)
TEST_CASE(testRawConstructor)
{
+ using namespace math::linear;
+
double raw[] = {1,2,3};
VectorN<3,double> v(raw);
TEST_ASSERT_EQ(v.size(), static_cast(3));
@@ -75,6 +77,8 @@ TEST_CASE(testRawConstructor)
TEST_CASE(testCopyConstructor)
{
+ using namespace math::linear;
+
VectorN<3,double> vsrc;
vsrc[0] = 1;
vsrc[1] = 2;
@@ -93,10 +97,9 @@ TEST_CASE(testCopyConstructor)
TEST_CASE(testStdVectorConstructor)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ std::vector stdvec{10, 11, 12};
VectorN<3,double> v(stdvec);
TEST_ASSERT_EQ(v.size(), static_cast(3));
@@ -116,6 +119,8 @@ TEST_CASE(testStdVectorConstructor)
TEST_CASE(testAssignmentOperator)
{
+ using namespace math::linear;
+
VectorN<2,double> vsrc;
vsrc[0] = 42;
vsrc[1] = 99;
@@ -129,6 +134,8 @@ TEST_CASE(testAssignmentOperator)
TEST_CASE(testScalarAssignment)
{
+ using namespace math::linear;
+
VectorN<5,double> v(123.456);
TEST_ASSERT_EQ(v.size(), static_cast(5));
for (int i = 0; i < 5; i++)
@@ -146,10 +153,9 @@ TEST_CASE(testScalarAssignment)
TEST_CASE(testStdVectorAssignment)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ const std::vector stdvec{10, 11, 12};
VectorN<3,double> v(-1);
v = stdvec;
@@ -162,6 +168,8 @@ TEST_CASE(testStdVectorAssignment)
TEST_CASE(testDotProduct)
{
+ using namespace math::linear;
+
VectorN<5,double> vd1(2);
VectorN<5,double> vd2(3);
const double dotprod(vd1.dot(vd2));
@@ -171,10 +179,10 @@ TEST_CASE(testDotProduct)
TEST_CASE(testNorm)
{
- std::vector stdvec;
- stdvec.push_back(10);
- stdvec.push_back(11);
- stdvec.push_back(12);
+ using namespace math::linear;
+
+ const std::vector stdvec{10, 11, 12};
+
VectorN<3,double> vnorm1(stdvec);
const double norm(vnorm1.norm());
const double arg(10.*10 + 11.*11 + 12.*12);
@@ -185,6 +193,8 @@ TEST_CASE(testNorm)
TEST_CASE(testNormalize)
{
+ using namespace math::linear;
+
VectorN<4,double> vnorm(4.0);
vnorm.normalize();
TEST_ASSERT_EQ(vnorm[0], 0.5);
@@ -196,6 +206,8 @@ TEST_CASE(testNormalize)
TEST_CASE(testScale)
{
+ using namespace math::linear;
+
VectorN<2,double> vscale(4.0);
vscale.scale(1.0 / 4.0);
TEST_ASSERT_EQ(vscale[0], 1.0);
@@ -204,6 +216,8 @@ TEST_CASE(testScale)
TEST_CASE(testUnit)
{
+ using namespace math::linear;
+
VectorN<4,double> v(4.0);
VectorN<4,double> vunit = v.unit();
TEST_ASSERT_EQ(v[0], 4.0);
@@ -218,6 +232,8 @@ TEST_CASE(testUnit)
TEST_CASE(testOperatorPlusEquals)
{
+ using namespace math::linear;
+
VectorN<3,double> v1(1);
VectorN<3,double> v2(-1);
@@ -238,6 +254,8 @@ TEST_CASE(testOperatorPlusEquals)
TEST_CASE(testOperatorPlus)
{
+ using namespace math::linear;
+
VectorN<3,double> v1(42);
VectorN<3,double> v2(11);
VectorN<3,double> v3;
@@ -264,6 +282,8 @@ TEST_CASE(testOperatorPlus)
TEST_CASE(testOperatorMinusEquals)
{
+ using namespace math::linear;
+
VectorN<5,double> v1(13);
VectorN<5,double> v2(-5);
@@ -279,6 +299,8 @@ TEST_CASE(testOperatorMinusEquals)
TEST_CASE(testNegate)
{
+ using namespace math::linear;
+
VectorN<3,double> X;
VectorN<3,double> Y;
X[0] = Y[2] = 1.;
@@ -290,6 +312,8 @@ TEST_CASE(testNegate)
TEST_CASE(testAdd)
{
+ using namespace math::linear;
+
VectorN<3,double> v1(2.4);
VectorN<3,double> v2(1.4);
@@ -315,6 +339,8 @@ TEST_CASE(testAdd)
TEST_CASE(testSubtract)
{
+ using namespace math::linear;
+
VectorN<3,double> v1(2.4);
VectorN<3,double> v2(1.4);
@@ -340,6 +366,8 @@ TEST_CASE(testSubtract)
TEST_CASE(testOperatorMinus)
{
+ using namespace math::linear;
+
VectorN<4,double> v1;
VectorN<4,double> v2;
for (int i = 0; i < 4; i++)
@@ -366,6 +394,8 @@ TEST_CASE(testOperatorMinus)
TEST_CASE(testOperatorTimesEquals)
{
+ using namespace math::linear;
+
VectorN<4,double> v1;
for (int i = 0; i < 4; i++)
v1[i] = i;
@@ -384,6 +414,8 @@ TEST_CASE(testOperatorTimesEquals)
TEST_CASE(testOperatorTimesEqualsScalar)
{
+ using namespace math::linear;
+
VectorN<5,double> v1;
for (int i = 0; i < 5; i++)
v1[i] = i;
@@ -397,6 +429,8 @@ TEST_CASE(testOperatorTimesEqualsScalar)
TEST_CASE(testOperatorTimesScalar)
{
+ using namespace math::linear;
+
VectorN<5,double> v1;
for (int i = 0; i < 5; i++)
v1[i] = i;
@@ -411,6 +445,8 @@ TEST_CASE(testOperatorTimesScalar)
TEST_CASE(testElementDivision)
{
+ using namespace math::linear;
+
VectorN<3,double> numerator;
numerator[0] = 0;
numerator[1] = 1;
@@ -429,6 +465,8 @@ TEST_CASE(testElementDivision)
TEST_CASE(testOperatorTimes)
{
+ using namespace math::linear;
+
VectorN<3,double> v1, v2;
for (int i = 0; i < 3; i++)
{
@@ -444,6 +482,8 @@ TEST_CASE(testOperatorTimes)
TEST_CASE(testOperatorDivide)
{
+ using namespace math::linear;
+
VectorN<3,double> v1, v2;
for (int i = 0; i < 3; i++)
{
@@ -456,9 +496,7 @@ TEST_CASE(testOperatorDivide)
TEST_ASSERT_EQ(v3[i], (i + 1.) / (i + 2.));
}
-
-int main()
-{
+TEST_MAIN(
TEST_CHECK(testDefaultConstructor);
TEST_CHECK(testScalarConstructor);
TEST_CHECK(testRawConstructor);
@@ -484,6 +522,4 @@ int main()
TEST_CHECK(testElementDivision);
TEST_CHECK(testOperatorTimes);
TEST_CHECK(testOperatorDivide);
-
- return EXIT_SUCCESS;
-}
+ )
diff --git a/externals/coda-oss/modules/c++/math.linear/unittests/test_eigenvalue.cpp b/externals/coda-oss/modules/c++/math.linear/unittests/test_eigenvalue.cpp
index ca2454b20..8c0f294c9 100644
--- a/externals/coda-oss/modules/c++/math.linear/unittests/test_eigenvalue.cpp
+++ b/externals/coda-oss/modules/c++/math.linear/unittests/test_eigenvalue.cpp
@@ -23,8 +23,6 @@
#include "TestCase.h"
#include