Skip to content

Commit

Permalink
latest from coda-oss and nitro
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Apr 19, 2022
1 parent da97e71 commit 845f0c2
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ void runWorkSharingBalanced1D(size_t numElements,
{
threadPoolEndElements.push_back(numElements);

threadPoolCounters.push_back(
std::shared_ptr<sys::AtomicCounter>(
new sys::AtomicCounter(0)));
threadPoolCounters.push_back(std::make_shared<sys::AtomicCounter>(0));

const types::Range range(0, numElements);
WorkSharingBalancedRunnable1D<OpT>(range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class EncodedString final
return s_;
}

// No "public" operator=() for these; this class is mostly for storage and/or conversion,
// not extensive manipulation. Create a new instance and assign/move that.
void assign(coda_oss::u8string::const_pointer);
void assign(str::W1252string::const_pointer);
void assign(std::string::const_pointer);
Expand Down
8 changes: 7 additions & 1 deletion externals/coda-oss/modules/c++/str/include/str/Manip.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@

namespace str
{
// non-const overload for .data() in C++17

CODA_OSS_disable_warning_push
#if _MSC_VER
#pragma warning(disable: 26460) //The reference argument 's' for function 'str::data<char>' can be marked as const (con.3).
#endif
// non-const overload for .data() in C++17
template<typename CharT>
inline CharT* data(std::basic_string<CharT>& s) noexcept
{
Expand All @@ -50,6 +55,7 @@ inline CharT* data(std::basic_string<CharT>& s) noexcept
CODA_OSS_disable_warning_pop
#endif // CODA_OSS_cpp17
}
CODA_OSS_disable_warning_pop
template <typename CharT>
inline const CharT* data(const std::basic_string<CharT>& s) noexcept // to make generic programming easier
{
Expand Down
5 changes: 5 additions & 0 deletions externals/coda-oss/modules/c++/str/source/EncodedString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ str::EncodedString& str::EncodedString::operator=(const EncodedString& es)
}
return *this;
}
str::EncodedString::EncodedString(const EncodedString& es)
{
*this = es;
}

str::EncodedString& str::EncodedString::operator=(EncodedString&& es) noexcept
{
if (this != &es)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,29 @@ TEST_CASE(test_EncodedString)
{
str::EncodedString es;
TEST_ASSERT_TRUE(es.native().empty());
es = str::EncodedString("abc");
{
str::EncodedString es_copy(es); // copy
TEST_ASSERT_TRUE(es_copy.native().empty());
}
es = str::EncodedString("abc"); // assignment
TEST_ASSERT_EQ(es.native(), "abc");
{
str::EncodedString es_copy(es); // copy, again; this time w/o default content
TEST_ASSERT_EQ(es_copy.native(), "abc");
}

str::EncodedString abc(es); // copy, for use below
TEST_ASSERT_EQ(abc.native(), "abc");

str::EncodedString es2;
es = std::move(es2); // move assignment
TEST_ASSERT_TRUE(es.native().empty());
str::EncodedString abc_(abc); // copy
es = std::move(abc_); // move assignment, w/o default content
TEST_ASSERT_EQ(es.native(), "abc");

str::EncodedString es3(std::move(abc)); // move constructor
TEST_ASSERT_EQ(es3.native(), "abc");
}

int main(int, char**)
Expand Down
20 changes: 12 additions & 8 deletions externals/nitro/modules/c++/nitf/include/nitf/exports.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@
#define NITRO_nitf_exports_hpp_INCLUDED_
#pragma once

// Use Windows naming conventions (DLL, LIB) because this really only matters
// for _MSC_VER, see below.
// Need to specify how this module will be consumed, either NITRO_NITFCPP_LIB (static library)
// or NITRO_NITFCPP_DLL (aka "shared" library).
//
// Use Windows naming conventions (DLL, LIB) because this really only matters for _MSC_VER, see below.
#if !defined(NITRO_NITFCPP_LIB) && !defined(NITRO_NITFCPP_DLL)
// Building a static library (not a DLL) is the default.
#define NITRO_NITFCPP_LIB 1
//#define NITRO_NITFCPP_DLL 1
#endif
#if !defined(NITRO_NITFCPP_DLL)
#if defined(NITRO_NITFCPP_EXPORTS) && defined(NITRO_NITFCPP_LIB)
#if defined(NITRO_NITFCPP_EXPORTS)
#if defined(NITRO_NITFCPP_LIB)
#error "Can't export from a LIB'"
#endif

#if !defined(NITRO_NITFCPP_LIB)
#if !defined(NITRO_NITFCPP_DLL)
#define NITRO_NITFCPP_DLL 1
#endif
#endif
#if defined(NITRO_NITFCPP_LIB) && defined(NITRO_NITFCPP_DLL)
#error "Both NITRO_NITFCPP_LIB and NITRO_NITFCPP_DLL are #define'd'"
#endif

// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the NITRO_NITFCPP_EXPORTS
Expand All @@ -25,11 +30,10 @@
// NITRO_NITFCPP_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
// https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html
#if NITRO_NITFCPP_EXPORTS
#ifdef NITRO_NITFCPP_EXPORTS
#if defined(__GNUC__) // && HAVE_VISIBILITY
#define NITRO_NITFCPP_API __attribute__((visibility("default")))
#elif defined(_MSC_VER) // && (defined(_WINDLL) && !defined(_LIB))
// Visual Studio projects define _WINDLL or _LIB, but not the compiler
#define NITRO_NITFCPP_API __declspec(dllexport)
#else
// https://stackoverflow.com/a/2164853/8877
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
// actually hook this up. But it's kind of neat code that I don't want to lose.
struct /*namespace*/ TREs
{
class NITRO_NITFCPP_API ENGRDA final
class ENGRDA final
{
nitf::TRE tre_;

Expand Down

0 comments on commit 845f0c2

Please sign in to comment.