Skip to content

Commit

Permalink
latest from "coda-oss" and "nitro" (#481)
Browse files Browse the repository at this point in the history
* 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

* latest from coda-oss

* latest from "nitro"

* getCornersAsLatLons should be w/o "const"

* latest from coda-oss

* latest from coda-oss

* latest from "nitro"

* latest from coda-oss

* latest from "nitro"

* latest from coda-oss

* mem::ScopedArray<T> is now the same as std::unique_ptr<T[]>

* latest from coda-oss

* latest from "nitro"

* account for NITRO changes

* latest from nitro and coda-oss

* latest from coda-oss

* Revert "latest from coda-oss"

This reverts commit f38b783.

* latest from coda-oss

* latest from "nitro"
  • Loading branch information
J. Daniel Smith authored Sep 3, 2021
1 parent 76471c3 commit 56f3371
Show file tree
Hide file tree
Showing 11 changed files with 327 additions and 90 deletions.
5 changes: 5 additions & 0 deletions externals/coda-oss/modules/c++/math/include/math/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ template <typename T> inline bool isNaN(T value) noexcept
return std::isnan(value);
}

// https://man7.org/linux/man-pages/man3/sincos.3.html
void SinCos(float angle, float& sin, float& cos);
void SinCos(double angle, double& sin, double& cos);
//void SinCos(long double angle, long double& sin, long double& cos);

/*
* Calculate the binomial coefficient
* Be wary of the possibility of overflow from integer arithmetic.
Expand Down
38 changes: 37 additions & 1 deletion externals/coda-oss/modules/c++/math/source/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#include "math/Utilities.h"

#if !_WIN32 // TODO: what about Apple?
// https://man7.org/linux/man-pages/man3/sincos.3.html
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE /* See feature_test_macros(7) */
#endif // _GNU_SOURCE
#endif // _WIN32

#include <math.h>
#include <cmath>

#include <except/Exception.h>
#include <str/Convert.h>
#include <math/Utilities.h>

namespace math
{
Expand All @@ -47,3 +57,29 @@ sys::Uint64_T nChooseK(size_t n, size_t k)
}
}

static inline void sincosf_(float x, float& sin, float& cos)
{
#if !_WIN32 // TODO: what about Apple?
sincosf(x, &sin, &cos);
#else
sin = std::sin(x);
cos = std::cos(x);
#endif
}
static inline void sincos_(double x, double& sin, double& cos)
{
#if !_WIN32 // TODO: what about Apple?
sincos(x, &sin, &cos);
#else
sin = std::sin(x);
cos = std::cos(x);
#endif
}
void math::SinCos(float x, float& sin, float& cos)
{
sincosf_(x, sin, cos);
}
void math::SinCos(double x, double& sin, double& cos)
{
sincos_(x, sin, cos);
}
14 changes: 11 additions & 3 deletions externals/coda-oss/modules/c++/mem/include/mem/SharedPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
*
*/

#ifndef __MEM_SHARED_PTR_H__
#define __MEM_SHARED_PTR_H__
#ifndef CODA_OSS_mem_SharedPtr_h_INCLUDED_
#define CODA_OSS_mem_SharedPtr_h_INCLUDED_
#pragma once

#include <memory>

#include <config/coda_oss_config.h>

Expand All @@ -34,10 +37,15 @@
// as part of a SWIG interface will result in a missing template type error.
namespace mem
{
#if !CODA_OSS_enable_mem_SharedPtr
template <typename T>
using SharedPtr = std::shared_ptr<T>;
#else
template<typename T>
class SharedPtr;
#endif
}

#include <mem/SharedPtrCpp11.h>

#endif
#endif // CODA_OSS_mem_SharedPtr_h_INCLUDED_
31 changes: 26 additions & 5 deletions externals/coda-oss/modules/c++/mem/include/mem/SharedPtrCpp11.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*
*/

#ifndef __MEM_SHARED_PTR_CPP_11_H__
#define __MEM_SHARED_PTR_CPP_11_H__
#ifndef CODA_OSS_mem_SharedPtrCpp11_h_INCLUDED_
#define CODA_OSS_mem_SharedPtrCpp11_h_INCLUDED_
#pragma once

#include <memory>
Expand All @@ -43,6 +43,14 @@ template <typename T>
using auto_ptr = std::unique_ptr<T>;
#endif

