From 86bd245c86a1df169f471374901d44b61b38b9f3 Mon Sep 17 00:00:00 2001 From: "J. Daniel Smith" Date: Wed, 8 Nov 2023 10:24:21 -0500 Subject: [PATCH] reduce use of .c_str() and .str() (#713) * Squashed commit of the following: commit 9dd9172809ad8af4f434ce7967f64d8d075bb832 Merge: f09bdb27b 12510803a Author: Dan Smith Date: Mon Oct 9 13:03:38 2023 -0400 Merge commit '12510803ab1aa6c49be1fc9df26dfb997d1ace0e' into develop/sync_externals commit 12510803ab1aa6c49be1fc9df26dfb997d1ace0e Author: Dan Smith Date: Mon Oct 9 13:03:38 2023 -0400 Squashed 'externals/nitro/' changes from edfa0f7ce..574bfe2b6 574bfe2b6 FmtX() -> str::Format() (#586) git-subtree-dir: externals/nitro git-subtree-split: 574bfe2b6c79955be16427ddf4f115b0333a05b9 commit f09bdb27b627d20e5c679866293bbab079b9b138 Merge: c73d46b75 41ea3de53 Author: Dan Smith Date: Mon Oct 9 13:03:34 2023 -0400 latest from NITRO commit 41ea3de531ba67ddb19b34da4189f50603d1f536 Author: Dan Smith Date: Mon Oct 9 12:21:58 2023 -0400 Squashed 'externals/nitro/' changes from e418beceb..edfa0f7ce edfa0f7ce latest from CODA-OSS (#585) b26e15318 latest from CODA-OSS (#583) 0db9bdb29 fix ASAN diagnostics (#582) git-subtree-dir: externals/nitro git-subtree-split: edfa0f7ce5951b09967bb92ec4aba4820d50561f commit c73d46b75af3a77dfdaeb1448d5bf30d3ea91bed Merge: 2e711e31c 594752daf Author: Dan Smith Date: Mon Oct 9 12:21:55 2023 -0400 Merge commit '594752daff55aec6a2f04430e6c6675837bec723' into develop/sync_externals commit 594752daff55aec6a2f04430e6c6675837bec723 Author: Dan Smith Date: Mon Oct 9 12:21:55 2023 -0400 Squashed 'externals/coda-oss/' changes from 95ff879ba..959532681 959532681 reduce use of FmtX macro (#743) fffac7fc4 Fix memory leaks in "cli" (#741) git-subtree-dir: externals/coda-oss git-subtree-split: 95953268198a05486cd86cc17ac085805362c6ec commit 2e711e31cfd0f58b6b1b2f11b9644a212dc2f9b6 Author: Dan Smith Date: Mon Oct 9 12:21:51 2023 -0400 latest from CODA-OSS and NITRO commit 4e46c6b88fe06c21484588e932e0cd27e658b142 Merge: 909d7861e d11230ede Author: Dan Smith Date: Mon Oct 9 12:21:20 2023 -0400 Merge branch 'main' into develop/sync_externals commit 909d7861e543f2f062422f7afd01f4c95a0bd435 Merge: 151eb4f7e fd127771b Author: Dan Smith Date: Mon Oct 2 12:43:41 2023 -0400 Merge branch 'main' into develop/sync_externals commit 11d8ec293ed98a2fa5581b2317f3389e34565547 Author: Dan Smith Date: Mon Oct 2 12:12:31 2023 -0400 Squashed 'externals/coda-oss/' changes from 369737085..95ff879ba 95ff879ba make it easier to turn on AVX2/AVX512F (#740) a950c848b enable AVX2 and AVX512F CMake builds (#739) git-subtree-dir: externals/coda-oss git-subtree-split: 95ff879babba421c57ece442c3324c98d68fdbc7 commit 151eb4f7edcd9fc6d31529f995c5a5457d54ec3c Merge: 68bb88a20 11d8ec293 Author: Dan Smith Date: Mon Oct 2 12:12:31 2023 -0400 Merge commit '11d8ec293ed98a2fa5581b2317f3389e34565547' into develop/sync_externals commit 68bb88a20404f8720133c9089be3e392b94148e4 Author: Dan Smith Date: Mon Oct 2 12:12:26 2023 -0400 latest from CODA-OSS and NITRO commit aa3c088d285101b5d90574d028e113d571e49914 Merge: 15e3d7437 18a764e5e Author: Dan Smith Date: Mon Oct 2 12:11:42 2023 -0400 Merge branch 'main' into develop/sync_externals commit 1ee90a9a723449a28da2ccb6ff615163c6283a13 Author: Dan Smith Date: Wed Sep 27 12:04:49 2023 -0400 Squashed 'externals/coda-oss/' changes from c92a55d7c..369737085 369737085 use std::ssize() to reduce casts (#738) 8ae7dabac std::size() and std::ssize() (#737) 8db480be5 enable ASAN for GitHub builds (#736) git-subtree-dir: externals/coda-oss git-subtree-split: 369737085573989ba74a68a4dc2da9d4be8be3a6 commit 15e3d7437348268e0b39dffae35b87d292b82f0d Merge: a018099ff 1ee90a9a7 Author: Dan Smith Date: Wed Sep 27 12:04:49 2023 -0400 Merge commit '1ee90a9a723449a28da2ccb6ff615163c6283a13' into develop/sync_externals commit a018099fff07d81c8b0f50a24ec970d03c1711fc Author: Dan Smith Date: Wed Sep 27 12:04:45 2023 -0400 latest from CODA-OSS commit 669feb79e9ad901ec24c16a24864030197079bb4 Merge: 3738c9123 d95832afc Author: Dan Smith Date: Wed Sep 27 12:02:14 2023 -0400 Merge branch 'main' into develop/sync_externals commit 3738c91239438e9847fcdaa16b301c02111e1d0a Merge: a537665a3 804168483 Author: Dan Smith Date: Tue Sep 12 14:47:51 2023 -0400 Merge commit '804168483daa854eafff59910e56704e1282ed40' into develop/sync_externals commit 804168483daa854eafff59910e56704e1282ed40 Author: Dan Smith Date: Tue Sep 12 14:47:47 2023 -0400 Squashed 'externals/nitro/' changes from 49f6338d2..e418beceb e418beceb Merge commit '6144b2cfb436a5696bab62c81651b47edf07aa8c' 6144b2cfb Squashed 'externals/coda-oss/' changes from 8dee6f7a68..c92a55d7c7 32d9c4fe4 latest from CODA-OSS git-subtree-dir: externals/nitro git-subtree-split: e418beceb503c1186119ea058211f1e5b493afc6 commit f12914abbb5d7014dd904fd6319a3edd5ba788cd Author: Dan Smith Date: Tue Sep 12 14:47:44 2023 -0400 Squashed 'externals/coda-oss/' changes from 333b91024..c92a55d7c c92a55d7c build in SIX git-subtree-dir: externals/coda-oss git-subtree-split: c92a55d7c788ec177b094284572b227a40a8fcd7 commit a537665a353bdff78f00a83b4e6801b93bf7ab6a Merge: 3c1377805 f12914abb Author: Dan Smith Date: Tue Sep 12 14:47:44 2023 -0400 Merge commit 'f12914abbb5d7014dd904fd6319a3edd5ba788cd' into develop/sync_externals commit 3c137780502c3539ee778485df3be4f1cea83912 Author: Dan Smith Date: Tue Sep 12 14:28:54 2023 -0400 build after CODA-OSS updates commit 8abc353e0d58bce5621f5a854f5167679f1239fb Merge: a9e87fdfa a5674e744 Author: Dan Smith Date: Tue Sep 12 14:18:14 2023 -0400 Merge commit 'a5674e74433a563a11e4bbdaae3803673dff99f1' into develop/sync_externals commit a5674e74433a563a11e4bbdaae3803673dff99f1 Author: Dan Smith Date: Tue Sep 12 14:18:10 2023 -0400 Squashed 'externals/nitro/' changes from 72cd86cbf..49f6338d2 49f6338d2 latest from CODA-OSS (#581) git-subtree-dir: externals/nitro git-subtree-split: 49f6338d2998fc6b4d033bf1456f1fb1bcb53567 commit 5ab880228dfd4d6fd1b2b11630fd414b394d292b Author: Dan Smith Date: Tue Sep 12 14:18:06 2023 -0400 Squashed 'externals/coda-oss/' changes from 00e2dd928..333b91024 333b91024 Squashed commit of the following: ac8c312db Only allow va_args formatting under controlled circumstances (#735) 589aacfd7 str::to_native() for when conversion to std::string really is needed 743feb41e try hard not to lose string encoding (#734) 1854a9b46 hide use of str::cast() inside `details` namespace (#733) fbe0c85f9 compile-time getSIMDInstructionSet() (#732) ee2c46358 more consistent naming for routines to convert between encodings (#731) git-subtree-dir: externals/coda-oss git-subtree-split: 333b9102479d3d2c7d41425dbcfa41a7eabf7b1d commit a9e87fdfaabf5951ba3efd78a2d5b468df7f71cc Merge: 3cbdfb940 5ab880228 Author: Dan Smith Date: Tue Sep 12 14:18:06 2023 -0400 Merge commit '5ab880228dfd4d6fd1b2b11630fd414b394d292b' into develop/sync_externals commit 3cbdfb940a9494ad52a0611db60d30eb78932703 Author: Dan Smith Date: Tue Sep 12 14:18:02 2023 -0400 latest from NITRO commit a681ebd1daf4d7268d181e0295b95558e7d4ff95 Author: Dan Smith Date: Tue Sep 12 14:08:14 2023 -0400 latest from CODA-OSS commit 7a363b43f351cd7780ae628a1d6ddbd84300129c Merge: 8cd5e77e4 80aec3ad3 Author: Dan Smith Date: Tue Sep 12 14:07:29 2023 -0400 Merge branch 'main' into develop/sync_externals commit 8cd5e77e408f83589d60c31968f812ba7b8c9ec6 Merge: 4ee925cae 369de34a1 Author: Dan Smith Date: Tue Aug 29 13:25:44 2023 -0400 Merge commit '369de34a1c027a68c3f7d35be60c091e828d6417' into develop/sync_externals commit 369de34a1c027a68c3f7d35be60c091e828d6417 Author: Dan Smith Date: Tue Aug 29 13:25:41 2023 -0400 Squashed 'externals/nitro/' changes from e488297c3..72cd86cbf 72cd86cbf latest from CODA-OSS (#580) e4920a743 FmtX() -> str::Format() git-subtree-dir: externals/nitro git-subtree-split: 72cd86cbf6abb1122350388c98ea448484d76d91 commit bb4f3dc0f7aeb187acf39d6cae5e96b711bb4dc8 Author: Dan Smith Date: Tue Aug 29 13:25:37 2023 -0400 Squashed 'externals/coda-oss/' changes from 8dee6f7a6..00e2dd928 00e2dd928 another FmtX() overload 165a799c5 more FmtX() overloads (#729) git-subtree-dir: externals/coda-oss git-subtree-split: 00e2dd9286b44e32f8393165f20485b543d52170 commit 4ee925caecf49d4aa1d5881fdb4ef2ea95fa13c3 Merge: baeaa33d1 bb4f3dc0f Author: Dan Smith Date: Tue Aug 29 13:25:37 2023 -0400 Merge commit 'bb4f3dc0f7aeb187acf39d6cae5e96b711bb4dc8' into develop/sync_externals commit baeaa33d1156f31f5c333941d4533e893d885573 Author: Dan Smith Date: Tue Aug 29 13:25:33 2023 -0400 latest from CODA-OSS and NITRO commit a4a755c8c6644480c1765080e67cd30d554a9a3e Merge: 6fbe8b8dd 8a9b1e9e5 Author: Dan Smith Date: Tue Aug 29 13:24:48 2023 -0400 Merge branch 'main' into develop/sync_externals commit a5d077e25b3d48901ed9615ccec88e4aaebbfce3 Author: Dan Smith Date: Tue Aug 29 09:20:49 2023 -0400 Squashed 'externals/nitro/' changes from 72209535d..e488297c3 e488297c3 Merge commit '81ea6f1789863f26f06dc447f7784383dc7cb595' 81ea6f178 Squashed 'externals/coda-oss/' changes from e87c32b4de..8dee6f7a68 git-subtree-dir: externals/nitro git-subtree-split: e488297c31fbf52dd2c1ae6ba94f95a6cdf9eb30 commit 6fbe8b8dd9ca1378a87de28f8161826d1ce0bf18 Merge: 3441e8047 a5d077e25 Author: Dan Smith Date: Tue Aug 29 09:20:49 2023 -0400 Merge commit 'a5d077e25b3d48901ed9615ccec88e4aaebbfce3' into develop/sync_externals commit 3441e8047b47ac79118e841600cc2aac7c00b1db Merge: 69b0fb4e3 8538e1d22 Author: Dan Smith Date: Tue Aug 29 09:15:44 2023 -0400 Merge commit '8538e1d222d56604050582bd2b0f128dda51f925' into develop/sync_externals commit 8538e1d222d56604050582bd2b0f128dda51f925 Author: Dan Smith Date: Tue Aug 29 09:15:34 2023 -0400 Squashed 'externals/nitro/' changes from fc1f59799..72209535d 72209535d toString() changes from CODA-OSS (#579) git-subtree-dir: externals/nitro git-subtree-split: 72209535d071d6a6f18c475413f948d086cd8787 commit d982f60807e49f64d019eb973639ba555e9d7942 Author: Dan Smith Date: Tue Aug 29 09:15:26 2023 -0400 Squashed 'externals/coda-oss/' changes from bf7ae4a71..8dee6f7a6 8dee6f7a6 revert toString() changes (#728) git-subtree-dir: externals/coda-oss git-subtree-split: 8dee6f7a68d560f8bb3469f2d0375bb65e2f532f commit 69b0fb4e37fc959ef878394712dbfe391a69f6bb Merge: c4dcdbac4 d982f6080 Author: Dan Smith Date: Tue Aug 29 09:15:26 2023 -0400 Merge commit 'd982f60807e49f64d019eb973639ba555e9d7942' into develop/sync_externals commit c4dcdbac49f64f0c7135ef1d5f59cbe771474d2f Author: Dan Smith Date: Tue Aug 29 08:43:57 2023 -0400 toString() changes from CODA-OSS commit 7de4dcfa0704b847fa46dca9457a0bd7eab756e9 Merge: 48895c9ec 69731d3c8 Author: Dan Smith Date: Tue Aug 29 08:37:24 2023 -0400 Merge branch 'main' into develop/sync_externals commit 48895c9ec4e9918e131c7f12e087440d675a6e0b Merge: cb1a2c945 a2de0b527 Author: Dan Smith Date: Mon Aug 28 16:20:55 2023 -0400 Merge commit 'a2de0b5279a6763f39f6f34536eb6f680e98d146' into develop/sync_externals commit a2de0b5279a6763f39f6f34536eb6f680e98d146 Author: Dan Smith Date: Mon Aug 28 16:20:50 2023 -0400 Squashed 'externals/nitro/' changes from e7ea728ec..fc1f59799 fc1f59799 latest from CODA-OSS (#578) 02e8f80c6 latest from CODA-OSS (#577) git-subtree-dir: externals/nitro git-subtree-split: fc1f59799a3082a3c1605dd9a6c3dd12ce2412d3 commit 6c23d5de45eadac47028f968db108e4161666aa1 Author: Dan Smith Date: Mon Aug 28 16:20:46 2023 -0400 Squashed 'externals/coda-oss/' changes from 22e050207..bf7ae4a71 bf7ae4a71 use overloads rather than varargs for std::format() (#727) git-subtree-dir: externals/coda-oss git-subtree-split: bf7ae4a718bd97a55ed37d2dd0a514deebc97776 commit cb1a2c945855d9b07e9692d5410883af654f8861 Merge: bbc8367d0 6c23d5de4 Author: Dan Smith Date: Mon Aug 28 16:20:46 2023 -0400 Merge commit '6c23d5de45eadac47028f968db108e4161666aa1' into develop/sync_externals commit bbc8367d058b11a37666ad581582dae2169c438d Author: Dan Smith Date: Mon Aug 28 15:35:19 2023 -0400 latest from CODA-OSS commit 02e1917799c7201c477e57a1852d68cb49696f97 Author: Dan Smith Date: Mon Aug 28 14:09:36 2023 -0400 str::format changes from CODA-OSS commit e4b5c45c5e38de90b6b4b234225cbb92a152195a Merge: 0584296f1 80128f8d6 Author: Dan Smith Date: Mon Aug 28 14:08:34 2023 -0400 Merge branch 'main' into develop/sync_externals commit 2928617bd4525f20316de415f07b6cf3d88e4878 Author: Dan Smith Date: Fri Aug 25 13:31:39 2023 -0400 Squashed 'externals/nitro/' changes from 547d0aa9f..e7ea728ec e7ea728ec reduce differences between cpp17 and main branches (#576) git-subtree-dir: externals/nitro git-subtree-split: e7ea728ec6c80eb3a7564f9c721563c49d744c51 commit 0584296f1e8e9126bd99f1eeba8b3e2cf6280998 Merge: 8a996f260 2928617bd Author: Dan Smith Date: Fri Aug 25 13:31:39 2023 -0400 Merge commit '2928617bd4525f20316de415f07b6cf3d88e4878' into develop/sync_externals commit 9c6572a9e7ccc4d54e79a6f7ebc373b4414e7df9 Author: Dan Smith Date: Fri Aug 25 13:31:36 2023 -0400 Squashed 'externals/coda-oss/' changes from 168cbae01..22e050207 22e050207 utility routines to reduce duplicated code (#726) a5ea60647 remove str::EncodedStringView (#725) git-subtree-dir: externals/coda-oss git-subtree-split: 22e05020768d791498db105c261439dc78981445 commit 8a996f260f3c3878e5df2efdf56670571cde1032 Merge: e509306b1 9c6572a9e Author: Dan Smith Date: Fri Aug 25 13:31:36 2023 -0400 Merge commit '9c6572a9e7ccc4d54e79a6f7ebc373b4414e7df9' into develop/sync_externals commit e509306b1df529a760e0f0603582eb0d1549d41f Author: Dan Smith Date: Fri Aug 25 13:31:21 2023 -0400 latest from CODA-OSS and NITRO commit 62fc405c4b95f2fcdace714e127c9dc27b16d7f7 Merge: 40827a753 49e28e2ae Author: Dan Smith Date: Fri Aug 25 13:30:22 2023 -0400 Merge branch 'main' into develop/sync_externals commit 40827a753f1d663b39ad3380f0de498bd45e582f Author: Dan Smith Date: Mon Aug 21 09:23:42 2023 -0400 CRLF commit 209b4e374c74229516ca3071258f971c78b70410 Merge: 238a6fc8a 993d755ef Author: Dan Smith Date: Mon Aug 21 09:22:36 2023 -0400 Merge branch 'main' into develop/sync_externals commit 238a6fc8a2e5a5ae4826d1f8edce80e2fa046b0b Merge: 1c1e44094 83ec173c2 Author: Dan Smith Date: Mon Aug 21 09:15:00 2023 -0400 Merge commit '83ec173c23943efe4e24689aad8d744aad69749c' into develop/sync_externals commit 83ec173c23943efe4e24689aad8d744aad69749c Author: Dan Smith Date: Mon Aug 21 09:14:53 2023 -0400 Squashed 'externals/nitro/' changes from c8ecbe9ae..547d0aa9f 547d0aa9f NITRO-2.11.4 (#575) fe309c4ba Merge branch 'main' of github.com:mdaus/nitro 10efa9990 latest from CODA-OSS (#574) d08f1c0a1 CRLF db5d3d484 latest from CODA-OSS 98c755048 CRLF aa1482543 CRLF bfdbe69a4 Latest from CODA-OSS (#573) 9e4ce0b58 latest from CODA-OSS (#572) 227a8a8f4 trust coda-oss for right -std flags 13869687e latest from CODA-OSS (#571) 5724d8c18 latest from CODA-OSS (#570) fb794f0fe latest from CODA-OSS (#569) 7a6132ba0 update files changes in cpp17 branch (#568) de91d4977 Fix bug creating NITFException (#567) 225273436 fix YAML for 'main' 5d1c83d11 single project for unittests (#566) 102a019db latest from CODA-OSS (known broken build) (#565) b4ae2d429 match YAML from coda-oss 176bcaf6d build NITRO.SLN using msbuild (#562) 85e9043b8 latest from CODA-OSS (#561) 49ec50325 use new "PlatformToolkit" special environment variable (#560) 6c06e3711 latest from CODA-OSS (#559) cee9feb42 latest from CODA-OSS (#558) 3f01809fa latest from coda-oss (#557) 471fb3fc1 Update test_j2k_loading++.cpp b12caf2fc latest from CODA-OSS (#556) 0cd432624 use sys::make_span (#555) 05dae18a3 patch to build other projects 8f974e995 NITRO-2.11.3 (#554) 870aa6afd update to coda-oss 2023-06-05 (#553) 2fd7a0bfa latest from coda-oss (#552) 0eecce004 invoke() utility to reduce code duplication (#550) 59fb02fe9 latest from coda-oss (#551) 9fbf2b7b8 Fill out adapter free block which is used for nitf decompression (#549) 089ba0b5b latest from coda-oss 3b52f0025 latest from coda-oss (#547) 90c6263e2 latest from coda-oss (#544) 90d513ac5 latest from coda-oss (#543) git-subtree-dir: externals/nitro git-subtree-split: 547d0aa9ffcf34ad94f9ea71aa415f39837b2e68 commit c57aa2691a9635f55f5c604723d61ee495c59ed2 Author: Dan Smith Date: Mon Aug 21 09:14:48 2023 -0400 Squashed 'externals/coda-oss/' changes from e87c32b4d..168cbae01 168cbae01 reduce differences between 'main' and 'cpp17' (#724) 5b892bf5f release 2023-08-18 (#723) 0b1327d1e restore mem::AutoPtr; too much of a hassle moving it to numpyutils :-( (#722) 7691adb56 normalize line endings (#721) b7d50efdd update to HDF5 1.14.2 (#720) fcc96ec69 Update .gitattributes (#719) bb82a94c9 xerces-c 3.2.4 (#718) ef4ad7cf3 Update to e2fsprogs 1.47.0 (#717) b4ca18a11 fix compiler warning about order of operations a5df5b823 update to HighFive 2.7.1 (#716) 4109ee5d2 `mem::AutoPtr` is only for Python bindings (#715) 00d843f87 remove hdf5.lite (#714) 443dd3825 Reduce compiler warnings, speed up builds (#713) d60861821 get optional working with partial C++17 (#712) d5bd0d804 "warning STL4036: is removed in C++20." c19ece7f9 Don't interfere with a partial C++20 implementation (#711) 065e86ddc operator==() for QName (#710) 1c16380ce remove zint* typedefs; don't want to encourage use of types::Complex (#709) 6dd247991 our optional<> is now closer to C++17 (#708) 87ac61739 strict checking on `std::complex` is too much of a hassle for now 034d52c86 overloads to byte-swap type::Complex are too much trouble (#707) 42d449c33 sys::byteSwap overloads for types::Complex (#705) 4092fd8e7 remove work-around for NITRO bug (#704) e2472acfc build in NITRO and SIX (#703) 32ccf9105 Use same build paths as Visual Studio (#701) 366ac9f43 Another round of removing compiler warnings (#702) a7f8ef260 Fix compile warnings from building CODA (#700) f70b4202f account for coda-oss.vcxproj being in other SLNs af3faebfc Remove more compiler/code-analysis warnings (#699) 82be2a6db unittests should work w/o install (#698) dbb90a06d add msbuild for coda-oss.sln (#697) 5a417140a reduce compiler warnings (#696) 288619dfa all modules now part of coda-oss.vcxproj (#695) c2fc5fc66 add more projects to coda-oss-lite.vcxproj (#694) ceb86c186 support $(PlatformToolset) as a "special" environment variable (#693) d78a8595a OS::getSIMDInstructionSet() utility (#692) 2d2df467d fix `python3 waf dumplib` 54033e70e Merge branch 'main' into feature/complex_short 3c63f9f65 std::numbers from C++20 (#691) 892dd0e00 ComplexInteger and ComplexReal to better match existing naming conventions (#690) b3872181e match coda-oss naming conventions (#688) 704d6867f beef-up our complex type (#687) 47c1c1cd6 check is_absolute() for URLs (#686) c042373e1 be sure our Path::isAbolute() matches std::filesystem::path::absolute() (#684) ad10286bc volatile is about "special" memory, not threading (#685) f4d42005f fix build error in NITRO ff11a5557 keep using std::complex for now (#682) c88b9c053 types::complex (#681) d1244a080 don't need our own make_unique in C++14 (#680) aeec0131c assert()s for mem::CopyablePtr (#679) 72b0ebd60 add types::complex_short (#678) 932130a58 patch to build other projects c00c1f203 coda-oss release 2023-06-06 (#677) ef54bbcd5 remove more compiler warnings (#676) dadfc5ce6 distinguish between byte-swapping a buffer and single value (#674) 90187f6cd more xml.lite tweaks for SIDD-3.0/ISM (#675) eb9960772 stronger type-checking for byteSwap() (#673) ff4f820ed xml.lite tweaks to support SIDD 3.0 ISM (#672) b1de8c0e5 std::byte should be a unique type (#671) c05bf9a02 allow enums to be byte-swapped too 1f9fd88d6 remove spurious 47684c45b byteSwap now uses byte buffers (#670) cbc659db2 add swapBytes() utility from SIX (#669) 891481b64 simplify byte-swapping (#668) 540ae763e more byteSwap() tweaks 0774c03c4 threaded byteSwap() (#667) d156370d3 swapping a single-byte value makes no sense c120e3255 be sure parameter is used to avoid compiler warning e85ec9331 --output-on-failure for CTest (#666) e80376197 turn off "there is no warning number" warning c5f0a5d15 A C-string may not be NULL-terminated (#665) 0c5eb29ae use platform-specific routines for byteSwap() (#664) 0b7d581fa remove transform_async() (#663) f6489b6be Merge branch 'main' into feature/xml.lite_tweaks 836c426a2 use function-pointers so that isConsoleOutput is only checked once 56e3c45b1 move depthPrint() functionality into non-member function in preparation for future changes ddcd26d97 Merge branch 'main' into feature/xml.lite_tweaks 69cc0e506 use the more rigorous create_and_check_datatype() 9efb87558 Merge branch 'main' into feature/hdf5 4d2f2f417 more HighFive unittests (#662) 14191a844 HighFive::create_datatype() goes from C++ to HighFive 98583473f utility routines to read string attributes 1fa75ce81 use the C API to read a string attribute 71e7b69f5 still can't figure out how to read a string attribute :-( e96f37a69 test reading the file attributes a25244519 getAttribute() unittest 8f12a3000 getDataType() unittest 857ff0af3 HighFive utility routines (#661) 1d687db57 writeDataSet() utility overload 106aa6894 sigh ... H5Easy::dump() fill fails on Windows/WAF :-( 2641b60b2 Merge branch 'main' into feature/hdf5 35c19e7e8 change actions to @v3 (#660) 212bbd3a3 works on local machine, but not build server ... ? 7125118b0 dump of 1D vector doesn't work :-( c704db435 sigh ... WAF build still failing :-( 01aae4616 does dump() of a 1D vector work? 76a53c813 comment-out H5 writing :-( 0f0e19aff test_highfive_dump() cb8f73795 trying to get highfive_dump() unittest working w/Windows-WAF 6584a264a does test_highfive_create() work? cde6147ce tweak HighFive wrappers (#659) 316566854 Revert "trying HighFive "write" unittests again" a9ec24ca4 trying HighFive "write" unittests again 585ad49a5 tweak names of utility routines 4c91a4d97 make it easier to read a std::vector and std::vecotr 0217ffa26 readDataSet() now works for 1D data 95e8973f2 trying to get hdf5::lite::load() working 4d294611d "const" correctness 5e6305c3f fix load_complex() 4a134dc5f start work on utility routines to read complex data from HDF5 9d76a7f41 Merge branch 'main' into feature/hdf5 8f9667a24 whitepsace ebd3fc99e Merge branch 'main' into feature/hdf5 40091b069 comment-out writing tests for now ... need to figure our WAF bulid failure 935aa3459 be sure the dataset has real data 114b9bf33 update release notes bd9c0b26c tweak HighFive utility routines acda1ef57 turn off diagnostics around expected failures 22a748840 readDataSet() utility routine for HighFive bd88a8c25 HighFive writeDataSet() utility to work with our SpanRC 6142f5b33 use HighFive routines to write a HDF5 file 5bbf1abaf Use HiveFive routines to get info about the file 84fbc8378 duplicate unittests with H5Easy f1f054c03 Merge branch 'main' into feature/hdf5 9b63ca470 fix directory names f6f826689 fix directory names 7aeb82c33 Merge branch 'main' into feature/hdf5 d028baaeb hook up HighFive header-only library (#653) 3083b0a31 Revert "HighFive 2.6.2" 246985a7f Revert ""build" HighFive HDF5 library" a8b75a586 Revert "turn off HighFive Boost support" ec68d5f83 Revert "Add HighFive unittests" f1f85b9e7 Revert "get test_high_five_base more-or-less compiling" 5ea634ee1 Revert "more work on getting HighFive unittests to build" ecc45433c more work on getting HighFive unittests to build bb194788a get test_high_five_base more-or-less compiling d42bde000 Add HighFive unittests ddc86bb32 turn off HighFive Boost support b255122d4 "build" HighFive HDF5 library 396cc3ef2 HighFive 2.6.2 5e5f9d9c0 Merge branch 'main' into feature/hdf5 ee938b4a5 changes from SIX bb764df90 Merge branch 'main' into feature/xml.lite_tweaks de2a24380 make derived classes 'final' if possible 14e19bcd2 Change xml lite function to virtual (#645) 8f42ac8e9 Merge branch 'main' into feature/xml.lite_tweaks 18ad90645 hdf5Write unittest 3462e1179 createFile() and writeFile() overloads ecee81d53 fix typos 197eecfa6 sketch-out hdf5::lite::writeFile() bd2311795 use SpanRC for writeFile(), not yet implemented ea9af7510 simple SpanRC to hold a 2D-size and pointer 027c19ee8 createFile() unittest 1f9d07ecb hook up createFile() 8c7e4473f start hooking up HDF5 writing 146e0bea3 Merge branch 'main' into feature/hdf5 88ca9fcb7 Merge branch 'main' into feature/hdf5 42b604b46 Squashed commit of the following: 10ee602c2 Merge branch 'main' into feature/hdf5 67aa42b69 restore changes from "main" 8bbfcbfbf unittests can be simplified to match fewer "view" classes 126bb802e Merge branch 'main' into feature/hdf5 3f8ba7a42 again, don't need a class just to convert from std::vector<> to std::span<> 24c2b489c Squashed commit of the following: 2703c119d Squashed commit of the following: 9d5228a2b don't need an entire class just to convert a std::vector<> into std::span<> 51bc931dc Merge branch 'main' into feature/hdf5 a84f25816 Squashed commit of the following: c4d2ed696 add missing #include guards, fix type in existing #include guard d541525a0 use a single ComplexViewConstIterator for all views 86e6a459f CODA_OSS_disable_warning causes GCC errors :-( 5d4b9c2cb only need an custom iterator for ComplexSpansView d9f0fb128 hook up iterators b9329e4db initial pass at a ComplexViewConstIterator 635238873 remove compiler warning about unused "constexpr" variables b39f6096f use the casing from H5 to make copy/pasting code slightly easier 0887b13eb Merge branch 'main' into feature/hdf5 bd07df1ca Consistent casing for Dataset, Datatype, Dataspace 7acd30ee2 tweak hdf5.lite dependencies 38ab914df Jupyter notebook for creating H5 files 95a040e0b _small.h5 is now (correctly) FLOAT32 107e7c487 make a simple values() member function to avoid template magic e1feca919 use TEST_SPECIFIC_EXCEPTION macro instead of try/catch 738333688 readDatasetT() now throws for the wrong buffer type 6b2cc2529 Merge branch 'feature/hdf5' of github.com:mdaus/coda-oss into feature/hdf5 310f8fd3d can't get template magic right for copy_axis() 86b306d59 stepping through copy ctors in the debugger is annoying f243e92d6 trying to make wrong type of buffer fail 2b10d9652 read in new sample file a28e59d8c help the compiler with type deduction 49bf5e9bc nested_complex_float_data_small.h5 e029325fc utility routines to "deconstruct" and array of std::complex dede3bd39 Merge branch 'main' into feature/hdf5 904b1ef5e tweak class names, make_() and copy() utility routines 8237b9efb make it harder to pass the wrong types to ComplexViews 4d9aeda2c ComplexArrayView and ComplexParallelView utility classes f5e367dfa test std::span> a4a2844f2 read in the nested "i" and "r" data 115615265 sample file has subgroups 8e1b7869a Merge branch 'feature/hdf5' of github.com:mdaus/coda-oss into feature/hdf5 9f4232a1d update sample H5 file 8c55db73a walk through HDF5 sub-groups 7775ed9c4 Update 123_barfoo_catdog_cx.h5 677975d7c Matlab code to create sample H5 file a0e7dfe07 Update test_hdf5info.cpp 0b67e1602 pass __FILE__ and __LINE__ from calling site for a more accurate exception message 86a677321 skeleton for more sample data 85f79b099 Merge branch 'main' into feature/hdf5 18088e942 Merge branch 'main' into feature/hdf5 3a1d17692 Merge branch 'main' into feature/hdf5 1755c69d7 Merge branch 'main' into feature/hdf5 9ad015432 No more "11" suffix on exception names c20d96251 Squashed commit of the following: c88cee999 other values to be filled-in bca4a4ecd incorporation NamedObject from HDF5 docs 61fa68f72 groupInfo() 460e7d766 datasetInfo() 14eb9b764 start filling in DatasetInfo afe5f1c3a start to fill in DatasetInfo 77a968c72 start filling in GroupInfo d81bcdfd9 openGroup() to open groups (loc) a0cd29469 comment-out "dataset" unittest for now 86e006024 begin filling in FileInfo 366dda6ab a return_type_of utility is needed to deduce the return type e21928263 explicitly pass return type to template 4937ccd11 template to reduce boilerplate when calling try_catch_H5Exceptions b3b5ebde7 use new exception utility routines ea1c03ef0 put exception handling/conversion in a utility routine 819a99d39 utility routine for exception handling 6f34eea97 put utilities in a separate file for easier reuse fcbde4f24 break utility routines into smaller pieces for easier reuse 52358ea8a WIN32 no longer automatically defined? 5a4286472 Revert "build HDF5 with C89" 680e599e9 build HDF5 with C89 a87a07121 Merge branch 'main' into feature/hdf5 8447c1a90 Revert "sym-links instead of copying files" db3b5e12b Merge branch 'main' into feature/xml.lite_tweaks fb60b5696 Merge branch 'main' into feature/hdf5 5110a5cc8 Comments about _u and _q 1a937d32c Merge branch 'main' into feature/xml.lite_tweaks fa06f04d7 get ready for hdf5.lite enhancdements b040c7c43 sym-links instead of copying files aa431bb47 use _u for xml::lite::Uri 3d0c6d58c fix case-sensitive #include filename 93dcd0e52 operator() for getElementByName() 75a93af85 more operator[] overloads to make attribute management easier 4ab8216f8 user-defined string literals to remove some noise around xml::lite::QName f82f0b0fc Merge branch 'main' into feature/xml.lite_tweaks ae30e3644 Merge branch 'feature/xml.lite_tweaks' of github.com:mdaus/coda-oss into feature/xml.lite_tweaks ffdd9beb0 simplify attribute creation 9bf5414f5 simplify attribute creation 82d7a4e95 SWIG gets confused about namespaces 7a61d0741 fix bug on Element ctor uncovered by unittest fdd7e58c1 QName is also in the xerces namespace which confuses SWIG bindings a325b7053 operator+=() overload for addChild daf30e6c0 Merge branch 'feature/xml.lite_tweaks' of github.com:mdaus/coda-oss into feature/xml.lite_tweaks b887d2b47 provide overloads for Element& rather than creating new "reference" types 1fa6bba38 rename test_xmleasy.cpp 7c8c9e0f1 += overload 850da6f63 overload for std::string 4547fc5a7 use UIT-8 strings for characterData 4723462a3 convenient addChild() overloads e48720753 copy over ElementReference from xml.easy a4ca30a0d Merge branch 'main' into feature/xml.lite_tweaks 6ae9f0b71 Revert "check-in of new xml.easy (to move code between computers)" f7466a6d7 Revert "simple routines for single element" a5490230d Revert "make some operators simplier ways of calling functions" c9a25630a Revert "get document creation working" 8af8710b0 Revert "free functions instead of member functions" 16c3847cb Revert "ElementReference distinct from Element" 7d68e156f Revert "ElementMutableReference" 00eb2a282 Merge branch 'main' into feature/xml.lite_tweaks a42969c1f ElementMutableReference a20ae9355 ElementReference distinct from Element 14eeeea0b free functions instead of member functions 4aae014b3 get document creation working 883569269 make some operators simplier ways of calling functions 053bd1212 simple routines for single element 8bf701a2e check-in of new xml.easy (to move code between computers) 41f959051 unittests for creating XML documents from scratch 9752d50ae Merge branch 'main' into feature/xml.lite_tweaks 1531d5709 by default, don't validate strings passed to Uri() 46d13d4bf Merge branch 'master' into feature/xml.lite_tweaks 39b547d32 remove more vestiges of Expat and LibXML ec8274d52 remove LibXML and Expat as they're no longer used/supported. 20eeefeef Merge branch 'master' into feature/xml.lite_tweaks 95074b9b1 update for newer Intel compiler 7024f71e1 Merge branch 'master' into feature/xml.lite_tweaks 57b1cbc83 Merge branch 'master' into feature/xml.lite_tweaks 4b67561c3 remove validate() overload that nobody is using fa15f1e5d Squashed commit of the following: 1484a9090 test the new validate() API 470da70fb hookup StringStreamT routines 2cddf2504 begin hooking up validate() overloads 1b5d910f3 overload validate() for UTF-8 and Windows-1252 03309b8c9 Squashed commit of the following: b72c6c5bf older compiler doesn't like our make_unique af8f00307 validate UTF-8 XML on Linux 211188613 unit-test for LEGACY XML validation 3c1169d2b Squashed commit of the following: 3afff19ca std::filesystem::path for FileInputStreamOS 908d452f8 WIP: validate all of our sample XML files 00f9bb16b validate against a XML schema 243d8c356 Merge branch 'master' into feature/xml.lite_tweaks 2815d707d fix to work with SWIG bindings. :-( 460862132 trying (again) to remove vestiages of old code e3c83a858 Revert "new code should use UTF-8" 811207c92 new code should use UTF-8 0ffd835f9 Squashed commit of the following: 1e7e03ded Merge branch 'master' into feature/xml.lite_tweaks c1d806aff Merge branch 'master' into feature/xml.lite_tweaks 850d3c811 str::strip() that can be easier to use than str::trim() 580ba9c8c explicitly =delete move 2b39831a8 Squashed commit of the following: 39eebdc23 Merge branch 'master' into feature/xml.lite_tweaks 9adf86cba force calling new UTF-8 write() routines ea61b6204 Merge branch 'master' into feature/xml.lite_tweaks 8a34583fa overload to take schemaPaths as filesystem::path 8671b442f parse XML embedded in a binary file ec4a902f1 updates from xerces.lite 80dc4d963 updates from xerces.lite 549766d6c Attributes::contains() no longer catches an exception 8a645ceac need "sys/" when building in other environments 36af08269 super-simple URI validation 78ef28a3e SWIG bindings are a PITA! :-( e9cba8491 SWIG needs help with Uri 8a8d8dc07 another routines used by pre-build SWIG bindings 818e1ec5d pre-build SWIG bindings use getElementByTagName() member function 067cac5d8 old compiler gets confused on unadorned QName ba92c0ae7 more use of Uri and QName 446c7d17a use QName in new code d6f8b0c83 more direct use of QName 90fff1c73 use xml::lite::QName instead of tuple 646cbb5ed more direct use of QName and Uri ba589ea3b make QName more robust bab0ee8b5 createElement() -> addNewElement() e3a145747 grab changes from six-library 32285e95c Merge branch 'master' into feature/xml.lite_tweaks 9f79f0bf6 Merge branch 'master' into feature/xml.lite_tweaks a12bbc32c make it easier to create new Elements with a value fc9967f98 make it easy for callers to addChild() keep a reference to the Element 4627766b7 be sure test_xmlparser works in "externals" of other projects bf2276396 "private" is part of the name-mangling fad92bcc8 making sure copy-ctor is implemented f90fdcead consolidate common XML test code 9fc53f2d5 use str:: utility for casting 6da6f794b still trying to find the right macro for SWIG 0c1b86c56 still trying to fix SWIG fdc6fc9bd trying to fix SWIG build error 7835e8c27 SWIG needs copy-ctor 585695942 disable copy/assignment for Element, it's probably almost always wrong 391fed613 fix double-delete caused by copying 61790fe69 retry parsing XML with Windows-1252 if first parse() fails 63cffac59 change string_encoding to match coda-oss style of PascalCase 010479bbe read an XML file we know is wrongly encoded as Windows-1252 9a0505062 more references instead of pointers 2d44b6951 Reading Windows-1252 w/o "encoding" fails 63dc7b076 read Windows-1252 too c9434c9cb test as UIT-8 too f310ccf0c get reading from UTF-8 XML working on Windows 1fa39c2be get testReadUtf8XmlFile working on Linux 1a83cd815 sys::Path is too much trouble right now ed60aa22c unit-test to read XML from a file a9336db7c Squashed commit of the following: 0825beb0d Merge branch 'master' into feature/xml.lite_tweaks c618489be Merge branch 'master' into feature/xml.lite_tweaks e8e4b8fe1 determine string_encoding based on platform 1f43bcfc2 create a new Element by using the platform to determine "characterData" encoding 961bef66b Merge branch 'master' into feature/xml.lite_tweaks e9798a5cb fix static_assert() 6f7772874 Merge branch 'master' into feature/xml.lite_tweaks b98d4f5a9 Merge branch 'master' into feature/xml.lite_tweaks 1b5abba2a The (old) version of SWIG we're using doesn't like certain C++11 features. 53bdeabaf Merge branch 'master' into feature/xml.lite_tweaks 60cf8ae80 "" doesn't work with decltype() in older C++ 97e72477a reduce getValue() overloads by making "key" a template argument 5e6373e55 reduce code duplication f9e7cfeee provide castValue instead of getValue(T&) cbd0bd8f2 castValue throws instead of returning a bool like getValue(T&) 87c7514fc Merge branch 'master' into feature/xml.lite_tweaks 10cc61223 make getElement*() consistent for zero or >1 results f5b137e3c Merge branch 'master' into feature/xml.lite_tweaks 1765efc62 allow clients to specify toType() and toString() for getValue() and setValue() df8b746e1 allow clients to specify their own toType/toString routines 66702726a Merge branch 'master' into feature/xml.lite_tweaks 6956311f1 Merge branch 'master' into feature/xml.lite_tweaks d505f3593 Merge branch 'master' into feature/xml.lite_tweaks fbd106115 catch a BadCastException and return false from getValue() 3a78377b5 use a template to reduce duplicated code 0ad4b8606 Merge branch 'master' into feature/xml.lite_tweaks a848aa3a2 get & set the characer data as a type f3ee1ee12 utility routines to set an attribute value 595227683 templates to get an attribute value convert to a specific type 06639227b miised a change in last commit 1aa458ef8 add getValue() overloads that return true/false rather than throwing faa6d3075 added getElementByTagName() overloads as that's a very common use-case git-subtree-dir: externals/coda-oss git-subtree-split: 168cbae01bb1e5fc0a02c2d96e8b02619bf2831d commit 1c1e44094b5b567ae0a5368fc5060716fc83de1c Merge: 10eded084 c57aa2691 Author: Dan Smith Date: Mon Aug 21 09:14:48 2023 -0400 Merge commit 'c57aa2691a9635f55f5c604723d61ee495c59ed2' into develop/sync_externals commit 10eded0843f0d2e281becaf6d74f90902b99d1de Author: Dan Smith Date: Mon Aug 21 09:14:19 2023 -0400 latest from CODA-OSS and NITRO * FmtX() -> str::Format() * use Context overload to reduce use of .str() * reduce use of .str() * reduce a bunch of duplicated code * use Context overload to reduce use of .str() * write() overloads to reduce use of .c_str() * operator<<() for Parameter --- .../c++/except/include/except/Context.h | 16 +- .../c++/logging/include/logging/Logger.h | 13 ++ .../modules/c++/logging/source/Logger.cpp | 24 +++ six/modules/c++/cphd/source/CPHDWriter.cpp | 4 +- .../c++/cphd/source/CPHDXMLControl.cpp | 5 +- six/modules/c++/cphd/source/CPHDXMLParser.cpp | 4 +- six/modules/c++/cphd/source/Channel.cpp | 3 +- six/modules/c++/cphd/source/Data.cpp | 15 +- .../c++/cphd/source/ErrorParameters.cpp | 6 +- six/modules/c++/cphd/source/PVPBlock.cpp | 10 +- six/modules/c++/cphd/source/ProductInfo.cpp | 7 +- six/modules/c++/cphd/source/SupportArray.cpp | 7 +- six/modules/c++/cphd/source/SupportBlock.cpp | 2 +- six/modules/c++/cphd/source/Wideband.cpp | 25 ++-- .../c++/cphd/tests/test_metadata_round.cpp | 2 +- six/modules/c++/cphd03/source/VBM.cpp | 4 +- six/modules/c++/samples/test_dump_images.cpp | 2 +- six/modules/c++/samples/test_parse_xml.cpp | 2 +- .../c++/scene/source/LLAToECEFTransform.cpp | 2 +- six/modules/c++/scene/tests/test_scene.cpp | 4 +- .../c++/six.sicd/source/ComplexData.cpp | 8 +- .../c++/six.sicd/source/ComplexXMLParser.cpp | 4 +- .../six.sicd/source/ComplexXMLParser10x.cpp | 2 +- six/modules/c++/six.sicd/source/GeoData.cpp | 2 +- six/modules/c++/six.sicd/source/Grid.cpp | 80 +++++----- six/modules/c++/six.sicd/source/ImageData.cpp | 10 +- six/modules/c++/six.sicd/source/PFA.cpp | 2 +- six/modules/c++/six.sicd/source/RMA.cpp | 14 +- .../c++/six.sicd/source/RadarCollection.cpp | 24 +-- six/modules/c++/six.sicd/source/RgAzComp.cpp | 4 +- six/modules/c++/six.sicd/source/SCPCOA.cpp | 8 +- .../c++/six.sicd/tests/test_sicd_schemata.cpp | 2 +- .../six.sidd/source/DerivedClassification.cpp | 21 ++- .../c++/six.sidd/source/DerivedXMLParser.cpp | 10 +- .../six.sidd/source/DerivedXMLParser100.cpp | 2 +- .../six.sidd/source/DerivedXMLParser200.cpp | 6 +- .../six.sidd/source/GeoTIFFWriteControl.cpp | 8 +- .../six.sidd/source/SIDDVersionUpdater.cpp | 3 +- six/modules/c++/six/include/six/Enum.h | 6 +- six/modules/c++/six/include/six/Parameter.h | 15 ++ six/modules/c++/six/include/six/Types.h | 2 +- six/modules/c++/six/source/Classification.cpp | 3 +- .../c++/six/source/CollectionInformation.cpp | 3 +- six/modules/c++/six/source/GeoInfo.cpp | 2 +- .../c++/six/source/MatchInformation.cpp | 2 +- .../c++/six/source/NITFHeaderCreator.cpp | 141 +++++------------- .../c++/six/source/NITFReadControl.cpp | 10 +- .../c++/six/source/NITFWriteControl.cpp | 2 +- six/modules/c++/six/source/Utilities.cpp | 2 +- six/modules/c++/six/source/VersionUpdater.cpp | 6 +- six/modules/c++/six/source/XMLControl.cpp | 8 +- .../six/tests/test_determine_data_type.cpp | 2 +- 52 files changed, 273 insertions(+), 298 deletions(-) diff --git a/externals/coda-oss/modules/c++/except/include/except/Context.h b/externals/coda-oss/modules/c++/except/include/except/Context.h index 83f80acee3..27816dccec 100644 --- a/externals/coda-oss/modules/c++/except/include/except/Context.h +++ b/externals/coda-oss/modules/c++/except/include/except/Context.h @@ -20,13 +20,13 @@ * */ - +#pragma once #ifndef CODA_OSS_except_Context_h_INCLUDED_ #define CODA_OSS_except_Context_h_INCLUDED_ -#pragma once #include #include +#include #include "config/Exports.h" #include "config/disable_compiler_warnings.h" @@ -59,12 +59,12 @@ struct CODA_OSS_API Context final Context(const char* file /*__FILE__*/, int line /*__LINE__*/, const std::string& func, const std::string& time, - const std::string& message = "") : - mMessage(message), - mTime(time), - mFunc(func), - mFile(file), - mLine(line) { } + const std::string& message = "" /*for existing SWIG bindings*/) + : mMessage(message), mTime(time), mFunc(func), mFile(file), mLine(line) { } + Context(const char* file /*__FILE__*/, int line /*__LINE__*/, + const std::string& func, + const std::string& time, + const std::ostringstream& message) : Context(file, line, func, time, message.str()) { } Context(const std::string& message, const char* file /*__FILE__*/, int line /*__LINE__*/, const std::string& func = "", diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Logger.h b/externals/coda-oss/modules/c++/logging/include/logging/Logger.h index df158fcfc5..2b33c90658 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Logger.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Logger.h @@ -24,12 +24,14 @@ // Logger.h /////////////////////////////////////////////////////////// +#pragma once #ifndef CODA_OSS_logging_Logger_h_INCLUDED_ #define CODA_OSS_logging_Logger_h_INCLUDED_ #include #include #include +#include #include "config/Exports.h" #include "logging/Filterer.h" @@ -79,6 +81,17 @@ struct CODA_OSS_API Logger : public Filterer //! Logs a message at the CRITICAL LogLevel void critical(const std::string& msg); + //! Logs a message at the DEBUG LogLevel + void debug(const std::ostringstream& msg); + //! Logs a message at the INFO LogLevel + void info(const std::ostringstream& msg); + //! Logs a message at the WARNING LogLevel + void warn(const std::ostringstream& msg); + //! Logs a message at the ERROR LogLevel + void error(const std::ostringstream& msg); + //! Logs a message at the CRITICAL LogLevel + void critical(const std::ostringstream& msg); + //! Logs an Exception Context at the DEBUG LogLevel void debug(const except::Context& ctxt); //! Logs an Exception Context at the INFO LogLevel diff --git a/externals/coda-oss/modules/c++/logging/source/Logger.cpp b/externals/coda-oss/modules/c++/logging/source/Logger.cpp index 9fa37642f4..3f38375374 100644 --- a/externals/coda-oss/modules/c++/logging/source/Logger.cpp +++ b/externals/coda-oss/modules/c++/logging/source/Logger.cpp @@ -98,6 +98,30 @@ void logging::Logger::critical(const std::string& msg) log(LogLevel::LOG_CRITICAL, msg); } +void logging::Logger::debug(const std::ostringstream& msg) +{ + log(LogLevel::LOG_DEBUG, msg.str()); +} + +void logging::Logger::info(const std::ostringstream& msg) +{ + log(LogLevel::LOG_INFO, msg.str()); +} + +void logging::Logger::warn(const std::ostringstream& msg) +{ + log(LogLevel::LOG_WARNING, msg.str()); +} + +void logging::Logger::error(const std::ostringstream& msg) +{ + log(LogLevel::LOG_ERROR, msg.str()); +} + +void logging::Logger::critical(const std::ostringstream& msg) +{ + log(LogLevel::LOG_CRITICAL, msg.str()); +} void logging::Logger::debug(const except::Context& ctxt) { diff --git a/six/modules/c++/cphd/source/CPHDWriter.cpp b/six/modules/c++/cphd/source/CPHDWriter.cpp index 3f8469fcd1..a3402a456f 100644 --- a/six/modules/c++/cphd/source/CPHDWriter.cpp +++ b/six/modules/c++/cphd/source/CPHDWriter.cpp @@ -274,7 +274,7 @@ void CPHDWriter::getMetadata(const PVPBlock& pvpBlock, std::ostringstream ostr; ostr << "Number of pvp block bytes in metadata: " << data.numBytesPVP << " does not match calculated size of pvp block: " << pvpBlock.getNumBytesPVPSet(); - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } const size_t numChannels = data.getNumChannels(); @@ -324,7 +324,7 @@ void CPHDWriter::writePVPData(DataWriter& dataWriter, const cphd::Data& data, co { std::ostringstream ostr; ostr << "PVPBlock of channel " << ii << " is empty"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } const size_t size = (data.getNumVectors(ii) * data.getNumBytesPVPSet()) / 8; diff --git a/six/modules/c++/cphd/source/CPHDXMLControl.cpp b/six/modules/c++/cphd/source/CPHDXMLControl.cpp index 57dc869d1f..f7902398de 100644 --- a/six/modules/c++/cphd/source/CPHDXMLControl.cpp +++ b/six/modules/c++/cphd/source/CPHDXMLControl.cpp @@ -192,9 +192,8 @@ Version CPHDXMLControl::uriToVersion(const xml::lite::Uri& uri) } std::ostringstream ostr; ostr << "The URI " << uri << " is invalid. " - << "Either input a valid URI or " - << "add a entry to versionUriMap"; - throw except::Exception(Ctxt(ostr.str())); + << "Either input a valid URI or add a entry to versionUriMap"; + throw except::Exception(Ctxt(ostr)); } } diff --git a/six/modules/c++/cphd/source/CPHDXMLParser.cpp b/six/modules/c++/cphd/source/CPHDXMLParser.cpp index ba02cbddd7..8cd76a2e89 100644 --- a/six/modules/c++/cphd/source/CPHDXMLParser.cpp +++ b/six/modules/c++/cphd/source/CPHDXMLParser.cpp @@ -2297,13 +2297,13 @@ size_t CPHDXMLParser::parsePVPType(const xml::lite::Element& paramXML, PVPType& { std::ostringstream ostr; ostr << "Specified size: " << size << " does not match default size: " << param.getSize(); - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } if (param.getFormat() != format) { std::ostringstream ostr; ostr << "Specified format: " << format << " does not match default format: " << param.getFormat(); - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } return offset; } diff --git a/six/modules/c++/cphd/source/Channel.cpp b/six/modules/c++/cphd/source/Channel.cpp index 0fd49117f3..52008225ad 100644 --- a/six/modules/c++/cphd/source/Channel.cpp +++ b/six/modules/c++/cphd/source/Channel.cpp @@ -221,8 +221,7 @@ std::ostream& operator<< (std::ostream& os, const Channel& c) } for (size_t ii = 0; ii < c.addedParameters.size(); ++ii) { - os << " Parameter name : " << c.addedParameters[ii].getName() << "\n"; - os << " Parameter value : " << c.addedParameters[ii].str() << "\n"; + out(os, c.addedParameters[ii]); } return os; } diff --git a/six/modules/c++/cphd/source/Data.cpp b/six/modules/c++/cphd/source/Data.cpp index 79775ebd41..dcc605f815 100644 --- a/six/modules/c++/cphd/source/Data.cpp +++ b/six/modules/c++/cphd/source/Data.cpp @@ -93,7 +93,7 @@ Data::SupportArray Data::getSupportArrayById(const std::string& id) const { std::ostringstream ostr; ostr << "ID: " << id << " is not a valid identifier"; - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } return supportArrayMap.find(id)->second; } @@ -106,14 +106,14 @@ void Data::setSupportArray(const std::string& id, size_t numRows, { std::ostringstream ostr; ostr << "Identifier " << id << " is not unique"; - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } if (mOffsetMap.count(offset)) { std::ostringstream ostr; ostr << "Offset " << offset << " is not unique"; - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } // Add to ordered map @@ -126,7 +126,7 @@ void Data::setSupportArray(const std::string& id, size_t numRows, { std::ostringstream ostr; ostr << "Invalid size or offset of support array given for id: " << id; - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } } if (mOffsetMap.upper_bound(offset) != mOffsetMap.end()) @@ -135,7 +135,7 @@ void Data::setSupportArray(const std::string& id, size_t numRows, { std::ostringstream ostr; ostr << "Invalid size or offset of support array given for id: " << id; - throw except::Exception(ostr.str()); + throw except::Exception(Ctxt(ostr)); } } @@ -187,9 +187,8 @@ void Data::verifyChannelInRange(size_t channel) const { std::ostringstream ostr; ostr << "Channel provided is " << channel << "\n" - << "while only " << channels.size() - << " channels exist \n"; - throw except::Exception(ostr.str()); + << "while only " << channels.size() << " channels exist \n"; + throw except::Exception(Ctxt(ostr)); } } diff --git a/six/modules/c++/cphd/source/ErrorParameters.cpp b/six/modules/c++/cphd/source/ErrorParameters.cpp index 4dfe3550b8..de061f6141 100644 --- a/six/modules/c++/cphd/source/ErrorParameters.cpp +++ b/six/modules/c++/cphd/source/ErrorParameters.cpp @@ -161,8 +161,7 @@ std::ostream& operator<< (std::ostream& os, const ErrorParameters& e) } for (const auto& parameter : e.monostatic->parameter) { - os << " Parameter Name : " << parameter.getName() << "\n" - << " Parameter Value : " << parameter.str() << "\n"; + out(os, parameter); } } else if (e.bistatic.get()) @@ -177,8 +176,7 @@ std::ostream& operator<< (std::ostream& os, const ErrorParameters& e) << e.bistatic->rcvPlatform.radarSensor; for (const auto& parameter : e.bistatic->parameter) { - os << " Parameter Name : " << parameter.getName() << "\n" - << " Parameter Value : " << parameter.str() << "\n"; + out(os, parameter); } } else diff --git a/six/modules/c++/cphd/source/PVPBlock.cpp b/six/modules/c++/cphd/source/PVPBlock.cpp index fdae548e8f..1d5bbfc40c 100644 --- a/six/modules/c++/cphd/source/PVPBlock.cpp +++ b/six/modules/c++/cphd/source/PVPBlock.cpp @@ -471,7 +471,7 @@ PVPBlock::PVPBlock(const Pvp& p, const Data& d) : std::ostringstream oss; oss << "PVP size specified in metadata: " << mNumBytesPerVector << " does not match PVP size calculated: " << calculateBytesPerVector; - throw except::Exception(oss.str()); + throw except::Exception(Ctxt(oss)); } } PVPBlock::PVPBlock(const Metadata& metadata) @@ -525,7 +525,7 @@ PVPBlock::PVPBlock(size_t numChannels, std::ostringstream msg; msg << "<" << numChannels << "> channels specified, " << "but `data` argument has <" << data.size() << "> channels"; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } for (size_t channel = 0; channel < numChannels; ++channel) @@ -610,7 +610,7 @@ int64_t PVPBlock::load(io::SeekableInputStream& inStream, std::ostringstream oss; oss << "PVPBlock::load: calculated PVP size(" << numBytesIn << ") != header PVP_DATA_SIZE(" << sizePVP << ")"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } const bool swapToLittleEndian = std::endian::native == std::endian::little; @@ -633,7 +633,7 @@ int64_t PVPBlock::load(io::SeekableInputStream& inStream, { std::ostringstream oss; oss << "EOF reached during PVP read for channel " << (ii); - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } totalBytesRead += bytesThisRead; @@ -1078,7 +1078,7 @@ std::ostream& operator<< (std::ostream& os, const PVPBlock::PVPSet& p) for (auto it = p.addedPVP.begin(); it != p.addedPVP.end(); ++it) { - os << " Additional Parameter : " << it->second.str() << "\n"; + os << " Additional Parameter : " << it->second << "\n"; } return os; } diff --git a/six/modules/c++/cphd/source/ProductInfo.cpp b/six/modules/c++/cphd/source/ProductInfo.cpp index caf266aaa1..5a757274b7 100644 --- a/six/modules/c++/cphd/source/ProductInfo.cpp +++ b/six/modules/c++/cphd/source/ProductInfo.cpp @@ -48,15 +48,12 @@ std::ostream& operator<< (std::ostream& os, const ProductInfo& p) << " Site : " << p.creationInfo[ii].site << "\n"; for (size_t jj = 0; jj < p.creationInfo[ii].parameter.size(); ++jj) { - os << " Parameter name : " - << p.creationInfo[ii].parameter[jj].getName() << "\n" - << " Parameter value : " << p.creationInfo[ii].parameter[jj].str() << "\n"; + out(os, p.creationInfo[ii].parameter[jj]); } } for (size_t ii = 0; ii < p.parameter.size(); ++ii) { - os << " Parameter name : " << p.parameter[ii].getName() << "\n" - << " Parameter value : " << p.parameter[ii].str() << "\n"; + out(os, p.parameter[ii]); } return os; } diff --git a/six/modules/c++/cphd/source/SupportArray.cpp b/six/modules/c++/cphd/source/SupportArray.cpp index 82cee42a0b..aaa66eb63b 100644 --- a/six/modules/c++/cphd/source/SupportArray.cpp +++ b/six/modules/c++/cphd/source/SupportArray.cpp @@ -88,7 +88,7 @@ static SupportArrayParameter getSupportArray(const std::vectorsecond; } @@ -141,8 +141,7 @@ std::ostream& operator<< (std::ostream& os, const AdditionalSupportArray& a) << " ZUnits : " << a.zUnits << "\n"; for (size_t ii = 0; ii < a.parameter.size(); ++ii) { - os << " Parameter Name : " << a.parameter[ii].getName() << "\n" - << " Parameter Value : " << a.parameter[ii].str() << "\n"; + out(os, a.parameter[ii]); } return os; } diff --git a/six/modules/c++/cphd/source/SupportBlock.cpp b/six/modules/c++/cphd/source/SupportBlock.cpp index 36d2e47bc2..6825ca288b 100644 --- a/six/modules/c++/cphd/source/SupportBlock.cpp +++ b/six/modules/c++/cphd/source/SupportBlock.cpp @@ -93,7 +93,7 @@ void SupportBlock::read(const std::string& id, size_t numThreads, std::spansize(); i < total; ++i) { const six::Data* data = container->getData(i); - const auto filename = FmtX("%s_DES_%d.xml", base.string(), i); + const auto filename = str::Format("%s_DES_%d.xml", base.string(), i); const auto xmlFile = fs::path(outputDir) / filename; io::FileOutputStream xmlStream(xmlFile.string()); diff --git a/six/modules/c++/samples/test_parse_xml.cpp b/six/modules/c++/samples/test_parse_xml.cpp index 582ab937da..0ca53cb53b 100644 --- a/six/modules/c++/samples/test_parse_xml.cpp +++ b/six/modules/c++/samples/test_parse_xml.cpp @@ -95,7 +95,7 @@ std::vector extractXML(std::string inputFile, nitf::Off size = deReader.getSize(); const auto typeID = subheader.typeID(); - const auto outputFile = FmtX("%s-%s%d.xml", prefix, typeID, i); + const auto outputFile = str::Format("%s-%s%d.xml", prefix, typeID, i); const auto fileName = outputDir / outputFile; { std::vector xml(size); diff --git a/six/modules/c++/scene/source/LLAToECEFTransform.cpp b/six/modules/c++/scene/source/LLAToECEFTransform.cpp index 38cd4ed5be..6329de8f13 100644 --- a/six/modules/c++/scene/source/LLAToECEFTransform.cpp +++ b/six/modules/c++/scene/source/LLAToECEFTransform.cpp @@ -53,7 +53,7 @@ scene::Vector3 scene::LLAToECEFTransform::transform(const LatLonAlt& lla) const str << ", alt="; str << lla.getAlt(); - throw except::InvalidFormatException(str.str()); + throw except::InvalidFormatException(Ctxt(str)); } //do conversion here; store result in ecef struct diff --git a/six/modules/c++/scene/tests/test_scene.cpp b/six/modules/c++/scene/tests/test_scene.cpp index a38ea343b4..3ad012a4e7 100644 --- a/six/modules/c++/scene/tests/test_scene.cpp +++ b/six/modules/c++/scene/tests/test_scene.cpp @@ -37,7 +37,7 @@ class SceneInfo { std::map::const_iterator p = mVecs.find(k); if (p == mVecs.end()) - throw except::Exception(Ctxt(FmtX("Key not found: %s", k))); + throw except::Exception(Ctxt(str::Format("Key not found: %s", k))); return p->second; } @@ -68,7 +68,7 @@ SceneInfo loadSceneInfo(std::string infoProps) std::string v = d[k].str(); std::vector toks = str::Tokenizer(v, ","); if (toks.size() != 3) - throw except::Exception(Ctxt(FmtX("Expected triple, received: %s", v))); + throw except::Exception(Ctxt(str::Format("Expected triple, received: %s", v))); Vector3 vec; vec[0] = str::toType(toks[0]); diff --git a/six/modules/c++/six.sicd/source/ComplexData.cpp b/six/modules/c++/six.sicd/source/ComplexData.cpp index 3f54b3edfc..7dbfee1ecf 100644 --- a/six/modules/c++/six.sicd/source/ComplexData.cpp +++ b/six/modules/c++/six.sicd/source/ComplexData.cpp @@ -183,7 +183,7 @@ bool ComplexData::validate(logging::Logger& log) const messageBuilder << "RgAzComp specified in imageFormation.imageFormationAlgorithm," << " but member pointer is nullptr."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } break; @@ -200,7 +200,7 @@ bool ComplexData::validate(logging::Logger& log) const messageBuilder << "PFA specified in imageFormation.imageFormationAlgorithm," << " but member pointer is nullptr."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } break; @@ -218,7 +218,7 @@ bool ComplexData::validate(logging::Logger& log) const messageBuilder << "RMA specified in imageFormation.imageFormationAlgorithm," << " but member pointer is nullptr."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } break; @@ -227,7 +227,7 @@ bool ComplexData::validate(logging::Logger& log) const messageBuilder << "Image formation not fully defined." << std::endl << "SICD.ImageFormation.ImageFormAlgo = OTHER or is not set."; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; break; } diff --git a/six/modules/c++/six.sicd/source/ComplexXMLParser.cpp b/six/modules/c++/six.sicd/source/ComplexXMLParser.cpp index 5b4777d3ea..f3e336e0c2 100644 --- a/six/modules/c++/six.sicd/source/ComplexXMLParser.cpp +++ b/six/modules/c++/six.sicd/source/ComplexXMLParser.cpp @@ -832,7 +832,7 @@ XMLElem ComplexXMLParser::convertRcvChanProcToXML( } else { - throw except::Exception(Ctxt(FmtX("[RcvChanProc] is a manditory field in ImageFormation in %s", strVersion))); + throw except::Exception(Ctxt(str::Format("[RcvChanProc] is a manditory field in ImageFormation in %s", strVersion))); } } @@ -876,7 +876,7 @@ XMLElem ComplexXMLParser::convertDistortionToXML( } else { - throw except::Exception(Ctxt(FmtX("[Distortion] is a maditory field of ImageFormation in %s", strVersion))); + throw except::Exception(Ctxt(str::Format("[Distortion] is a maditory field of ImageFormation in %s", strVersion))); } } diff --git a/six/modules/c++/six.sicd/source/ComplexXMLParser10x.cpp b/six/modules/c++/six.sicd/source/ComplexXMLParser10x.cpp index e228777e2a..5f82854ca0 100644 --- a/six/modules/c++/six.sicd/source/ComplexXMLParser10x.cpp +++ b/six/modules/c++/six.sicd/source/ComplexXMLParser10x.cpp @@ -283,7 +283,7 @@ XMLElem ComplexXMLParser10x::convertAntennaParamArrayToXML( } else { - throw except::Exception(Ctxt(FmtX("[Array] is a mandatory field in AntennaParams of [%s] in 1.0", name))); + throw except::Exception(Ctxt(str::Format("[Array] is a mandatory field in AntennaParams of [%s] in 1.0", name))); } } diff --git a/six/modules/c++/six.sicd/source/GeoData.cpp b/six/modules/c++/six.sicd/source/GeoData.cpp index b141eafbf8..6396dbfedc 100644 --- a/six/modules/c++/six.sicd/source/GeoData.cpp +++ b/six/modules/c++/six.sicd/source/GeoData.cpp @@ -110,7 +110,7 @@ bool GeoData::validate(logging::Logger& log) const messageBuilder.str(""); messageBuilder << "GeoData.SCP.ECF and GeoData.SCP.LLH not consistent.\n" << "SICD.GeoData.SCP.ECF - SICD.GeoData.SCP.LLH: " << ecfDiff << " (m)\n"; - log.error(messageBuilder.str()); + log.error(messageBuilder); return false; } diff --git a/six/modules/c++/six.sicd/source/Grid.cpp b/six/modules/c++/six.sicd/source/Grid.cpp index 7c9ce29dfe..9f55770187 100644 --- a/six/modules/c++/six.sicd/source/Grid.cpp +++ b/six/modules/c++/six.sicd/source/Grid.cpp @@ -235,7 +235,7 @@ bool DirectionParameters::validate(const ImageData& imageData, messageBuilder << BOUNDS_ERROR_MESSAGE << std::endl << "SICD.Grid.Row/Col.DeltaK1: " << deltaK1 << std::endl << "SICD.Grid.Row/Col.DetalK2: " << deltaK2 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -249,7 +249,7 @@ bool DirectionParameters::validate(const ImageData& imageData, << "0.5/SICD.Grid.Row/Col.SampleSpacing: " << 0.5 / sampleSpacing << std::endl << "SICD.Grid.Row/Col.DetalK2: " << deltaK2 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -261,7 +261,7 @@ bool DirectionParameters::validate(const ImageData& imageData, << "0.5/SICD.Grid.Row/Col.SampleSpacing: " << 0.5 / sampleSpacing << std::endl << "SICD.Grid.Row/Col.DetalK1: " << deltaK1 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -274,7 +274,7 @@ bool DirectionParameters::validate(const ImageData& imageData, impulseResponseBandwidth << std::endl << "SICD.Grid.Row/Col.DeltaK2 - SICD.Grid.Row/COl.DeltaK1: " << deltaK2 - deltaK1 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } @@ -294,7 +294,7 @@ bool DirectionParameters::validate(const ImageData& imageData, messageBuilder << BOUNDS_ERROR_MESSAGE << std::endl << "SICD.Grid.Row/Col.DeltaK1: " << deltaK1 << std::endl << "Derived DeltaK1: " << minDk << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } //2.3.9.2, 2.3.9.4 @@ -304,7 +304,7 @@ bool DirectionParameters::validate(const ImageData& imageData, messageBuilder << BOUNDS_ERROR_MESSAGE << std::endl << "SICD.Grid.Row/Col.DeltaK2: " << deltaK2 << std::endl << "Derived DeltaK2: " << maxDk << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -328,7 +328,7 @@ bool DirectionParameters::validate(const ImageData& imageData, messageBuilder << "Unrecognized weighting description" << std::endl << "WeightType.WindowName: " << weightType->windowName << std::endl; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } } @@ -343,7 +343,7 @@ bool DirectionParameters::validate(const ImageData& imageData, messageBuilder << "Non-uniform weighting, but no WgtFunct provided" << std::endl << "WgtType.WindowName: " << weightType->windowName << std::endl; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); } return valid; @@ -388,7 +388,7 @@ bool DirectionParameters::validateWeights(const Functor& weightFunction, << "inconsistent with weightType" << std::endl << "WeightType.WindowName: " << weightType->windowName << std::endl; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } @@ -443,7 +443,7 @@ bool DirectionParameters::validate(const RgAzComp& rgAzComp, messageBuilder.str(""); messageBuilder << "KCenter: " << kCenter << std::endl << "DeltaKCOAPoly: " << deltaKCOAPoly[0][0]; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -452,7 +452,7 @@ bool DirectionParameters::validate(const RgAzComp& rgAzComp, { messageBuilder.str(""); messageBuilder << "DetlaKCOAPoly must be a single value for RGAZCOMP data"; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } return valid; @@ -528,7 +528,7 @@ bool Grid::validateFFTSigns(logging::Logger& log) const "FFT signs in row and column direction should be the same." << std::endl << "Grid.Row.Sign: " << row->sign << std::endl << "Grid.Col.Sign: " << col->sign << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } return valid; @@ -814,7 +814,7 @@ bool Grid::validate(const RMA& rma, const Vector3& scp, std::ostringstream messageBuilder; messageBuilder << "Given image formation algorithm expects " << defaultGridType(rma) << ".\nFound " << type; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -850,7 +850,7 @@ bool Grid::validate(const RMAT& rmat, const Vector3& scp, << "Grid.Row.UVectECF: " << row->unitVector << std::endl << "Derived grid.Row.UVectECT: " << derivedRowUnitVector(rmat, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -862,7 +862,7 @@ bool Grid::validate(const RMAT& rmat, const Vector3& scp, << "Grid.Col.UVectECF: " << col->unitVector << std::endl << "Derived Grid.Col.UVectECF: " << derivedColUnitVector(rmat, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -873,7 +873,7 @@ bool Grid::validate(const RMAT& rmat, const Vector3& scp, messageBuilder << WF_INCONSISTENT_STR << "Grid.Row.KCtr: " << row->kCenter << std::endl << "Derived KCtr: " << derivedRowKCenter(rmat, fc); - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } @@ -884,7 +884,7 @@ bool Grid::validate(const RMAT& rmat, const Vector3& scp, messageBuilder << WF_INCONSISTENT_STR << "Grid.Col.KCtr: " << col->kCenter << std::endl << "Derived KCtr: " << derivedColKCenter(rmat, fc); - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } @@ -905,7 +905,7 @@ bool Grid::validate(const RMCR& rmcr, const Vector3& scp, << "Grid.Row.UVectECF: " << row->unitVector << std::endl << "Derived Grid.Row.UVectECF: " << derivedRowUnitVector(rmcr, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -917,7 +917,7 @@ bool Grid::validate(const RMCR& rmcr, const Vector3& scp, << "Grid.Col.UVectECF: " << col->unitVector << std::endl << "Derived Grid.Col.UVectECF: " << derivedColUnitVector(rmcr, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -927,7 +927,7 @@ bool Grid::validate(const RMCR& rmcr, const Vector3& scp, messageBuilder.str(""); messageBuilder << "Grid.Col.KCtr must be zero for RMA/RMCR data." << std::endl << "Grid.Col.KCtr = " << col->kCenter; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -940,7 +940,7 @@ bool Grid::validate(const RMCR& rmcr, const Vector3& scp, messageBuilder << WF_INCONSISTENT_STR << std::endl << "Grid.Row.KCtr: " << row->kCenter << std::endl << "Center frequency * 2/c: " << derivedRowKCenter(rmcr, fc); - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } } @@ -974,7 +974,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, messageBuilder.str(""); messageBuilder << "Grid.Col.delaKCOAPoly and " << "RMA.INCA.dopplerCentroidPoly have diferent sizes."; - log.error(messageBuilder.str()); + log.error(messageBuilder); } else { @@ -996,7 +996,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, messageBuilder << "RMA.INCA fields inconsistent." << std::endl << "Compare Grid.Col.KCOAPoly to RMA.INCA.DopCentroidPoly " << "* RMA.INCA.TimeCAPoly[1]."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } @@ -1011,7 +1011,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, << "Grid.Row.UVectECF: " << row->unitVector << std::endl << "Derived Grid.Row.UVectECF: " << derivedRowUnitVector(inca, scp, arpPoly); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1024,7 +1024,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, << "Grid.Col.UVectECF: " << col->unitVector << std::endl << "Derived Grid.Col.UVectECF: " << derivedRowUnitVector(inca, scp, arpPoly); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1035,7 +1035,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, messageBuilder << "Grid.Col.KCtr must be zero " << "for RMA/INCA data." << std::endl << "Grid.Col.KCtr: " << col->kCenter; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1048,7 +1048,7 @@ bool Grid::validate(const INCA& inca, const Vector3& scp, messageBuilder << WF_INCONSISTENT_STR << std::endl << "RMA.INCA.FreqZero * 2 / c: " << derivedRowKCenter(inca) << std::endl << "Grid.Row.KCenter: " << row->kCenter; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } return valid; @@ -1067,7 +1067,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, messageBuilder.str(""); messageBuilder << "PFA image formation should result in a RGAZIM grid." << std::endl << "Grid.Type: " << type; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1092,7 +1092,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, messageBuilder << WF_INCONSISTENT_STR << "Grid.Row.KCtr: " << row->kCenter << std::endl << "Derived KapCtr: " << kapCtr; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } @@ -1112,7 +1112,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << 0.5 / col->sampleSpacing << std::endl << "PFA.Kaz2 - Grid.Col.KCenter: " << pfa.kaz2 - col->kCenter << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } //2.3.11 @@ -1125,7 +1125,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << 0.5 / col->sampleSpacing << std::endl << "PFA.Kaz1 - Grid.Col.KCenter: " << pfa.kaz1 - col->kCenter << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } @@ -1140,7 +1140,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << 0.5 / row->sampleSpacing << std::endl << "PFA.Krg2 - Grid.Row.KCenter: " << pfa.krg2 - row->kCenter << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1154,7 +1154,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << 0.5 / row->sampleSpacing << std::endl << "PFA.Krg1 - Grid.Row.KCenter: " << pfa.krg1 - row->kCenter << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1167,7 +1167,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << col->impulseResponseBandwidth << std::endl << "SICD.PFA.Kaz2 - SICD.PFA.Kaz1: " << pfa.kaz2 - pfa.kaz1 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } //2.3.15 @@ -1179,7 +1179,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << row->impulseResponseBandwidth << std::endl << "SICD.PFA.Krg2 - SICD.PFA.Krg1: " << pfa.krg2 - pfa.krg1 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } //2.3.16 @@ -1191,7 +1191,7 @@ bool Grid::validate(const PFA& pfa, const RadarCollection& radarCollection, << "Grid.Col.KCenter: " << col->kCenter << std::endl << "mean(SICD.PFA.Kaz1, SICD.PFA.Kaz2): " << (pfa.kaz1 + pfa.kaz2) / 2 << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1214,7 +1214,7 @@ bool Grid::validate(const RgAzComp& rgAzComp, messageBuilder << "RGAZCOMP image formation should result in a SLANT plane image." << std::endl << "Grid.ImagePlane: " << imagePlane; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1225,7 +1225,7 @@ bool Grid::validate(const RgAzComp& rgAzComp, messageBuilder << "RGAZCOMP image formation should result in a RGAZIM grid." << std::endl << "Grid.Type: " << type; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1244,7 +1244,7 @@ bool Grid::validate(const RgAzComp& rgAzComp, << "Grid.Row.UVectECEF: " << row->unitVector << std::endl << "Derived Grid.Row.UVectECEF: " << derivedRowUnitVector(scpcoa, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -1257,7 +1257,7 @@ bool Grid::validate(const RgAzComp& rgAzComp, << "Grid.Col.UVectECF: " << col->unitVector << std::endl << "Derived Grid.Col.UVectECF: " << derivedColUnitVector(scpcoa, scp); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } diff --git a/six/modules/c++/six.sicd/source/ImageData.cpp b/six/modules/c++/six.sicd/source/ImageData.cpp index 4b7092608d..c3c13a1722 100644 --- a/six/modules/c++/six.sicd/source/ImageData.cpp +++ b/six/modules/c++/six.sicd/source/ImageData.cpp @@ -120,7 +120,7 @@ bool ImageData::validate(const GeoData& geoData, logging::Logger& log) const messageBuilder << "ImageData.ValidData/GeoData.ValidData " << "required together." << std::endl << "ImageData.ValidData exists, but GeoData.ValidData does not."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -130,7 +130,7 @@ bool ImageData::validate(const GeoData& geoData, logging::Logger& log) const messageBuilder << "ImageData.ValidData/GeoData.ValidData " << "required together." << std::endl << "GeoData.ValidData exists, but ImageData.ValidData does not."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -153,7 +153,7 @@ bool ImageData::validate(const GeoData& geoData, logging::Logger& log) const { messageBuilder << "ImageData.ValidData first row should have" << "minimum row index"; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } else @@ -173,14 +173,14 @@ bool ImageData::validate(const GeoData& geoData, logging::Logger& log) const { messageBuilder << "ImageData.ValidData first col of matching" << "minimum row index should have minimum col index"; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } if (!Utilities::isClockwise(validData)) { messageBuilder << "ImageData.ValidData should be arrange clockwise"; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } diff --git a/six/modules/c++/six.sicd/source/PFA.cpp b/six/modules/c++/six.sicd/source/PFA.cpp index 4e3d94d27c..23f8ac505f 100644 --- a/six/modules/c++/six.sicd/source/PFA.cpp +++ b/six/modules/c++/six.sicd/source/PFA.cpp @@ -124,7 +124,7 @@ bool PFA::validate(const SCPCOA& scpcoa, logging::Logger& log) << "time for center are usuallly the same." << std::endl << "PFA.PolarAngRefTime: " << polarAngleRefTime << std::endl << "SCPCOA.SCPTime: " << scpcoa.scpTime; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } diff --git a/six/modules/c++/six.sicd/source/RMA.cpp b/six/modules/c++/six.sicd/source/RMA.cpp index 8231d21c27..13485c2340 100644 --- a/six/modules/c++/six.sicd/source/RMA.cpp +++ b/six/modules/c++/six.sicd/source/RMA.cpp @@ -96,7 +96,7 @@ bool RMAT::validate(const Vector3& scp, logging::Logger& log) messageBuilder << "RMA fields inconsistent." << std::endl << "RMA.RMAT.DopConeAngleRef: " << dopConeAngleRef << std::endl << "Derived RMA.RMAT.DopConeAngleRef: " << dcaRef; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } return valid; @@ -181,7 +181,7 @@ bool RMCR::validate(const Vector3& scp, logging::Logger& log) messageBuilder << "RMA fields inconsistent." << std::endl << "RMA.RMCR.DopConeAngleRef: " << dopConeAngleRef << std::endl << "Derived RMA.RMCR.DopConeAngleRef: " << dcaRef; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } return valid; @@ -264,7 +264,7 @@ bool INCA::validate(const CollectionInformation& collectionInformation, messageBuilder << "RMA.INCA fields inconsistent." << std::endl << "RMA.INCA.DopplerCentroidPoly/DopplerCentroidCOA " << "should not be included for SPOTLIGHT collection."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -277,7 +277,7 @@ bool INCA::validate(const CollectionInformation& collectionInformation, messageBuilder << "RMA.INCA fields inconsistent." << std::endl << "RMA.INCA.DopplerCentroidPoly/COA required " << "for non-SPOTLIGHT collection."; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -288,7 +288,7 @@ bool INCA::validate(const CollectionInformation& collectionInformation, messageBuilder << "RMA.INCA.FreqZero is typically the center transmit frequency" << std::endl << "RMA.INCA.FreqZero: " << freqZero << "Center transmit frequency: " << fc; - log.warn(messageBuilder.str()); + log.warn(messageBuilder); valid = false; } @@ -299,7 +299,7 @@ bool INCA::validate(const CollectionInformation& collectionInformation, messageBuilder << "RMA.INCA fields inconsistent." << std::endl << "RMA.INCA.rangeCA: " << rangeCA << "Derived RMA.INCA.rangeCA: " << derivedRangeCa(scp, arpPoly); - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -417,6 +417,6 @@ bool RMA::validate(const CollectionInformation& collectionInformation, std::ostringstream messageBuilder; messageBuilder << "Exactly one of RMA->RMAT, RMA->RMCR, RMA->INCA " << "must exist."; - log.error(messageBuilder.str()); + log.error(messageBuilder); return false; } diff --git a/six/modules/c++/six.sicd/source/RadarCollection.cpp b/six/modules/c++/six.sicd/source/RadarCollection.cpp index e90ea5b3b3..dc131532a3 100644 --- a/six/modules/c++/six.sicd/source/RadarCollection.cpp +++ b/six/modules/c++/six.sicd/source/RadarCollection.cpp @@ -147,7 +147,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << txRFBandwidth << std::endl << "SICD.RadarCollection.TxFrequency.txFMRate * txPulseLength: " << txFMRate * txPulseLength << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -161,7 +161,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << rcvDemodType << std::endl << "SICD.RadarCollection.Waveform.WFParameters.RcvFMRate: " << rcvFMRate << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -177,7 +177,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << rcvFMRate << std::endl << "SICD.RadarCollection.Waveform.WFParameters.TxFMRate: " << txFMRate << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -190,7 +190,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, messageBuilder << WF_INCONSISTENT_STR << std::endl << "SICD.RadarCollection.txFreqStart: " << txFrequencyStart << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -203,7 +203,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, messageBuilder << WF_INCONSISTENT_STR << std::endl << "SICD.RadarCollection.rcvFreqStart: " << rcvFrequencyStart << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -216,7 +216,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << txPulseLength << std::endl << "SICD.RadarCollection.Waveform.WFPArameters.RcvWindowLength: " << rcvWindowLength << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -229,7 +229,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << rcvIFBandwidth << std::endl << "SICD.RadarCollection.Waveform.WFPArameters.ADCSampleRate: " << adcSampleRate << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -244,7 +244,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, << txRFBandwidth << std::endl << "SICD.RadarCollection.Waveform.WFPArameters.ADCSampleRate: " << adcSampleRate << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -259,7 +259,7 @@ bool WaveformParameters::validate(int refFrequencyIndex, messageBuilder << WF_INCONSISTENT_STR << std::endl << "SICD.RadarCollection.Waveform.WFParameters.RcvFreqStart: " << rcvFrequencyStart << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } @@ -557,7 +557,7 @@ bool RadarCollection::validate(logging::Logger& log) const << wfMin << std::endl << "SICD.RadarCollection.TxFrequency.Min: " << txFrequencyMin << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -571,7 +571,7 @@ bool RadarCollection::validate(logging::Logger& log) const << " + TxFRBandwidth: " << wfMax << std::endl << "SICD.RadarCollection.TxFrequency.Max: " << txFrequencyMax << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -583,7 +583,7 @@ bool RadarCollection::validate(logging::Logger& log) const messageBuilder << WF_INCONSISTENT_STR << std::endl << "SICD.RadarCollection.txFrequencyMin: " << txFrequencyMin << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } diff --git a/six/modules/c++/six.sicd/source/RgAzComp.cpp b/six/modules/c++/six.sicd/source/RgAzComp.cpp index aafc5a4733..7745fee18f 100644 --- a/six/modules/c++/six.sicd/source/RgAzComp.cpp +++ b/six/modules/c++/six.sicd/source/RgAzComp.cpp @@ -73,7 +73,7 @@ bool RgAzComp::validate(const GeoData& geoData, messageBuilder << "RGAZCOMP fields inconsistent." << std::endl << "RgAzComp.AzSF: " << azSF << std::endl << "Derived RgAzComp.AzSF: " << expectedAzSf; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -95,7 +95,7 @@ bool RgAzComp::validate(const GeoData& geoData, messageBuilder << "RGAZCOMP fields inconsistent." << std::endl << "RgAzComp.KazPoly: " << kazPoly << std::endl << "Derived RgAzComp.KazPoly: " << derivedPoly; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } } diff --git a/six/modules/c++/six.sicd/source/SCPCOA.cpp b/six/modules/c++/six.sicd/source/SCPCOA.cpp index 54990f66e6..c4eed14da5 100644 --- a/six/modules/c++/six.sicd/source/SCPCOA.cpp +++ b/six/modules/c++/six.sicd/source/SCPCOA.cpp @@ -220,7 +220,7 @@ bool SCPCOA::validate(const GeoData& geoData, messageBuilder << SCPCOA_INCONSISTENT_STR << "\n" << "SCPCOA.scpTime: " << scpTime << std::endl << "Derived scpTime: " << derivedSCPTime(grid) << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -243,7 +243,7 @@ bool SCPCOA::validate(const GeoData& geoData, "SCPCOA.SideOfTrack: " << sideOfTrack << std::endl << "Derived SideOfTrack: " << geometry.getSideOfTrack() << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); valid = false; } @@ -282,7 +282,7 @@ bool SCPCOA::compareFields(double given, double expected, messageBuilder << SCPCOA_INCONSISTENT_STR << "\n" << "SCPCOA." << name << ": " << given << std::endl << "Derived " << name << ": " << expected << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); return false; } @@ -298,6 +298,6 @@ bool SCPCOA::compareFields(Vector3 given, Vector3 expected, messageBuilder << SCPCOA_INCONSISTENT_STR << "\n" << "SCPCOA." << name << ": " << given << std::endl << "Derived " << name << ": " << expected << std::endl; - log.error(messageBuilder.str()); + log.error(messageBuilder); return false; } diff --git a/six/modules/c++/six.sicd/tests/test_sicd_schemata.cpp b/six/modules/c++/six.sicd/tests/test_sicd_schemata.cpp index d32e3811ad..d275108fac 100644 --- a/six/modules/c++/six.sicd/tests/test_sicd_schemata.cpp +++ b/six/modules/c++/six.sicd/tests/test_sicd_schemata.cpp @@ -2422,7 +2422,7 @@ bool cmpRoundTripXMLs(std::string xmlText, std::string xmlPath = "", // parse the programetically generated SICD XML string xml::lite::MinidomParser parser; io::StringStream oss; - oss.write(xmlText.c_str(), xmlText.size()); + oss.write(xmlText); parser.parse(oss); // apply parsed XML to document, print its XML string and compare to original XML string diff --git a/six/modules/c++/six.sidd/source/DerivedClassification.cpp b/six/modules/c++/six.sidd/source/DerivedClassification.cpp index dfe850632a..bb6647b29a 100644 --- a/six/modules/c++/six.sidd/source/DerivedClassification.cpp +++ b/six/modules/c++/six.sidd/source/DerivedClassification.cpp @@ -48,7 +48,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::REL, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, releasableToStr))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, releasableToStr))); } if (!classifiedBy.empty()) @@ -57,7 +57,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::CAUT, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classifiedBy))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classifiedBy))); // classifiedBy attribute represents the name of the original // classification authority @@ -66,7 +66,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::CATP, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classAuthorityType))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classAuthorityType))); } if (!classificationReason.empty()) @@ -75,7 +75,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::CRSN, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classificationReason))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, classificationReason))); } // By default, mark as exempt from automatic declassification @@ -90,7 +90,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::DCDT, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassDateStr))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassDateStr))); // Declassify on a specific date declassType = "DD"; @@ -102,7 +102,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::CLTX, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassEvent))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassEvent))); // Declassify upon occurrence of an event declassType = "DE"; @@ -123,7 +123,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::DCXM, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, exemptedSourceType))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, exemptedSourceType))); // Exempt from automatic declassification declassType = "X"; @@ -159,7 +159,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, const std::string fieldKey = NITFImageInfo::generateFieldKey(NITFImageInfo::DCXM, prefix); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassExemption))); + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", fieldKey, declassExemption))); // Exempt from automatic declassification declassType = "X"; @@ -169,7 +169,7 @@ void DerivedClassification::setSecurity(const std::string& prefix, // Now that we've gone through all the things that could modify the // declassification type, set it security.getDeclassificationType().set(declassType); - log.debug(Ctxt(FmtX("Setting NITF [%s] from sicd/sidd: [%s]", + log.debug(Ctxt(str::Format("Setting NITF [%s] from sicd/sidd: [%s]", NITFImageInfo::generateFieldKey(NITFImageInfo::DCTP, prefix), declassType))); } } @@ -192,8 +192,7 @@ void DerivedClassification::putImpl(const std::string& name, os << name << ":\n"; for (size_t ii = 0; ii < params.size(); ++ii) { - os << " [" << params[ii].getName() << " = " - << params[ii].str() << "]\n"; + os << " [" << params[ii].getName() << " = " << params[ii] << "]\n"; } } diff --git a/six/modules/c++/six.sidd/source/DerivedXMLParser.cpp b/six/modules/c++/six.sidd/source/DerivedXMLParser.cpp index 88e01b510f..397c1920c8 100644 --- a/six/modules/c++/six.sidd/source/DerivedXMLParser.cpp +++ b/six/modules/c++/six.sidd/source/DerivedXMLParser.cpp @@ -1173,7 +1173,7 @@ XMLElem DerivedXMLParser::createLUTImpl(const LUT *lut, XMLElem lutElem) const { std::ostringstream ostr; ostr << "Invalid element size [" << lut->elementSize << "]"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } if ((lut->numEntries - 1) != i) oss << ' '; @@ -1236,7 +1236,7 @@ XMLElem DerivedXMLParser::convertProductProcessingToXML( // error checking if (productProcessing->processingModules.empty()) { - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "There must be at least [1] ProcessingModule in "\ "ProductProcessing, [%d] found", productProcessing->processingModules.size()))); @@ -1847,7 +1847,7 @@ XMLElem DerivedXMLParser::createSFALine( // error check the vertices if (l->vertices.size() < 2) - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "Must be at least two Vertices in LineString. Only [%d] " \ "found", l->vertices.size()))); @@ -1948,7 +1948,7 @@ XMLElem DerivedXMLParser::convertSFAGeometryToXML( // error check the vertices if (p->vertices.size() < 2) - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "Must be at least two Vertices in LineString. Only [%d] " \ "found", p->vertices.size()))); @@ -1960,7 +1960,7 @@ XMLElem DerivedXMLParser::convertSFAGeometryToXML( } else { - throw except::InvalidArgumentException(Ctxt(FmtX("Invalid geo type: [%s]", geoType))); + throw except::InvalidArgumentException(Ctxt(str::Format("Invalid geo type: [%s]", geoType))); } return geoElem; diff --git a/six/modules/c++/six.sidd/source/DerivedXMLParser100.cpp b/six/modules/c++/six.sidd/source/DerivedXMLParser100.cpp index afcd9aef95..ff84a9e133 100644 --- a/six/modules/c++/six.sidd/source/DerivedXMLParser100.cpp +++ b/six/modules/c++/six.sidd/source/DerivedXMLParser100.cpp @@ -566,7 +566,7 @@ XMLElem DerivedXMLParser100::convertExploitationFeaturesToXML( if (exploitationFeatures->collections.empty()) { - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "ExploitationFeatures must have at least [1] Collection, " \ "only [%d] found", exploitationFeatures->collections.size()))); } diff --git a/six/modules/c++/six.sidd/source/DerivedXMLParser200.cpp b/six/modules/c++/six.sidd/source/DerivedXMLParser200.cpp index e2b0fdc7e0..3bdd6fc3de 100644 --- a/six/modules/c++/six.sidd/source/DerivedXMLParser200.cpp +++ b/six/modules/c++/six.sidd/source/DerivedXMLParser200.cpp @@ -1369,7 +1369,7 @@ xml::lite::Element& DerivedXMLParser200::convertKernelToXML(const DerivedXMLPars ostr << "Filter size is " << kernel.custom->size.row << " rows x " << kernel.custom->size.col << " cols but have " << kernel.custom->filterCoef.size() << " coefficients"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } auto& filterCoef = parser.newElement("FilterCoefficients", customElem); @@ -1422,7 +1422,7 @@ xml::lite::Element& DerivedXMLParser200::convertBankToXML(const DerivedXMLParser ostr << "Filter size is " << bank.custom->numPhasings << " x " << bank.custom->numPoints << " but have " << bank.custom->filterCoef.size() << " coefficients"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } auto& filterCoef = parser.newElement("FilterCoefficients", customElem); @@ -1582,7 +1582,7 @@ xml::lite::Element& DerivedXMLParser200::convertExploitationFeaturesToXML(const if (exploitationFeatures.collections.empty()) { - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "ExploitationFeatures must have at least [1] Collection, " \ "only [%d] found", exploitationFeatures.collections.size()))); } diff --git a/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp b/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp index 7d2c469c25..89c7c1127a 100644 --- a/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp +++ b/six/modules/c++/six.sidd/source/GeoTIFFWriteControl.cpp @@ -77,7 +77,7 @@ void GeoTIFFWriteControl::initialize(std::shared_ptr container) mDerivedData.push_back(data); } else - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "Data element at position [%d] in container is undefined", ii))); } @@ -92,7 +92,7 @@ void GeoTIFFWriteControl::save(const SourceList& sources, tiffWriter.writeHeader(); if (sources.size() != mDerivedData.size()) - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "Meta-data count [%d] does not match source list [%d]", mDerivedData.size(), sources.size()))); @@ -177,7 +177,7 @@ void GeoTIFFWriteControl::setupIFD(const DerivedData* data, } ifd->addEntry(tiff::KnownTags::PHOTOMETRIC_INTERPRETATION, photoInterp); - addStringArray(ifd, "ImageDescription", FmtX("SIDD: %s", data->getName())); + addStringArray(ifd, "ImageDescription", str::Format("SIDD: %s", data->getName())); constexpr unsigned short orientation = 1; ifd->addEntry("Orientation", orientation); @@ -268,7 +268,7 @@ void GeoTIFFWriteControl::save(const TBufferList& sources, tiffWriter.writeHeader(); if (sources.size() != mDerivedData.size()) - throw except::Exception(Ctxt(FmtX( + throw except::Exception(Ctxt(str::Format( "Meta-data count [%d] does not match source list [%d]", mDerivedData.size(), sources.size()))); diff --git a/six/modules/c++/six.sidd/source/SIDDVersionUpdater.cpp b/six/modules/c++/six.sidd/source/SIDDVersionUpdater.cpp index 5161c22a05..9acb8b2edf 100644 --- a/six/modules/c++/six.sidd/source/SIDDVersionUpdater.cpp +++ b/six/modules/c++/six.sidd/source/SIDDVersionUpdater.cpp @@ -175,8 +175,7 @@ void SIDDVersionUpdater::updateSingleIncrement() emitWarning(msg.str()); msg.str(""); - msg << "ExploitationFeatures.Product[" << ii - << "].Polarization"; + msg << "ExploitationFeatures.Product[" << ii << "].Polarization"; emitWarning(msg.str()); } } diff --git a/six/modules/c++/six/include/six/Enum.h b/six/modules/c++/six/include/six/Enum.h index b35ca0fde7..8ddae23246 100644 --- a/six/modules/c++/six/include/six/Enum.h +++ b/six/modules/c++/six/include/six/Enum.h @@ -67,14 +67,14 @@ namespace details inline T index(const std::map& map, const std::string& v) { const auto result = nitf::details::index(map, v); - const except::InvalidFormatException ex(Ctxt(FmtX("Invalid enum value: %s", v))); + const except::InvalidFormatException ex(Ctxt(str::Format("Invalid enum value: %s", v))); return nitf::details::value(result, ex); } template inline std::string index(const std::map& map, T v) { const auto result = nitf::details::index(map, v); - const except::InvalidFormatException ex(Ctxt(FmtX("Invalid enum value: %d", v))); + const except::InvalidFormatException ex(Ctxt(str::Format("Invalid enum value: %d", v))); return nitf::details::value(result, ex); } @@ -84,7 +84,7 @@ namespace details constexpr auto not_set_value = static_cast(NOT_SET_VALUE); if (throw_if_not_set && (value == not_set_value)) { - throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %d", value))); + throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %d", value))); } return index(map, value); } diff --git a/six/modules/c++/six/include/six/Parameter.h b/six/modules/c++/six/include/six/Parameter.h index 1251a32730..62b09c6f51 100644 --- a/six/modules/c++/six/include/six/Parameter.h +++ b/six/modules/c++/six/include/six/Parameter.h @@ -23,6 +23,8 @@ #ifndef SIX_six_Parameter_h_INCLUDED_ #define SIX_six_Parameter_h_INCLUDED_ +#include + #include #include "six/Types.h" @@ -164,6 +166,19 @@ struct Parameter final std::string mName; }; +inline std::ostream& operator<<(std::ostream& os, const Parameter& p) +{ + os << p.str(); + return os; +} + +inline std::ostream& out(std::ostream& os, const Parameter& p) +{ + os << " Parameter Name : " << p.getName() << "\n" + << " Parameter Value : " << p << "\n"; + return os; +} + } #endif // SIX_six_Parameter_h_INCLUDED_ \ No newline at end of file diff --git a/six/modules/c++/six/include/six/Types.h b/six/modules/c++/six/include/six/Types.h index 84cd4ab85f..96f590f6ca 100644 --- a/six/modules/c++/six/include/six/Types.h +++ b/six/modules/c++/six/include/six/Types.h @@ -215,7 +215,7 @@ struct Constants return 3; default: - throw except::Exception(Ctxt(FmtX("Unknown pixel type [%d]", (int) type))); + throw except::Exception(Ctxt(str::Format("Unknown pixel type [%d]", (int) type))); } } diff --git a/six/modules/c++/six/source/Classification.cpp b/six/modules/c++/six/source/Classification.cpp index 51b3b2e34a..7ac4ce9905 100644 --- a/six/modules/c++/six/source/Classification.cpp +++ b/six/modules/c++/six/source/Classification.cpp @@ -51,8 +51,7 @@ std::ostream& operator<<(std::ostream& os, const Classification& c) iter != c.fileOptions.end(); ++iter) { - os << " {" << iter->first << "} " << iter->second.str() - << std::endl; + os << " {" << iter->first << "} " << iter->second << "\n"; } return os; } diff --git a/six/modules/c++/six/source/CollectionInformation.cpp b/six/modules/c++/six/source/CollectionInformation.cpp index ac524f965f..e2ed2197f4 100644 --- a/six/modules/c++/six/source/CollectionInformation.cpp +++ b/six/modules/c++/six/source/CollectionInformation.cpp @@ -87,8 +87,7 @@ std::ostream& operator<< (std::ostream& os, const six::CollectionInformation& c) } for (size_t ii = 0; ii < c.parameters.size(); ++ii) { - os << " Parameter name : " << c.parameters[ii].getName() << "\n" - << " Parameter value : " << c.parameters[ii].str() << "\n"; + out(os, c.parameters[ii]); } return os; } diff --git a/six/modules/c++/six/source/GeoInfo.cpp b/six/modules/c++/six/source/GeoInfo.cpp index 51fa81044d..b37076f3b0 100644 --- a/six/modules/c++/six/source/GeoInfo.cpp +++ b/six/modules/c++/six/source/GeoInfo.cpp @@ -30,7 +30,7 @@ std::ostream& operator<< (std::ostream& os, const GeoInfo& g) << " Name : " << g.name << "\n"; for (size_t ii = 0; ii < g.desc.size(); ++ii) { - os << " Description : " << g.desc[ii].getName() << ": " << g.desc[ii].str() << "\n"; + os << " Description : " << g.desc[ii].getName() << ": " << g.desc[ii] << "\n"; } if (g.geometryLatLon.size() == 1) { diff --git a/six/modules/c++/six/source/MatchInformation.cpp b/six/modules/c++/six/source/MatchInformation.cpp index 515b949226..a5783e14df 100644 --- a/six/modules/c++/six/source/MatchInformation.cpp +++ b/six/modules/c++/six/source/MatchInformation.cpp @@ -75,7 +75,7 @@ std::ostream& operator<< (std::ostream& os, const MatchInformation& m) { os << " Parameter : " << m.types[ii].matchCollects[jj].parameters[kk].getName() - << ": " << m.types[ii].matchCollects[jj].parameters[kk].str() << "\n"; + << ": " << m.types[ii].matchCollects[jj].parameters[kk] << "\n"; } } } diff --git a/six/modules/c++/six/source/NITFHeaderCreator.cpp b/six/modules/c++/six/source/NITFHeaderCreator.cpp index 1b777950b3..ede76474f9 100644 --- a/six/modules/c++/six/source/NITFHeaderCreator.cpp +++ b/six/modules/c++/six/source/NITFHeaderCreator.cpp @@ -21,6 +21,9 @@ */ #include #include +#include +#include +#include #include #include @@ -50,10 +53,8 @@ void setField(const std::string& field, std::ostringstream ostr; ostr << "Tried to set field '" << field << "' to '" << value << "' but this is " << value.length() << " characters when the " - << "field can only contain " << treField.getLength() - << " characters"; - - throw except::Exception(Ctxt(ostr.str())); + << "field can only contain " << treField.getLength() << " characters"; + throw except::Exception(Ctxt(ostr)); } treField = value; @@ -243,103 +244,44 @@ void NITFHeaderCreator::setDESecurity(const six::Classification& classification, setSecurity(classification, subheader.getSecurityGroup(), "DES"); } +struct SecurityParameterSetter final +{ + const std::string& prefix; + const Options ops; + void operator()(const std::string& field, std::function getField) const + { + const auto k = NITFImageInfo::generateFieldKey(field, prefix); + if (ops.hasParameter(k)) + { + Parameter p = ops.getParameter(k); + getField().set(p.str()); + } + } + SecurityParameterSetter() = delete; + SecurityParameterSetter& operator=(const SecurityParameterSetter&) = delete; +}; + void NITFHeaderCreator::setSecurity(const six::Classification& classification, nitf::FileSecurity security, const std::string& prefix) { - std::string k; - const Options& ops = classification.fileOptions; - - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CLSY, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getClassificationSystem().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CODE, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getCodewords().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CTLH, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getControlAndHandling().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::REL, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getReleasingInstructions().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::DCTP, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getDeclassificationType().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::DCDT, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getDeclassificationDate().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::DCXM, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getDeclassificationExemption().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::DG, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getDowngrade().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::DGDT, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getDowngradeDateTime().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CLTX, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getClassificationText().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CATP, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getClassificationAuthorityType().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CAUT, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getClassificationAuthority().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CRSN, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getClassificationReason().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::SRDT, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getSecuritySourceDate().set(p.str()); - } - k = NITFImageInfo::generateFieldKey(NITFImageInfo::CTLN, prefix); - if (ops.hasParameter(k)) - { - Parameter p = ops.getParameter(k); - security.getSecurityControlNumber().set(p.str()); - } + const SecurityParameterSetter setSecurityParameter{ prefix, classification.fileOptions }; + setSecurityParameter(NITFImageInfo::CLSY, [&]() { return security.getClassificationSystem(); }); + setSecurityParameter(NITFImageInfo::CLSY, [&]() { return security.getClassificationSystem(); }); + setSecurityParameter(NITFImageInfo::CODE, [&]() { return security.getCodewords(); }); + setSecurityParameter(NITFImageInfo::CTLH, [&]() { return security.getControlAndHandling(); }); + setSecurityParameter(NITFImageInfo::REL, [&]() { return security.getReleasingInstructions(); }); + setSecurityParameter(NITFImageInfo::DCTP, [&]() { return security.getDeclassificationType(); }); + setSecurityParameter(NITFImageInfo::DCDT, [&]() { return security.getDeclassificationDate(); }); + setSecurityParameter(NITFImageInfo::DCXM, [&]() { return security.getDeclassificationExemption(); }); + setSecurityParameter(NITFImageInfo::DG, [&]() { return security.getDowngrade(); }); + setSecurityParameter(NITFImageInfo::DGDT, [&]() { return security.getDowngradeDateTime(); }); + setSecurityParameter(NITFImageInfo::CLTX, [&]() { return security.getClassificationText(); }); + setSecurityParameter(NITFImageInfo::CATP, [&]() { return security.getClassificationAuthorityType(); }); + setSecurityParameter(NITFImageInfo::CAUT, [&]() { return security.getClassificationAuthority(); }); + setSecurityParameter(NITFImageInfo::CRSN, [&]() { return security.getClassificationReason(); }); + setSecurityParameter(NITFImageInfo::SRDT, [&]() { return security.getSecuritySourceDate(); }); + setSecurityParameter(NITFImageInfo::CTLN, [&]() { return security.getSecurityControlNumber(); }); // Now, do some specific overrides if (security.getClassificationSystem().toString().empty()) @@ -793,9 +735,8 @@ void NITFHeaderCreator::initialize(std::shared_ptr container) { std::ostringstream ostr; ostr << "Row offset cannot exceed " << maxRows - << ", but for image segment " << jj << " it is " - << segmentInfo.getFirstRow(); - throw except::Exception(Ctxt(ostr.str())); + << ", but for image segment " << jj << " it is " << segmentInfo.getFirstRow(); + throw except::Exception(Ctxt(ostr)); } subheader.getImageLocation().set(generateILOC(segmentInfo.getRowOffset(), 0)); diff --git a/six/modules/c++/six/source/NITFReadControl.cpp b/six/modules/c++/six/source/NITFReadControl.cpp index d40e95cd3e..6dfb7756cc 100644 --- a/six/modules/c++/six/source/NITFReadControl.cpp +++ b/six/modules/c++/six/source/NITFReadControl.cpp @@ -237,7 +237,7 @@ void NITFReadControl::validateSegment(const nitf::ImageSubheader& subheader, { std::ostringstream ostr; ostr << "Expected [" << expectedBytesPerPixel << "] bytes per pixel, found [" << foundBytesPerPixel << "]"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } const auto numCols = info.getData()->getNumCols(); @@ -246,7 +246,7 @@ void NITFReadControl::validateSegment(const nitf::ImageSubheader& subheader, { std::ostringstream ostr; ostr << "Invalid column width: was expecting [" << numCols << "], got [" << numColsSubheader << "]"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } } @@ -538,7 +538,7 @@ class AddSecurityOption final Parameter p = parameter.toString(); const auto k = NITFImageInfo::generateFieldKey(field, prefix_); options_.setParameter(k, p); - log_.debug(Ctxt(FmtX("Added NITF security option: [%s]->[%s]", k.c_str(), + log_.debug(Ctxt(str::Format("Added NITF security option: [%s]->[%s]", k, static_cast(p)))); } }; @@ -664,10 +664,10 @@ UByte* NITFReadControl::interleaved(Region& region, size_t imageNumber) const auto extentCols = startCol + numColsReq; if (extentRows > numRowsTotal || startRow > numRowsTotal) - throw except::Exception(Ctxt(FmtX("Too many rows requested [%d]", numRowsReq))); + throw except::Exception(Ctxt(str::Format("Too many rows requested [%d]", numRowsReq))); if (extentCols > numColsTotal || startCol > numColsTotal) - throw except::Exception(Ctxt(FmtX("Too many cols requested [%d]", numColsReq))); + throw except::Exception(Ctxt(str::Format("Too many cols requested [%d]", numColsReq))); // Allocate one band uint32_t bandList(0); diff --git a/six/modules/c++/six/source/NITFWriteControl.cpp b/six/modules/c++/six/source/NITFWriteControl.cpp index aa5906229f..add7312eb3 100644 --- a/six/modules/c++/six/source/NITFWriteControl.cpp +++ b/six/modules/c++/six/source/NITFWriteControl.cpp @@ -260,7 +260,7 @@ bool NITFWriteControl::do_prepareIO(size_t imageDataSize, nitf::IOInterface& out { std::ostringstream ostr; ostr << "Require " << infos.size() << " images, received " << imageDataSize; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } nitf::Record& record = getRecord(); diff --git a/six/modules/c++/six/source/Utilities.cpp b/six/modules/c++/six/source/Utilities.cpp index 5f5cc558f3..857b01f5af 100644 --- a/six/modules/c++/six/source/Utilities.cpp +++ b/six/modules/c++/six/source/Utilities.cpp @@ -324,7 +324,7 @@ PixelType six::toType(const std::string& s) { auto p = PixelType::toType(s); if (p == PixelType::NOT_SET) - throw except::Exception(Ctxt(FmtX("Type not understood [%s]", s))); + throw except::Exception(Ctxt(str::Format("Type not understood [%s]", s))); return p; } diff --git a/six/modules/c++/six/source/VersionUpdater.cpp b/six/modules/c++/six/source/VersionUpdater.cpp index 9a672bd2e2..42a66b7db9 100644 --- a/six/modules/c++/six/source/VersionUpdater.cpp +++ b/six/modules/c++/six/source/VersionUpdater.cpp @@ -44,7 +44,7 @@ void VersionUpdater::validateTargetVersion() const { std::ostringstream msg; msg << "Unrecognized version: " << mTarget; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } const auto currentIt = std::find(mVersions.begin(), mVersions.end(), @@ -54,7 +54,7 @@ void VersionUpdater::validateTargetVersion() const std::ostringstream msg; msg << "Target version <" << mTarget << "> must be later than " << "current version <" << mData.getVersion() << ">"; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } } @@ -103,7 +103,7 @@ void VersionUpdater::emitWarning(const std::string& fieldName) } std::ostringstream msg; msg << " - " << fieldName; - mLog.warn(msg.str()); + mLog.warn(msg); addProcessingParameter(fieldName); } diff --git a/six/modules/c++/six/source/XMLControl.cpp b/six/modules/c++/six/source/XMLControl.cpp index 87f0120df7..ca359a49ee 100644 --- a/six/modules/c++/six/source/XMLControl.cpp +++ b/six/modules/c++/six/source/XMLControl.cpp @@ -137,7 +137,7 @@ static auto check_whether_paths_exist(const std::vector& { std::ostringstream msg; msg << does_not_exist_path << " does not exist!"; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } return exist_paths; } @@ -251,7 +251,7 @@ void XMLControl::validate(const xml::lite::Document* doc, oss << "Coudn't validate XML - no schemas paths provided " << " and " << six::SCHEMA_PATH << " not set."; - log->warn(oss.str()); + log->warn(oss); } std::vector schemaPaths_; @@ -275,7 +275,7 @@ void XMLControl::validate(const xml::lite::Document& doc, oss << "Coudn't validate XML - no schemas paths provided " << " and " << six::SCHEMA_PATH << " not set."; - log->warn(oss.str()); + log->warn(oss); } // validate against any specified schemas @@ -447,5 +447,5 @@ std::string six::getSchemaPath(std::vector& schemaPaths, bool tryTo } } - throw except::IOException(Ctxt(FmtX("Directory does not exist: '%s'", schemaPath))); + throw except::IOException(Ctxt(str::Format("Directory does not exist: '%s'", schemaPath))); } diff --git a/six/modules/c++/six/tests/test_determine_data_type.cpp b/six/modules/c++/six/tests/test_determine_data_type.cpp index 244a621c11..b5c6027b3f 100644 --- a/six/modules/c++/six/tests/test_determine_data_type.cpp +++ b/six/modules/c++/six/tests/test_determine_data_type.cpp @@ -46,7 +46,7 @@ void testDataType(const fs::path& pathname_, six::DataType expectedDataType) ostr << "Expected " << pathname << " to be " << expectedDataType << " but got " << dataType; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } } }