Skip to content

Commit 758f189

Browse files
J. Daniel SmithDan Smith
andauthored
latest from "nitro" and "coda-oss" (#462)
* Create CMakeSettings.json * new/updated "docs" directory * update externals/nitro with latest from nitro repo * use in32_t, etc. instead of nitf::Int32_t * Revert "Merge branch 'feature/update_nitro' into develop/jdsmith" This reverts commit 52001ee, reversing changes made to aac9d2c. * Revert "Merge branch 'feature/use_standard_C_types' into develop/jdsmith" This reverts commit aac9d2c, reversing changes made to 89b7807. * use in32_t, etc. instead of nitf::Int32_t * update externals/nitro with latest from nitro repo * Revert "update externals/nitro with latest from nitro repo" This reverts commit 7eb2813. * update nitro/nrt * update "nitro" * nitf::Int8 -> int8_t * updates from coda-oss and nitro * update externals/nitro with latest from "main" * update externals/coda-oss with latest from "main" * don't want "docs" directory in externals/nitro * fix bad merge * ignore CMake-generated files * std::auto_ptr -> std::unique_ptr * need std::auto_ptr<> overloads for pre-generated Python wrapper code * provide std::auto_ptr "overloads" so that existing Python wrapper code continues to work w/o changes * impelement std::auto_ptr "overrides" * latest from nitro:main * update externals/nitro * update coda-oss * Create codeql-analysis.yml * update coda-oss with latest from "main" * update nitro with latest from "main" * Revert "Create codeql-analysis.yml" This reverts commit b261bbd. * fix nitf::Field to get rid of compiler errors * build externals/coda-oss by itself * build with Visual Studio 2019 (#358) * Revert "Create codeql-analysis.yml" This reverts commit 4388277. * build nitro projects in SIX solution * build "six" as a Visual Studio project * build "scene" with Visual Studio * build cphd with Visual Studio * build cphd03 with Visual Studio * build six.sicd with Visual Studio * build six.sidd with Visual Studio * buid six.convert with Visual Studio * add a GTest project * trying to get a unittest working * build XML_DATA_CONTENT * get a NITF unit-test working :-) * run all "six" unittests * fix dummy DEFAULT_SCHEMA_PATH * allow unit-tests to run in Visual Studio * run SIDD unit-tests from Visual Studio * set SIX_SCHEMA_PATH so unittest works * run SICD unittests in Visual Studio * build and run six.sicd unittests in Visual Studio * set NITF_PLUGIN_PATH for sicd_test_area_plane * build cphd03 unittests in Visual Studio * run remaining cphd03 unittests * fix build error introduced with VS2019 changes * build cphd unittests in Visual Studio * build & run remaining cphd unittests in Visual Studio * use c++11 (#359) * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * get rid of hard-coded paths with <filesystem> (#360) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * build crop_sicd in Visual Studio (#361) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * build crop_sicd * update coda-oss with latest from "main" * update coda-oss with latest from "main" (#362) * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from coda-oss "main" (#364) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * update coda-oss (#365) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * latest from coda-oss * another update to coda-oss (#366) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * latest from coda-oss * latest from coda-oss * Develop/update externals (#367) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * latest from coda-oss * latest from coda-oss * latest from coda-oss * latest from coda-oss (#368) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * latest from coda-oss * latest from coda-oss * latest from coda-oss * latest from "main" on coda-oss * latest from coda-oss (#369) * update coda-oss with latest from "main" * coda-oss updates to make TextEncoding part of the OutputStream * updates from coda-oss to make TextEncoding part of the OutputStream * fix StringStream() .ctor() * one more coda-oss update * latest from "main" on coda-oss: xml.lite updates for UTF-8 * restore changes lost in merge * latest from coda-oss * latest from coda-oss * latest from coda-oss * latest from "main" on coda-oss * use Filesystem.h from coda-oss instead of <filesystem> * use sys::Filesystem * update "nitro" and "coda-oss" (#370) * update "nitro" and "coda-oss" * Delete CMakeSettings.json * changeFileHeader() doesn't (yet) work in "externals" * preserve utf8 in XML text (#363) * pass io::Encoding::Utf8 to print() and prettyPrint() to preserve UTF-8 in output * store the value of xml::lite::MinidomParser::preserveCharacterData() so we can figure out the encoding * Don't want to set a dummy schema path to a directory that exists * add a unit-test for UTF-8 characters in "Classification" * fix isUnclassified() so it works for "NON CLASSIFIÉ / UNCLASSIFIED" * Revert "Merge branch 'main' into bugfix/preserve_UTF8_in_classified_field" This reverts commit 12534c9, reversing changes made to 02ce755. * account for coda-oss changes where TextEncoding is part of the OutputStream * get the right verson of Element.h * use new xml::lite to read/write XML in UTF-8 * be sure we can read-in and process UTF-8 from a NITF * assume UTF-8 on *ix and Windows-1252 on Windows * reduce "gratuatous" diffs for simpler merge request * one more unneeded diff * French -> Canada * latest from coda-oss * trying to get the test_valid_six unittest working on Linux * use .tar, not .tar.gz * add another unit-test (#371) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * remove some compiler warnings (#372) * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update externals (#373) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * use c++11 features (#374) * update "nitro" * update coda-oss and fix compiler errors * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest "nitro" (#375) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" (#376) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more use of C++11 (#377) * update "nitro" * update coda-oss and fix compiler errors * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * fix build errors from recent changes (#378) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * NULL -> nullptr (#379) * update "nitro" * update coda-oss and fix compiler errors * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * use filesystem::path and std::endian * less use of sys:: * NULL -> nullptr * latest from coda-oss (#381) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from develop/jdsmith (#382) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * use filesystem::path and std::endian * more filesystem from coda-oss * less use of sys:: * NULL -> nullptr * use .data() rather than &d[0] * mem::BufferView -> std::span * const std::span<>& doesn't make much sense * need make_span() overload for pointer+size * latest from "nitro" (#383) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * latest from develop/jdsmith (#385) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * use filesystem::path and std::endian * more filesystem from coda-oss * less use of sys:: * NULL -> nullptr * use .data() rather than &d[0] * mem::BufferView -> std::span * const std::span<>& doesn't make much sense * need make_span() overload for pointer+size * latest from "nitro" * std::endian * coda-oss now gives us std::endian * sys::Filesystem -> std::filesystem * don't need to explicitly call fs::path::string() in most cases * sys::Filesystem -> std::filesystem * fix build errors when using C++17 * latest from "nitro" (#387) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest changes from develop/jdsmith (#386) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * use filesystem::path and std::endian * more filesystem from coda-oss * less use of sys:: * NULL -> nullptr * use .data() rather than &d[0] * mem::BufferView -> std::span * const std::span<>& doesn't make much sense * need make_span() overload for pointer+size * latest from "nitro" * std::endian * coda-oss now gives us std::endian * sys::Filesystem -> std::filesystem * don't need to explicitly call fs::path::string() in most cases * sys::Filesystem -> std::filesystem * fix build errors when using C++17 * simplify access to some ImageSubheader values * newReadControl() returns a std::unique_ptr<> rather than a raw pointer * a singleton is much easier in C++11 * don't need to do manual locking in C++11 * use a template and some macros to dramatically simplify Enums * adjust macros for GCC, provide operators for SWIG * got the map entries wrong * make getIndices() a bit more robust * store a std::unique_ptr<> instead of a raw poniter * throw exceptions in getIndices() rather than assuming * use Enum<T>.toString() where possible rather than duplicating code * remove duplicate code converting from a string to Enum<T> * don't explicilty check for "SIDD" as that's already part of getDataType() * use std::string instead of char[] * reduce use of "delete[]" * less use of "SICD" and "SIDD", use six::DataType instead * simplify Region buffer management * reduce some explicit use of std::shared_ptr<> with std::make_shared and/or auto * more reduction in explicit use of std::shared_ptr * latest from "nitro" * simplify use of six::Region * reduce use of explicit .toString() * further reduction in explicit use of toString() * template specialiaton can't be inline with G++ * simplify cphd enum creation * reduce use of toString() with setAttribute() * update externals (#388) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * reduce use of toString() (#389) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * use filesystem::path and std::endian * more filesystem from coda-oss * less use of sys:: * NULL -> nullptr * use .data() rather than &d[0] * mem::BufferView -> std::span * const std::span<>& doesn't make much sense * need make_span() overload for pointer+size * latest from "nitro" * std::endian * coda-oss now gives us std::endian * sys::Filesystem -> std::filesystem * don't need to explicitly call fs::path::string() in most cases * sys::Filesystem -> std::filesystem * fix build errors when using C++17 * simplify access to some ImageSubheader values * newReadControl() returns a std::unique_ptr<> rather than a raw pointer * a singleton is much easier in C++11 * don't need to do manual locking in C++11 * use a template and some macros to dramatically simplify Enums * adjust macros for GCC, provide operators for SWIG * got the map entries wrong * make getIndices() a bit more robust * store a std::unique_ptr<> instead of a raw poniter * throw exceptions in getIndices() rather than assuming * use Enum<T>.toString() where possible rather than duplicating code * remove duplicate code converting from a string to Enum<T> * don't explicilty check for "SIDD" as that's already part of getDataType() * use std::string instead of char[] * reduce use of "delete[]" * less use of "SICD" and "SIDD", use six::DataType instead * simplify Region buffer management * reduce some explicit use of std::shared_ptr<> with std::make_shared and/or auto * more reduction in explicit use of std::shared_ptr * latest from "nitro" * simplify use of six::Region * reduce use of explicit .toString() * further reduction in explicit use of toString() * template specialiaton can't be inline with G++ * simplify cphd enum creation * reduce use of toString() with setAttribute() * latest from "nitro" and "coda-oss" * don't need catch(excep::Exception) ex.toString() as std::exception::what() now does the same thing * really only have two calls to setAttribute(): std::string and size_t * use macros to generate SIDD Enums * add operator<< for Enum<T> to avoid some explicit .toString() calls * add operator==(std::string) overload to redue need for .toString() * add operator<<() to redue need for .toString() * don't implmeent a bunch of six::toString() routines; they sholdn't be called anymore * further reduction in use of toString() * eliminate six::toString() template; just provide a few overloads instead * createSixString() which calls six::toString(t) instead of t.toString() * createSixString() overload with URI parameter * allow different strings (e.g., "1" and "+1") to map to the same value * put "Enum" support code in a separate file * there is now just one NOT_SET_VALUE * latest from coda-oss (#390) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * latest from coda-oss * lost toString<nullptr>() * latest from coda-oss/main * want "std" augmented in this repo * latest from coda-oss and nitro (#391) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * latest from coda-oss * lost toString<nullptr>() * latest from coda-oss/main * want "std" augmented in this repo * partial update from coda-oss/main * latest from coda-oss/main * update coda-oss with latest from https://github.com/mdaus/coda-oss * update externals/nitro/docs * latest from "nitro" * Revert "latest from "nitro"" This reverts commit 0b99300. * latest from nitro/master * ignore build/ directory * Revert "latest from nitro/master" This reverts commit e89da71. * update externals/nitro/docs * update "c", "java", "mex", and "python" directories -- but not "c++" * update other nitro top-level files ... everything except modules/c++ * VCXPROJ files from nitro * several changes from nitro/c++ ... hoping this builds. * fix build error on Linux * more changes from nitro/modules/c++ * fix IOStreamWriter ctor * more changes from nitro/modules/c++ * paths are wrong when in "externals" * remove externals/nitro/docs * slam in "main" * latest from coda-oss/main * adjust coda-oss for our usage * latest from nitro/main * std::span removed from "nitro" * need to redo C++17 * fix missing #include file * remove "nitro" files not needed in externals/nitro * paths are wrong in "externals" * Revert "remove "nitro" files not needed in externals/nitro" This reverts commit da30b96. * Revert "Revert "remove "nitro" files not needed in externals/nitro"" This reverts commit e69391b. * slam in externals as merging creates too many conflicts * merge brought back a deleted #include * add back "java" and "mex" * lates from coda-oss/main * latest from "nitro" * paths are wrong in "externals" * need to redo C++17 support * std::span -> gsl::span * Revert "std::span -> gsl::span" This reverts commit c10f233. * latest from coda-oss and nitro * these are the correct files from "master" * gsl::span -> std::span * get #includes right for PCH * didn't want this change * trigger build on GitHub * remove files that shouldn't have been committed * latest from coda-oss:master * latest from nitro::master * adjust to API changes in coda-oss/xml.lite * latest from coda-oss * latest from coda-oss * std::filesystem::path doesn't implicitly convert to std::string * more place where an explicit std::filesystem::path::string() call is needed * latest from "coda-oss" and "nitro" * latest from coda-oss * one more change from coda-oss * "nitro" changes to build with C90 instead of C99 * old C++11 compilers don't like template<template> * new TREs from "nitro" * std::shared_ptr<> doesn't have [] versions, only std::unique_ptr * build with older compilers * latest coda-oss changes * Update .gitignore from "nitro" * SWIG doesn't like "final" * SWIG doesn't like "final" * latest from coda_oss * latest from "nitro" * add a version number to externals/coda-oss * add a version number to externals/nitro * restore "build" and "cmake" * Gsl_.h got lost ... ? * update CMS to 3.0.3.3 (#433) * remove version numbers (for now); we've went a very long time w/o them * finish rename * version number is in too many places ... * missing .cmake files * missing "build" files * latest from coda-oss * latest from "master" on coda-oss * latest from "master" at nitro * remove CA diagnostics from coda-oss * CODA_OSS_AUGMENT_std_namespace got clobbered again * update coda-oss and nitro * be sure coda-oss "std" files are copied * use new coda-oss "std" headers * more coda-oss changes * updates from coda-oss and nitro * latest from coda-oss * fix coda-oss unittest dependencies * WAF dependencies for "scene" * sys/Filesystem.h -> std/filesystem * build using C++17 features * account for removed coda-oss overloads * add back coda_oss;;filesystem::path * forgot to add new "coda_oss" directory * latest from "coda-oss" and "nitro" * tweaks to python wrappers from coda-oss * updates from coda-oss to remove compiler warnings * another update to coda-oss to get rid of code-analysis diagnostics * latest from coda-oss * coda-oss updates to reduce compiler warnings/code-analysis diagnostics * latest from coda-oss to reduce compiler warnings * more code-analysis diagnostics fixes from coda-oss * latest from coda-oss * updates from "nitro" * lost sys/Conf.h #include * latest from coda-oss and nitro * latest from nitro * latest from coda-oss * updates from "nitro" * latest from "nitro" to support nitf-c++ as a DLL/shared-library * build w/o errors when nitf-c++ is a DLL * explicitly list SegmentMemorySource() overloads * latest from coda-oss to get rid of more compiler warnings/code-analysis diagnostics * be sure NITRO validation changes don't break SIX unittests * build NITRO @ /W4 * latest from "nitro" and "coda-oss" * reduce use of .c_str() in "nitro" * changes from coda-oss to reduce code-analysis diagnostics * tweaks for VS2019 16.10 * latest from nitro and coda-oss * latest from coda-oss * latest from NITRO Co-authored-by: Dan Smith <j.daniel.smith@mdaus.com>
1 parent e708b98 commit 758f189

9 files changed

Lines changed: 211 additions & 13 deletions

File tree

externals/coda-oss/modules/c++/except/include/except/Exception.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
struct _Name##Exception : public _Base \
5656
{ \
5757
_Name##Exception() = default; virtual ~_Name##Exception() = default; \
58+
_Name##Exception(const _Name##Exception&) = default; _Name##Exception& operator=(const _Name##Exception&) = default; \
59+
_Name##Exception(_Name##Exception&&) = default; _Name##Exception& operator=(_Name##Exception&&) = default; \
5860
_Name##Exception(const except::Context& c) : _Base(c){} \
5961
_Name##Exception(const std::string& msg) : _Base(msg){} \
6062
_Name##Exception(const except::Throwable& t, const except::Context& c) : _Base(t, c){} \

externals/coda-oss/modules/c++/except/include/except/Throwable.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Throwable
109109
* Get the trace
110110
* \return The trace (const)
111111
*/
112-
const Trace& getTrace() const
112+
const Trace& getTrace() const noexcept
113113
{
114114
return mTrace;
115115
}
@@ -118,7 +118,7 @@ class Throwable
118118
* Get the trace
119119
* \return The trace (non-const)
120120
*/
121-
Trace& getTrace()
121+
Trace& getTrace() noexcept
122122
{
123123
return mTrace;
124124
}
@@ -143,7 +143,7 @@ class Throwable
143143
return s.str();
144144
}
145145

146-
const std::vector<std::string>& getBacktrace() const
146+
const std::vector<std::string>& getBacktrace() const noexcept
147147
{
148148
return mBacktrace;
149149
}

externals/coda-oss/modules/c++/except/include/except/Trace.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ struct Trace final
6363
/*!
6464
* Pops Context off the stack
6565
*/
66-
void popContext()
66+
void popContext() noexcept
6767
{
6868
mStack.pop_front();
6969
}
7070

7171
/*!
7272
* Gets first Context on stack
7373
*/
74-
const Context& getContext() const
74+
const Context& getContext() const noexcept
7575
{
7676
return mStack.front();
7777
}
@@ -80,7 +80,7 @@ struct Trace final
8080
* Get the stack
8181
* \return The stack (const)
8282
*/
83-
const std::list<Context>& getStack() const
83+
const std::list<Context>& getStack() const noexcept
8484
{
8585
return mStack;
8686
}
@@ -89,7 +89,7 @@ struct Trace final
8989
* Get the stack
9090
* \return The stack (non-const)
9191
*/
92-
std::list<Context>& getStack()
92+
std::list<Context>& getStack() noexcept
9393
{
9494
return mStack;
9595
}

externals/nitro/modules/c++/nitf/include/nitf/ImageReader.hpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
#pragma once
2626

2727
#include <assert.h>
28+
#include <stdio.h>
2829

2930
#include <vector>
3031
#include <string>
31-
#include <memory>
3232

3333
#include <std/span>
34+
#include <std/cstddef> // std::byte
3435

3536
#include "nitf/coda-oss.hpp"
3637
#include "nitf/ImageReader.h"
@@ -49,7 +50,7 @@ namespace nitf
4950
class BufferList /*final*/ // no "final", SWIG doesn't like it
5051
{
5152
std::vector<T*> buffer;
52-
std::vector<std::unique_ptr<T[]>> buffer_;
53+
std::vector<std::vector<T>> buffer_;
5354

5455
public:
5556
BufferList(size_t nBands)
@@ -61,8 +62,8 @@ namespace nitf
6162
{
6263
for (size_t i = 0; i < size(); i++)
6364
{
64-
buffer_[i].reset(new T[subWindowSize]);
65-
buffer[i] = buffer_[i].get();
65+
buffer_[i].resize(subWindowSize);
66+
buffer[i] = buffer_[i].data();
6667
}
6768
}
6869

@@ -81,7 +82,24 @@ namespace nitf
8182
{
8283
return buffer[i];
8384
}
85+
86+
int padded = 0;
87+
88+
using iterator = typename std::vector<std::vector<T>>::iterator;
89+
iterator begin() { return buffer_.begin(); }
90+
iterator end() { return buffer_.end(); }
91+
92+
using const_iterator = typename std::vector<std::vector<T>>::const_iterator;
93+
const_iterator begin() const { return buffer_.begin(); }
94+
const_iterator end() const { return buffer_.end(); }
95+
const_iterator cbegin() const { return buffer_.cbegin(); }
96+
const_iterator cend() const { return buffer_.cend(); }
8497
};
98+
template<typename T>
99+
inline size_t write(FILE* f, const std::vector<T>& buffer)
100+
{
101+
return fwrite(buffer.data(), sizeof(T), buffer.size() / sizeof(T), f);
102+
}
85103

86104
/*!
87105
* \class ImageReader
@@ -121,6 +139,7 @@ DECLARE_CLASS(ImageReader)
121139
void* user_ = user;
122140
read(subWindow, static_cast<uint8_t**>(user_), padded);
123141
}
142+
BufferList<std::byte> read(const nitf::SubWindow& subWindow, size_t nbpp);
124143

125144
/*!
126145
* Read a block directly from file

externals/nitro/modules/c++/nitf/include/nitf/ImageSubheader.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ DECLARE_CLASS(ImageSubheader)
287287

288288
//! Get the actualBitsPerPixel
289289
nitf::Field getActualBitsPerPixel() const;
290+
size_t actualBitsPerPixel() const
291+
{
292+
return getActualBitsPerPixel();
293+
}
290294

291295
//! Get the pixelJustification
292296
nitf::Field getPixelJustification() const;

externals/nitro/modules/c++/nitf/include/nitf/SubWindow.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <string>
2626
#include <vector>
2727

28+
#include <std/optional>
29+
2830
#include "nitf/SubWindow.h"
2931
#include "nitf/DownSampler.hpp"
3032
#include "nitf/Object.hpp"
@@ -87,9 +89,9 @@ DECLARE_CLASS(SubWindow)
8789
void setStartCol(uint32_t value);
8890
void setNumCols(uint32_t value);
8991
void setBandList(uint32_t * value);
92+
void setBandList(std::vector<uint32_t>&&);
9093
void setNumBands(uint32_t value);
9194

92-
9395
/*!
9496
* Reference a DownSampler within the SubWindow
9597
* The SubWindow does NOT own the DownSampler
@@ -103,13 +105,16 @@ DECLARE_CLASS(SubWindow)
103105

104106
/*!
105107
* Return the DownSampler that is referenced by this SubWindow.
106-
* If no DownSampler is referenced, a NITFException is thrown.
107108
*/
108109
nitf::DownSampler* getDownSampler() noexcept;
110+
const nitf::DownSampler* getDownSampler() const noexcept;
109111

110112
private:
111113
nitf::DownSampler* mDownSampler = nullptr;
112114
nitf_Error error{};
115+
116+
void updateBandList();
117+
std::optional<std::vector<uint32_t>> bandList;
113118
};
114119

115120
#if CODA_OSS_cpp14

externals/nitro/modules/c++/nitf/source/ImageReader.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#include "nitf/ImageReader.hpp"
2424

25+
#undef min
26+
#undef max
27+
2528
using namespace nitf;
2629

2730
ImageReader::ImageReader(const ImageReader & x)
@@ -76,6 +79,29 @@ void ImageReader::setReadCaching()
7679
nitf_ImageReader_setReadCaching(getNativeOrThrow());
7780
}
7881