// Pretty much give-up on mem::SharedPtr as it's too hard to get something that will
// compile with all the different compilers; let somebody else worry about that
// via std::shared_ptr. The only code change is use_count() instead of getCount(),
// and that's mostly used in unit-tests.
#if !CODA_OSS_enable_mem_SharedPtr
template<typename T>
using SharedPtr = std::shared_ptr<T>;
#else
/*!
* \class SharedPtr
* \brief This is a derived class of std::shared_ptr. The purpose of this
Expand Down Expand Up @@ -71,8 +79,13 @@ class SharedPtr : public std::shared_ptr<T>
SharedPtr(SharedPtr&&) = default;
SharedPtr& operator=(SharedPtr&&) = default;

SharedPtr(std::shared_ptr<T> ptr) : std::shared_ptr<T>(ptr) {}
SharedPtr& operator=(const std::shared_ptr<T>& ptr)
template<typename OtherT>
SharedPtr(const std::shared_ptr<OtherT>& ptr)
{
*this = ptr;
}
template<typename OtherT>
SharedPtr& operator=(const std::shared_ptr<OtherT>& ptr)
{
std::shared_ptr<T>& base = *this;
base = ptr;
Expand Down Expand Up @@ -116,6 +129,7 @@ class SharedPtr : public std::shared_ptr<T>
return std::shared_ptr<T>::use_count();
}
};
#endif // CODA_OSS_enable_mem_SharedPtr

// C++11 inadvertently ommitted make_unique; provide it here. (Swiped from <memory>.)
namespace make
Expand Down Expand Up @@ -163,4 +177,11 @@ void unique(TArgs&&...) = delete;
} // namespace make
} // namespace mem

#endif
// try to make code changes a tiny bit easier?
template<typename T>
inline long getCount(const std::shared_ptr<T>& p) noexcept // be sure const& so that calling doesn't increment!
{
return p.use_count();
}

#endif // CODA_OSS_mem_SharedPtrCpp11_h_INCLUDED_
123 changes: 98 additions & 25 deletions externals/coda-oss/modules/c++/mem/unittests/test_shared_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ TEST_CASE(testAutoPtrConstructor)
const mem::SharedPtr<int> ptr(autoPtr.release());
TEST_ASSERT_EQ(ptr.get(), rawPtr);
TEST_ASSERT_EQ(autoPtr.get(), static_cast<int *>(NULL));
TEST_ASSERT_EQ(ptr.getCount(), 1);
//TEST_ASSERT_EQ(ptr.getCount(), 1);
TEST_ASSERT_EQ(ptr.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr), 1);
}

TEST_CASE(testAutoPtrReset)
Expand All @@ -113,7 +115,9 @@ TEST_CASE(testAutoPtrReset)
sharedPtr.reset(autoPtr.release());
TEST_ASSERT_EQ(sharedPtr.get(), rawPtr1);
TEST_ASSERT_NULL(autoPtr.get());
TEST_ASSERT_EQ(sharedPtr.getCount(), 1);
//TEST_ASSERT_EQ(sharedPtr.getCount(), 1);
TEST_ASSERT_EQ(sharedPtr.use_count(), 1);
TEST_ASSERT_EQ(getCount(sharedPtr), 1);
}

TEST_CASE(testCopying)
Expand All @@ -124,14 +128,21 @@ TEST_CASE(testCopying)
mem::SharedPtr<int> ptr1(rawPtr);
TEST_ASSERT_EQ(ptr1.get(), rawPtr);
TEST_ASSERT_EQ(*ptr1.get(), 89);
TEST_ASSERT_EQ(ptr1.getCount(), 1);
//TEST_ASSERT_EQ(ptr1.getCount(), 1);
TEST_ASSERT_EQ(ptr1.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr1), 1);

const mem::SharedPtr<int> ptr2(ptr1);
TEST_ASSERT_EQ(ptr1.get(), rawPtr);
TEST_ASSERT_EQ(ptr2.get(), rawPtr);
TEST_ASSERT_EQ(*ptr2.get(), 89);
TEST_ASSERT_EQ(ptr1.getCount(), 2);
TEST_ASSERT_EQ(ptr2.getCount(), 2);
//TEST_ASSERT_EQ(ptr1.getCount(), 2);
TEST_ASSERT_EQ(ptr1.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr1), 2);
//TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr2.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr2), 2);


// We already know they're pointing at the same underlying data, but
// show it this way too for kicks
Expand All @@ -142,18 +153,27 @@ TEST_CASE(testCopying)
// Decrement the reference count
ptr1.reset();
TEST_ASSERT_EQ(*ptr2.get(), 334);
TEST_ASSERT_EQ(ptr2.getCount(), 1);
//TEST_ASSERT_EQ(ptr2.getCount(), 1);
TEST_ASSERT_EQ(ptr2.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr2), 1);


// Do the same thing but show that ptr2 going out of scope is
// equivalent to it being reset
ptr3.reset(new mem::SharedPtr<int>(ptr2));
TEST_ASSERT_EQ(ptr3->get(), rawPtr);
TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr3->getCount(), 2);
//TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr2.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr2), 2);
//TEST_ASSERT_EQ(ptr3->getCount(), 2);
TEST_ASSERT_EQ(ptr3->use_count(), 2);
TEST_ASSERT_EQ(getCount(*ptr3), 2);
}

TEST_ASSERT_EQ(ptr3->get(), rawPtr);
TEST_ASSERT_EQ(ptr3->getCount(), 1);
//TEST_ASSERT_EQ(ptr3->getCount(), 1);
TEST_ASSERT_EQ(ptr3->use_count(), 1);
TEST_ASSERT_EQ(getCount(*ptr3), 1);
}

static std::shared_ptr<int> getIntSP()
Expand All @@ -169,15 +189,22 @@ TEST_CASE(testAssigning)
mem::SharedPtr<int> ptr1(rawPtr);
TEST_ASSERT_EQ(ptr1.get(), rawPtr);
TEST_ASSERT_EQ(*ptr1.get(), 89);
TEST_ASSERT_EQ(ptr1.getCount(), 1);
//TEST_ASSERT_EQ(ptr1.getCount(), 1);
TEST_ASSERT_EQ(ptr1.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr1), 1);

mem::SharedPtr<int> ptr2;
ptr2 = ptr1;
TEST_ASSERT_EQ(ptr1.get(), rawPtr);
TEST_ASSERT_EQ(ptr2.get(), rawPtr);
TEST_ASSERT_EQ(*ptr2.get(), 89);
TEST_ASSERT_EQ(ptr1.getCount(), 2);
TEST_ASSERT_EQ(ptr2.getCount(), 2);
//TEST_ASSERT_EQ(ptr1.getCount(), 2);
TEST_ASSERT_EQ(ptr1.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr1), 2);
//TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr2.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr2), 2);


// We already know they're pointing at the same underlying data, but
// show it this way too for kicks
Expand All @@ -188,22 +215,51 @@ TEST_CASE(testAssigning)
// Decrement the reference count
ptr1.reset();
TEST_ASSERT_EQ(*ptr2.get(), 334);
TEST_ASSERT_EQ(ptr2.getCount(), 1);
//TEST_ASSERT_EQ(ptr2.getCount(), 1);
TEST_ASSERT_EQ(ptr2.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr2), 1);


// Do the same thing but show that ptr2 going out of scope is
// equivalent to it being reset
ptr3 = ptr2;
TEST_ASSERT_EQ(ptr3.get(), rawPtr);
TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr3.getCount(), 2);
//TEST_ASSERT_EQ(ptr2.getCount(), 2);
TEST_ASSERT_EQ(ptr2.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr2), 2);
//TEST_ASSERT_EQ(ptr3.getCount(), 2);
TEST_ASSERT_EQ(ptr3.use_count(), 2);
TEST_ASSERT_EQ(getCount(ptr3), 2);
}

TEST_ASSERT_EQ(ptr3.get(), rawPtr);
TEST_ASSERT_EQ(ptr3.getCount(), 1);

//TEST_ASSERT_EQ(ptr3.getCount(), 1);
TEST_ASSERT_EQ(ptr3.use_count(), 1);
TEST_ASSERT_EQ(getCount(ptr3), 1);

mem::SharedPtr<int> result;
result = getIntSP();

// code like this is in CODA
{
std::shared_ptr<Bar> mTileStreams_;
auto mTileStreams = &mTileStreams_;
mem::SharedPtr<Foo> outStream_(mTileStreams[0]); // clearly copy
mem::SharedPtr<Foo> outStream = mTileStreams[0]; // copy
outStream = mTileStreams[0]; // assignment
}
{ // variations of the above;
mem::SharedPtr<Bar> mTileStreams_;
auto mTileStreams = &mTileStreams_;
mem::SharedPtr<Foo> outStream = mTileStreams[0]; // copy
outStream = mTileStreams[0]; // assignment
}
{ // variations of the above;
mem::SharedPtr<Bar> mTileStreams_;
auto mTileStreams = &mTileStreams_;
std::shared_ptr<Foo> outStream = mTileStreams[0]; // copy
outStream = mTileStreams[0]; // assignment
}
}

TEST_CASE(testSyntax)
Expand All @@ -223,7 +279,9 @@ TEST_CASE(testCasting)
Bar* const rawBar(new Bar(456));
const mem::SharedPtr<Foo> fooPtr(rawBar);
TEST_ASSERT_EQ(fooPtr.get(), rawBar);
TEST_ASSERT_EQ(fooPtr.getCount(), 1);
//TEST_ASSERT_EQ(fooPtr.getCount(), 1);
TEST_ASSERT_EQ(fooPtr.use_count(), 1);
TEST_ASSERT_EQ(getCount(fooPtr), 1);
}

{
Expand All @@ -233,35 +291,50 @@ TEST_CASE(testCasting)
const mem::SharedPtr<Foo> fooPtr(autoBar.release());
TEST_ASSERT_EQ(fooPtr.get(), rawBar);
TEST_ASSERT_EQ(autoBar.get(), static_cast<Bar *>(NULL));
TEST_ASSERT_EQ(fooPtr.getCount(), 1);
//TEST_ASSERT_EQ(fooPtr.getCount(), 1);
TEST_ASSERT_EQ(fooPtr.use_count(), 1);
TEST_ASSERT_EQ(getCount(fooPtr), 1);
}

{
// Test creating SharedPtr of base class from SharedPtr of derived
Bar* const rawBar(new Bar(456));
const mem::SharedPtr<Bar> barPtr(rawBar);
TEST_ASSERT_EQ(barPtr.getCount(), 1);
//TEST_ASSERT_EQ(barPtr.getCount(), 1);
TEST_ASSERT_EQ(barPtr.use_count(), 1);
TEST_ASSERT_EQ(getCount(barPtr), 1);
const mem::SharedPtr<Foo> fooPtr(barPtr);
TEST_ASSERT_EQ(fooPtr.get(), rawBar);
TEST_ASSERT_EQ(fooPtr.getCount(), 2);
//TEST_ASSERT_EQ(fooPtr.getCount(), 2);
TEST_ASSERT_EQ(fooPtr.use_count(), 2);
TEST_ASSERT_EQ(getCount(fooPtr), 2);
TEST_ASSERT_EQ(barPtr.get(), rawBar);
TEST_ASSERT_EQ(barPtr.getCount(), 2);
//TEST_ASSERT_EQ(barPtr.getCount(), 2);
TEST_ASSERT_EQ(barPtr.use_count(), 2);
TEST_ASSERT_EQ(getCount(barPtr), 2);


const mem::SharedPtr<Foo> fooPtr2 = barPtr;
TEST_ASSERT_EQ(fooPtr2.get(), rawBar);
TEST_ASSERT_EQ(fooPtr2.getCount(), 3);
//TEST_ASSERT_EQ(fooPtr2.getCount(), 3);
TEST_ASSERT_EQ(fooPtr2.use_count(), 3);
TEST_ASSERT_EQ(getCount(fooPtr2), 3);
}

{
// Test creating a class with a SharedPtr of base class as parameter
// from a class with a SharedPtr of derived as parameter
Bar* const rawBar(new Bar(456));
const mem::SharedPtr<Bar> barPtr(rawBar);
TEST_ASSERT_EQ(barPtr.getCount(), 1);
//TEST_ASSERT_EQ(barPtr.getCount(), 1);
TEST_ASSERT_EQ(barPtr.use_count(), 1);
TEST_ASSERT_EQ(getCount(barPtr), 1);
const BarPtrTest barTest(barPtr);
TEST_ASSERT_EQ(barTest.mFooPtr.get(), rawBar);
TEST_ASSERT_EQ(barTest.mBarPtr.get(), rawBar);
TEST_ASSERT_EQ(barPtr.getCount(), 3);
//TEST_ASSERT_EQ(barPtr.getCount(), 3);
TEST_ASSERT_EQ(barPtr.use_count(), 3);
TEST_ASSERT_EQ(getCount(barPtr), 3);
}
}

Expand Down
Loading

0 comments on commit 56f3371

Please sign in to comment.