Skip to content

Commit

Permalink
coda-oss 2021-12-13 and nitro 2.10.7 (#514)
Browse files Browse the repository at this point in the history
* latest from coda-oss

* xml.lite changes from coda-oss

* need updates to Python bindings too

* trying to fine the right macro for SWIG

* more xml.lite updates from coda-oss

* "private" is part of name mangling

* test_xmlParser might be be running in coda-oss

* xml.lite tweaks from coda-oss

* coda-oss release 2021-12-13

* nitro release 2.10.7
  • Loading branch information
J. Daniel Smith authored Dec 13, 2021
1 parent 1e9c2cc commit ef191da
Show file tree
Hide file tree
Showing 36 changed files with 989 additions and 460 deletions.
2 changes: 2 additions & 0 deletions externals/coda-oss/cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ These options may be passed in the cmake configure step as `-DOPTION_NAME="optio
|BUILD_SHARED_LIBS|OFF|build shared libraries if on, static if off (note: not working on Windows)|
|STATIC_CRT|OFF|for Windows MSVC builds only, link with /MT (or /MTd for Debug builds) if on, or with /MD (or /MDd for Debug builds) if off|
|CODA_BUILD_TESTS| ON |build tests if on|
|CODA_INSTALL_TESTS| ON |install tests if on|
|CODA_PARTIAL_INSTALL|OFF|make the install target not depend on all defined targets, only the targets which have already been built will be installed; cmake/CodaBuild.cmake for further information and caveats|
|MT_DEFAULT_PINNING|OFF|use affinity-based CPU pinning by default in MT|
|ENABLE_BOOST|OFF|build modules dependent on Boost if enabled|
|ENABLE_PYTHON|ON|build Python modules if enabled|
|ENABLE_SWIG|OFF|enable SWIG bindings generation if enabled, otherwise use previously-generated files|
|ENABLE_JARS|ON|include jars with the install|
|ENABLE_JPEG|ON|build libjpeg driver and modules depending on it|
|ENABLE_J2K|ON|build openjpeg (jpeg2000) driver and modules depending on it|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ static_assert(CODA_OSS_MAKE_VERSION_MMPB(9999, 9999, 9999, 9999) <= UINT64_MAX,

// Do this ala C++ ... we don't currently have major/minor/patch
//#define CODA_OSS_VERSION_ 20210910L // c.f. __cplusplus
#define CODA_OSS_VERSION_ 2021 ## 0011 ## 0001 ## 0000 ## L
#define CODA_OSS_VERSION_ 2021 ## 0012 ## 0013 ## 0000 ## L

// Use the same macros other projects might want to use; overkill for us.
#define CODA_OSS_VERSION_MAJOR 2021
#define CODA_OSS_VERSION_MINOR 11
#define CODA_OSS_VERSION_PATCH 1
#define CODA_OSS_VERSION_MINOR 12
#define CODA_OSS_VERSION_PATCH 13
#define CODA_OSS_VERSION_BUILD 0
#define CODA_OSS_VERSION CODA_OSS_MAKE_VERSION_MMPB(CODA_OSS_VERSION_MAJOR, CODA_OSS_VERSION_MINOR, CODA_OSS_VERSION_PATCH, CODA_OSS_VERSION_BUILD)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <vector>
#include <sstream>
#include <exception>
#include <stdexcept>
#include <numeric> // std::accumulate
#include <memory>

Expand Down
115 changes: 6 additions & 109 deletions externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
*
*/

#ifndef __MEM_SCOPED_CLONEABLE_PTR_H__
#define __MEM_SCOPED_CLONEABLE_PTR_H__
#ifndef CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_
#define CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_
#pragma once

#include <memory>
#include <cstddef>

#include "sys/Conf.h"
#include "mem/ScopedPtr.h"

namespace mem
{
Expand All @@ -50,108 +47,8 @@ namespace mem
* (if all the other member variables are POD or have correct
* copy constructors / assignment operators).
*/
template <class T>
class ScopedCloneablePtr
{
std::unique_ptr<T> mPtr;

public:
explicit ScopedCloneablePtr(T* ptr = nullptr)
{
reset(ptr);
}

explicit ScopedCloneablePtr(std::unique_ptr<T>&& ptr)
{
reset(std::move(ptr));
}
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
explicit ScopedCloneablePtr(mem::auto_ptr<T> ptr)
{
reset(ptr);
}
#endif

ScopedCloneablePtr(const ScopedCloneablePtr& rhs)
{
*this = rhs;
}

const ScopedCloneablePtr&
operator=(const ScopedCloneablePtr& rhs)
{
if (this != &rhs)
{
auto rhs_ptr = rhs.get();
if (rhs_ptr != nullptr)
{
reset(rhs_ptr->clone());
}
else
{
reset();
}
}

return *this;
}

ScopedCloneablePtr(ScopedCloneablePtr&&) = default;
ScopedCloneablePtr& operator=(ScopedCloneablePtr&&) = default;

bool operator==(const ScopedCloneablePtr<T>& rhs) const
{
auto ptr = get();
auto rhs_ptr = rhs.get();
if (ptr == nullptr && rhs_ptr == nullptr)
{
return true;
}

if (ptr == nullptr || rhs_ptr == nullptr)
{
return false;
}

return *ptr == *rhs_ptr;
}

bool operator!=(const ScopedCloneablePtr<T>& rhs) const
{
return !(*this == rhs);
}

T* get() const
{
return mPtr.get();
}

T& operator*() const
{
return *get();
}

T* operator->() const
{
return get();
}

void reset(T* ptr = nullptr)
{
mPtr.reset(ptr);
}

void reset(std::unique_ptr<T>&& ptr)
{
mPtr = std::move(ptr);
}
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
void reset(mem::auto_ptr<T> ptr)
{
reset(std::unique_ptr<T>(ptr.release()));
}
#endif
};
template <typename T>
using ScopedCloneablePtr = ScopedPtr<T, std::true_type /*CopyIsClone*/>;
}

#endif
#endif // CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_
121 changes: 6 additions & 115 deletions externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@
*
*/

#ifndef __MEM_SCOPED_COPYABLE_PTR_H__
#define __MEM_SCOPED_COPYABLE_PTR_H__
#ifndef CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_
#define CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_
#pragma once

#include <memory>
#include <cstddef>
#include <config/coda_oss_config.h>

#include "sys/Conf.h"
#include "mem/SharedPtr.h"
#include "mem/ScopedPtr.h"

namespace mem
{
Expand All @@ -52,113 +47,9 @@ namespace mem
* (if all the other member variables are POD or have correct
* copy constructors / assignment operators).
*/
template <class T>
class ScopedCopyablePtr
{
std::unique_ptr<T> mPtr;

public:
explicit ScopedCopyablePtr(T* ptr = nullptr)
{
reset(ptr);
}
explicit ScopedCopyablePtr(std::unique_ptr<T>&& ptr)
{
reset(std::move(ptr));
}
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
explicit ScopedCopyablePtr(mem::auto_ptr<T> ptr)
{
reset(ptr);
}
#endif

ScopedCopyablePtr(const ScopedCopyablePtr& rhs)
{
*this = rhs;
}

const ScopedCopyablePtr&
operator=(const ScopedCopyablePtr& rhs)
{
if (this != &rhs)
{
auto rhs_ptr = rhs.get();
if (rhs_ptr != nullptr)
{
reset(make::unique<T>(*rhs_ptr));
}
else
{
reset();
}
}

return *this;
}

ScopedCopyablePtr(ScopedCopyablePtr&&) = default;
ScopedCopyablePtr& operator=(ScopedCopyablePtr&&) = default;

bool operator==(const ScopedCopyablePtr<T>& rhs) const
{
auto ptr = get();
auto rhs_ptr = rhs.get();
if (ptr == nullptr && rhs_ptr == nullptr)
{
return true;
}

if (ptr == nullptr || rhs_ptr == nullptr)
{
return false;
}

return *ptr == *rhs_ptr;
}

bool operator!=(const ScopedCopyablePtr<T>& rhs) const
{
return !(*this == rhs);
}

// explicit operators not supported until C++11
explicit operator bool() const
{
return get() == nullptr ? false : true;
}

T* get() const
{
return mPtr.get();
}

T& operator*() const
{
return *get();
}

T* operator->() const
{
return get();
}

void reset(T* ptr = nullptr)
{
mPtr.reset(ptr);
}
template <typename T>
using ScopedCopyablePtr = ScopedPtr<T, std::false_type /*CopyIsClone*/>;

void reset(std::unique_ptr<T>&& ptr)
{
mPtr = std::move(ptr);
}
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
void reset(mem::auto_ptr<T> ptr)
{
reset(std::unique_ptr<T>(ptr.release()));
}
#endif
};
}

#endif
#endif // CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_
Loading

0 comments on commit ef191da

Please sign in to comment.