82+
BufferList<std::byte> ImageReader::read(const nitf::SubWindow& window, size_t nbpp)
83+
{
84+
// see py_ImageReader_read() and doRead() in test_buffered_read.cpp
85+
86+
const auto numBitsPerPixel = nbpp;
87+
const size_t numBytesPerPixel = NITF_NBPP_TO_BYTES(numBitsPerPixel);
88+
const auto numBytesPerBand = static_cast<size_t>(window.getNumRows()) * static_cast<size_t>(window.getNumCols()) * numBytesPerPixel;
89+
90+
auto downsampler = window.getDownSampler();
91+
const uint32_t rowSkip = downsampler ? downsampler->getRowSkip() : 1;
92+
const uint32_t colSkip = downsampler ? downsampler->getColSkip() : 1;
93+
94+
auto imageDeblocker = getNativeOrThrow()->imageDeblocker;
95+
const auto subimageSize = static_cast<size_t>(window.getNumRows() / rowSkip) *
96+
(window.getNumCols() / colSkip) * nitf_ImageIO_pixelSize(imageDeblocker);
97+
98+
BufferList<std::byte> retval(window.getNumBands());
99+
retval.initialize(subimageSize);
100+
read(window, retval.data(), &retval.padded);
101+
102+
return std::move(retval);
103+
}
104+
79105
extern "C" {
80106
NITF_BOOL nitf_ImageIO_getMaskInfo(nitf_ImageIO* nitf,
81107
uint32_t* imageDataOffset, uint32_t* blockRecordLength,

externals/nitro/modules/c++/nitf/source/SubWindow.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,25 @@ SubWindow::SubWindow(const SubWindow & x)
2929
*this = x;
3030
}
3131

32+
void SubWindow::updateBandList()
33+
{
34+
assert(bandList.has_value());
35+
setBandList(bandList->data());
36+
setNumBands(gsl::narrow<uint32_t>(bandList->size()));
37+
}
38+
3239
SubWindow & SubWindow::operator=(const SubWindow & x)
3340
{
3441
if (&x != this)
42+
{
3543
setNative(x.getNative());
44+
45+
bandList = x.bandList;
46+
if (bandList.has_value())
47+
{
48+
updateBandList();
49+
}
50+
}
3651
return *this;
3752
}
3853

@@ -109,6 +124,12 @@ void SubWindow::setBandList(uint32_t * value)
109124
{
110125
getNativeOrThrow()->bandList = value;
111126
}
127+
void SubWindow::setBandList(std::vector<uint32_t>&& value)
128+
{
129+
bandList = std::move(value);
130+
updateBandList();
131+
}
132+
112133

113134
uint32_t SubWindow::getNumBands() const
114135
{
@@ -143,3 +164,7 @@ nitf::DownSampler* SubWindow::getDownSampler() noexcept
143164
{
144165
return mDownSampler;
145166
}
167+
const nitf::DownSampler* SubWindow::getDownSampler() const noexcept
168+
{
169+
return mDownSampler;
170+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/* =========================================================================
2+
* This file is part of NITRO
3+
* =========================================================================
4+
*
5+
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
6+
*
7+
* NITRO is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published by
9+
* the Free Software Foundation; either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this program; if not, If not,
19+
* see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
// modeled after nitf_extract.py
24+
25+
#include <stdio.h>
26+
27+
#include <string>
28+
#include <vector>
29+
#include <numeric> // std::iota
30+
31+
#include <import/str.h>
32+
#include <import/sys.h>
33+
34+
#include <import/nitf.hpp>
35+
36+
template<typename T>
37+
inline std::vector<T> iota(size_t count, T value)
38+
{
39+
std::vector<T> retval(count);
40+
std::iota(retval.begin(), retval.end(), value);
41+
return retval;
42+
}
43+
44+
static std::vector<std::string> extract_image(const nitf::ImageSubheader& subheader, uint32_t index, nitf::ImageReader& imageReader,
45+
const std::string& outDir="", const std::string& baseName="")
46+
{
47+
nitf::SubWindow window;
48+
window.setNumRows(subheader.numRows());
49+
window.setNumCols(subheader.numCols());
50+
window.setBandList(iota(subheader.getBandCount(), static_cast<uint32_t>(0))); // window.bandList = list(range(subheader.getBandCount()))
51+
const auto nbpp = subheader.actualBitsPerPixel(); //const auto nbpp = subheader.numBitsPerPixel();
52+
const auto bandData = imageReader.read(window, nbpp);
53+
54+
std::vector<std::string> outNames;
55+
size_t band = 0;
56+
for (const auto& data : bandData) // for band, data in enumerate(bandData):
57+
{
58+
auto outName = str::format("%s_%d__%d_x_%d_%d_band_%d.out",
59+
baseName.c_str(), index, window.getNumRows(), window.getNumCols(), static_cast<int>(nbpp), static_cast<int>(band));
60+
outName = sys::Path::joinPaths(outDir, outName);
61+
auto f = fopen(outName.c_str(), "wb"); // f = open(outName, "wb");
62+
nitf::write(f, data); // fwrite(data.data(), sizeof(data[0]), data.size() / sizeof(data[0]), f);
63+
fclose(f); // f.close();
64+
outNames.push_back(outName);
65+
band++;
66+
}
67+
68+
return outNames;
69+
}
70+
71+
static void extract_images(const std::string& fileName, const std::string& outDir = "")
72+
{
73+
nitf::IOHandle handle(fileName);
74+
nitf::Reader reader;
75+
nitf::Record record = reader.read(handle);
76+
77+
uint32_t i = 0;
78+
for (nitf::ImageSegment segment : record.getImages())
79+
{
80+
auto imReader = reader.newImageReader(i);
81+
extract_image(segment.getSubheader(), i, imReader, outDir, sys::Path::basename(fileName));
82+
83+
i++;
84+
}
85+
86+
handle.close();
87+
}
88+
89+
int main(int argc, char **argv)
90+
{
91+
try
92+
{
93+
// Check argv and make sure we are happy
94+
if (argc != 3)
95+
{
96+
std::cout << "Usage: %s <input-file> <output-file> \n" << argv[0]
97+
<< std::endl;
98+
exit( EXIT_FAILURE);
99+
}
100+
101+
// Check that wew have a valid NITF
102+
if (nitf::Reader::getNITFVersion(argv[1]) == nitf::Version::NITF_VER_UNKNOWN)
103+
{
104+
std::cout << "Invalid NITF: " << argv[1] << std::endl;
105+
exit( EXIT_FAILURE);
106+
}
107+
108+
extract_images(argv[1]);
109+
return 0;
110+
}
111+
catch (const std::exception& ex)
112+
{
113+
std::cerr << "ERROR!: " << ex.what() << "\n";
114+
return 1;
115+
}
116+
}
117+

0 commit comments

Comments
 (0)