Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from 9618cb382..c899f14ad
Browse files Browse the repository at this point in the history
c899f14ad Merge branch 'main' into cpp17
a37046807 latest from CODA-OSS (#596)
50c75444b Merge commit 'f9ff61eb905ed2119f4f908c568b577643cf42f8' into cpp17
f9ff61eb9 Squashed 'externals/coda-oss/' changes from 8b21c3828b..5015192abb
d37a0d078 latest from CODA-OSS
c2372d744 Merge branch 'main' into cpp17
205bf8e36 infrastructure for "preloading" TREs (#593)
0342b596a latest from CODA-OSS (#592)
0084f9bf7 reduce use of .str() (#591)

git-subtree-dir: externals/nitro
git-subtree-split: c899f14adef57a06d8baf6f9c72fa83a8e36247f
  • Loading branch information
Dan Smith committed Nov 13, 2023
1 parent 8420775 commit b60fb0a
Show file tree
Hide file tree
Showing 294 changed files with 7,453 additions and 3,436 deletions.
30 changes: 0 additions & 30 deletions UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -262,39 +262,9 @@
<ProjectReference Include="..\modules\c\nitf-c.vcxproj">
<Project>{f06550ad-cfc7-40b8-8727-6c82c69a8982}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\ACCHZB.vcxproj">
<Project>{53f9f908-c678-4dee-9309-e71c1d03a45f}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\ACCPOB.vcxproj">
<Project>{730b1e6e-2469-4f9e-b093-d0c6262453c9}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\ACFTA.vcxproj">
<Project>{51d7b426-899e-428d-9f69-5ddac9e403fb}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\AIMIDB.vcxproj">
<Project>{12aa0752-4ee3-4e0a-85af-0e5deadbf343}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\CSCRNA.vcxproj">
<Project>{023de06d-3967-4406-b1b8-032118bb2552}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\CSEXRB.vcxproj">
<Project>{0a9bda26-092f-4a2c-bbef-00c64bf0c65e}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\ENGRDA.vcxproj">
<Project>{53f9f908-c678-4dee-9309-e71c1e03a45f}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\HISTOA.vcxproj">
<Project>{d749aa73-4c9a-473d-96bb-070a6d9caa54}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\JITCID.vcxproj">
<Project>{d1d7fcd3-6130-4504-9da0-9d80506be55e}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\PTPRAA.vcxproj">
<Project>{2baaaca9-a5a4-412c-ae52-b16c2d107f55}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\RPFHDR.vcxproj">
<Project>{cf5b4f02-364d-4117-9fb9-6c9c7938e412}</Project>
</ProjectReference>
<ProjectReference Include="..\modules\c\nitf\XML_DATA_CONTENT.vcxproj">
<Project>{78849481-d356-4cc7-b182-31c21f857ed1}</Project>
</ProjectReference>
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/.github/workflows/build_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
os: [windows-latest]
platform: [x64]
configuration: [Debug] # Debug turns on more compiler warnings
avx: [AVX2, AVX512F]
avx: [AVX512F]
name: ${{ matrix.os }}-${{ matrix.avx }}-msbuild
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
matrix:
os: [ubuntu-latest]
configuration: [Debug, Release]
avx: [AVX2, AVX512F]
avx: [AVX512F]
name: ${{ matrix.os }}-${{ matrix.configuration }}-${{ matrix.avx }}-CMake
runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 3 additions & 0 deletions externals/coda-oss/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# coda-oss Release Notes

## [Release 202?-??-??](https://github.com/mdaus/coda-oss/releases/tag/202?-??-??)
* Update to [HighFive 2.8.0](https://github.com/BlueBrain/HighFive/releases/tag/v2.8.0).

## [Release 2023-10-23](https://github.com/mdaus/coda-oss/releases/tag/2023-10-23)
* Tweaked **.gitattributes**.
* Removed *str::EncodedStringView*; made *str* conversion routines more consistent.
Expand Down
7 changes: 7 additions & 0 deletions externals/coda-oss/cmake/CodaBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ macro(coda_initialize_build)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Turn on AVX2 by default ... it's from 2013.
if (NOT ENABLE_AVX512F)
if (NOT DISABLE_AVX2)
set(ENABLE_AVX2 true)
endif()
endif()

# MSVC-specific flags and options.
if (MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ std::unique_ptr<cli::Results> cli::ArgumentParser::parse(const std::string& prog
case cli::SUB_OPTIONS:
{
if (optionsStr.empty())
parseError(str::Format("invalid sub option: [%s]", argVar.c_str()));
parseError(str::Format("invalid sub option: [%s]", argVar));

auto v_ = std::make_unique<cli::Value>();
auto v = currentResults->hasValue(optionsStr) ? currentResults->getValue(optionsStr) : v_.get();
Expand Down Expand Up @@ -706,7 +706,7 @@ std::unique_ptr<cli::Results> cli::ArgumentParser::parse(const std::string& prog
}
if (!isValid)
{
parseError(str::Format("invalid option for [%s]", argVar.c_str()));
parseError(str::Format("invalid option for [%s]", argVar));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/modules/c++/cli/unittests/test_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST_CASE(testValue)
for(int i = 0; i < 10; ++i)
{
floats.push_back(10.0f * i);
strings.push_back(str::toString(i));
strings.push_back(std::to_string(i));
}

// floats
Expand All @@ -60,7 +60,7 @@ TEST_CASE(testValue)
v.setContainer(strings);
for(int i = 0; i < 10; ++i)
{
TEST_ASSERT_EQ(v.at<std::string>(i), str::toString(i));
TEST_ASSERT_EQ(v.at<std::string>(i), std::to_string(i));
}
TEST_ASSERT_EQ(std::ssize(v), 10);
}
Expand Down
16 changes: 8 additions & 8 deletions externals/coda-oss/modules/c++/except/include/except/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*
*/


#pragma once
#ifndef CODA_OSS_except_Context_h_INCLUDED_
#define CODA_OSS_except_Context_h_INCLUDED_
#pragma once

#include <string>
#include <ostream>
#include <sstream>

#include "config/Exports.h"
#include "config/disable_compiler_warnings.h"
Expand Down Expand Up @@ -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 = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void BufferViewStream<T>::write(const void* buffer, size_t numBytes)
{
std::ostringstream msg;
msg << "Write of size " << numBytes << " runs out of bounds.";
throw except::Exception(Ctxt(msg.str()));
throw except::Exception(Ctxt(msg));
}

::memcpy(mBufferView.data + mPosition, buffer, numBytes);
Expand Down
2 changes: 1 addition & 1 deletion externals/coda-oss/modules/c++/io/include/io/FileUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ inline void move(const std::string& path,
oss << "Move Failed: Could not move source [" <<
path << "] to destination [" <<
newPath << "]";
throw except::Exception(Ctxt(oss.str()));
throw except::Exception(Ctxt(oss));
}
}

Expand Down
7 changes: 3 additions & 4 deletions externals/coda-oss/modules/c++/io/source/FileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void io::copy(const std::string& path,
oss << "Copy Failed: Could not copy source [" <<
path << "] to destination [" <<
newFile << "]";
throw except::Exception(Ctxt(oss.str()));
throw except::Exception(Ctxt(oss));
}
}
}
Expand All @@ -133,8 +133,7 @@ std::string io::FileUtils::createFile(std::string dirname,
sys::OS os;

if (!os.exists(dirname))
throw except::IOException(Ctxt(str::Format("Directory does not exist: %s",
dirname.c_str())));
throw except::IOException(Ctxt(str::Format("Directory does not exist: %s", dirname)));

str::trim(filename);

Expand All @@ -155,7 +154,7 @@ std::string io::FileUtils::createFile(std::string dirname,
int count = 0;
while (os.exists(outFilename))
{
std::string base = filename + "-" + str::toString(++count);
std::string base = filename + "-" + std::to_string(++count);
outFilename = sys::Path::joinPaths(dirname, base);
if (!ext.empty())
{
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/modules/c++/io/source/InputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ sys::SSize_T InputStream::read(void* buffer,
{
std::ostringstream ostr;
ostr << "Tried to read " << len << " bytes but read failed";
throw except::IOException(Ctxt(ostr.str()));
throw except::IOException(Ctxt(ostr));
}
else if (numBytes != static_cast<sys::SSize_T>(len))
{
std::ostringstream ostr;
ostr << "Tried to read " << len << " bytes but only read "
<< numBytes << " bytes";
throw except::IOException(Ctxt(ostr.str()));
throw except::IOException(Ctxt(ostr));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void io::MMapInputStream::open(const std::string& fname, char* flags)
// std::cout << mLength << std::endl;
mFile = fopen(fname.c_str(), "r");
if (!mFile)
throw sys::SystemException(str::Format("Failure while opening file: %s", fname.c_str()));
throw sys::SystemException(str::Format("Failure while opening file: %s", fname));

_map();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ StreamSplitter::StreamSplitter(io::InputStream& inputStream,
std::ostringstream os;
os << "bufferSize must be >= twice the delimiter size + 1 byte. "
<< "Normally it should be much larger for good performance.";
throw except::InvalidArgumentException(Ctxt(os.str()));
throw except::InvalidArgumentException(Ctxt(os));
}
}

Expand Down
6 changes: 3 additions & 3 deletions externals/coda-oss/modules/c++/io/tests/serializeTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class A : public Serializable
string vec_2 = fillString(is);

assert(classType == "Class A");
dbg.writeln(str::Format("vec[0] = %s", vec_0.c_str()));
dbg.writeln(str::Format("vec[1] = %s", vec_1.c_str()));
dbg.writeln(str::Format("vec[2] = %s", vec_2.c_str()));
dbg.writeln(str::Format("vec[0] = %s", vec_0));
dbg.writeln(str::Format("vec[1] = %s", vec_1));
dbg.writeln(str::Format("vec[2] = %s", vec_2));

vec[0] = str::toType<float>(vec_0);
vec[1] = str::toType<float>(vec_1);
Expand Down
4 changes: 2 additions & 2 deletions externals/coda-oss/modules/c++/io/unittests/test_streams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ TEST_CASE(testRotate)

for(size_t i = 0; i < maxFiles - 1; ++i)
{
std::string fname = outFile + "." + str::toString(i + 1);
std::string next = outFile + "." + str::toString(i + 2);
std::string fname = outFile + "." + std::to_string(i + 1);
std::string next = outFile + "." + std::to_string(i + 2);

TEST_ASSERT(os.isFile(fname));
TEST_ASSERT_FALSE(os.isFile(next));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct LogLevel final
else if (s == "SEVERE")
value = LOG_CRITICAL;
else
throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %s", s.c_str())));
throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %s", s)));
}

//! int constructor
Expand Down
13 changes: 13 additions & 0 deletions externals/coda-oss/modules/c++/logging/include/logging/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
// Logger.h
///////////////////////////////////////////////////////////

#pragma once
#ifndef CODA_OSS_logging_Logger_h_INCLUDED_
#define CODA_OSS_logging_Logger_h_INCLUDED_

#include <string>
#include <vector>
#include <memory>
#include <sstream>

#include "config/Exports.h"
#include "logging/Filterer.h"
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions externals/coda-oss/modules/c++/logging/source/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ void StandardFormatter::format(const LogRecord* record, io::OutputStream& os) co
// populate log
long threadId = sys::getThreadID();
std::string format = mFmt;
str::replace(format, THREAD_ID, str::toString(threadId));
str::replace(format, THREAD_ID, std::to_string(threadId));
str::replace(format, LOG_NAME, name);
str::replace(format, LOG_LEVEL, record->getLevelName());
str::replace(format, TIMESTAMP, record->getTimeStamp());
if (record->getLineNum() >= 0)
{
str::replace(format, FILE_NAME, record->getFile());
str::replace(format, LINE_NUM,
str::toString(record->getLineNum()));
str::replace(format, LINE_NUM, std::to_string(record->getLineNum()));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void logging::XMLFormatter::format(const logging::LogRecord* record, io::OutputS
// conver record
std::string name = (record->getName().empty()) ?
("DEFAULT") : record->getName();
std::string line = str::toString(record->getLineNum());
std::string threadID = str::toString(sys::getThreadID());
const auto line = std::to_string(record->getLineNum());
const auto threadID = std::to_string(sys::getThreadID());

// populate vector with record
std::vector<std::string> logRecord;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ class Eigenvalue
if (A.rows() != A.cols())
{
throw except::Exception(Ctxt(
"Expected square matrix but got rows = " +
str::toString(A.rows()) + ", cols = " +
str::toString(A.cols())));
"Expected square matrix but got rows = " + std::to_string(A.rows()) + ", cols = " + std::to_string(A.cols())));
}

if (isSymmetric(A))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ template<typename Vector_T> OneD<double> fit(const Vector_T& x,
<< sizeX << " points for an order-" << order
<< "fit)! You should really have at least (order+1) = "
<< (order+1) << " points for this to do what you expect.";
throw except::Exception(Ctxt(excSS.str()));
throw except::Exception(Ctxt(excSS));
}

// Compute mean value
Expand Down Expand Up @@ -206,7 +206,7 @@ inline math::poly::TwoD<double> fit(const math::linear::Matrix2D<double>& x,
<< x.size() << " points for a " << acols << "-coefficient fit)!"
<< " You should really have at least (orderX+1)*(orderY+1) = "
<< acols << " points for this to do what you expect.";
throw except::Exception(Ctxt(excSS.str()));
throw except::Exception(Ctxt(excSS));
}


Expand Down
Loading

0 comments on commit b60fb0a

Please sign in to comment.