diff --git a/externals/coda-oss/modules/c++/dbi/include/dbi/DatabaseConnection.h b/externals/coda-oss/modules/c++/dbi/include/dbi/DatabaseConnection.h index 89cd8e07c..8f1562424 100644 --- a/externals/coda-oss/modules/c++/dbi/include/dbi/DatabaseConnection.h +++ b/externals/coda-oss/modules/c++/dbi/include/dbi/DatabaseConnection.h @@ -261,7 +261,7 @@ class Row std::vector< Field > mData; }; -//typedef mem::auto_ptr< Row > pRow; +//typedef std::unique_ptr< Row > pRow; /*! * \class ResultSet @@ -303,7 +303,7 @@ class ResultSet Row mCurrentRow; }; -typedef mem::auto_ptr< ResultSet > pResultSet; +typedef std::unique_ptr< ResultSet > pResultSet; /*! * \class DatabaseConnection diff --git a/externals/coda-oss/modules/c++/io/include/io/DbgStream.h b/externals/coda-oss/modules/c++/io/include/io/DbgStream.h index 85bb70252..b58210409 100644 --- a/externals/coda-oss/modules/c++/io/include/io/DbgStream.h +++ b/externals/coda-oss/modules/c++/io/include/io/DbgStream.h @@ -116,7 +116,7 @@ struct DbgStream : public OutputStream } protected: //! The bound stream - mem::auto_ptr mStream; + std::unique_ptr mStream; //! On or off?? bool mOn = false; }; diff --git a/externals/coda-oss/modules/c++/io/include/io/ProxyStreams.h b/externals/coda-oss/modules/c++/io/include/io/ProxyStreams.h index 9f578f36f..806149dde 100644 --- a/externals/coda-oss/modules/c++/io/include/io/ProxyStreams.h +++ b/externals/coda-oss/modules/c++/io/include/io/ProxyStreams.h @@ -66,7 +66,7 @@ struct CODA_OSS_API ProxyInputStream : public InputStream return mProxy->read(buffer, len); } - mem::auto_ptr mProxy; + std::unique_ptr mProxy; bool mOwnPtr; }; @@ -117,7 +117,7 @@ struct CODA_OSS_API ProxyOutputStream : public OutputStream } protected: - mem::auto_ptr mProxy; + std::unique_ptr mProxy; bool mOwnPtr = false; }; diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h index def4ae4dc..1f1e960c6 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h @@ -57,7 +57,7 @@ using path = std::filesystem::path; #else using path = coda_oss::filesystem::path; #endif -mem::auto_ptr setupLogger( +std::unique_ptr setupLogger( const path& program, const std::string& logLevel = "warning", const path& logFile = "console", diff --git a/externals/coda-oss/modules/c++/logging/include/logging/StreamHandler.h b/externals/coda-oss/modules/c++/logging/include/logging/StreamHandler.h index d6786d76a..fa66e54b5 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/StreamHandler.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/StreamHandler.h @@ -74,7 +74,7 @@ struct CODA_OSS_API StreamHandler : public Handler // used for the bulk of the logging for speed void emitRecord(const LogRecord* record) override; - mem::auto_ptr mStream; + std::unique_ptr mStream; private: bool mClosed; diff --git a/externals/coda-oss/modules/c++/logging/source/Setup.cpp b/externals/coda-oss/modules/c++/logging/source/Setup.cpp index 446be6f93..8981ebb9b 100644 --- a/externals/coda-oss/modules/c++/logging/source/Setup.cpp +++ b/externals/coda-oss/modules/c++/logging/source/Setup.cpp @@ -30,7 +30,7 @@ #include "logging/Setup.h" -mem::auto_ptr +std::unique_ptr logging::setupLogger(const path& program_, const std::string& logLevel, const path& logFile_, @@ -89,5 +89,5 @@ logging::setupLogger(const path& program_, logHandler->setFormatter(formatter.release()); log->addHandler(logHandler.release(), true); - return mem::auto_ptr(log.release()); + return std::unique_ptr(log.release()); } diff --git a/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h b/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h index a7d010c86..17b0cf678 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h @@ -26,9 +26,9 @@ #pragma once #include -#include #include "coda_oss/memory.h" +#include "mem/SharedPtr.h" namespace mem { @@ -81,6 +81,18 @@ class AutoPtr final *this = std::move(p); } + template + AutoPtr& operator=(std::auto_ptr p) noexcept + { + ptr_.reset(p.release()); + return *this; + } + template + AutoPtr(std::auto_ptr p) noexcept + { + *this = p; + } + T* get() const noexcept { @@ -106,6 +118,10 @@ class AutoPtr final { return get(); } + + operator std::unique_ptr& () { return ptr_; } + operator const std::unique_ptr& () const { return ptr_; } + }; } // namespace mem diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h b/externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h index f409f5f67..a2e30e995 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h @@ -31,7 +31,7 @@ namespace mem /*! * \class ScopedCloneablePtr * \brief This class provides RAII for object allocations via new. It is a - * light wrapper around std::auto_ptr and has the same semantics + * light wrapper around std::unique_ptr and has the same semantics * except that the copy constructor and assignment operator are deep * copies (by using T's clone() method) rather than transferring * ownership. @@ -39,7 +39,7 @@ namespace mem * This is useful for cases where you have a class which has a member * variable that's dynamically allocated and you want to provide a * valid copy constructor / assignment operator. With raw pointers or - * std::auto_ptr's, you'll have to write the copy constructor / + * std::unique_ptr's, you'll have to write the copy constructor / * assignment operator for this class - this is tedious and * error-prone since you need to include all the members in the class. * Using ScopedCloneablePtr's instead, the compiler-generated copy diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h b/externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h index bcfbb4a2c..b62108402 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h @@ -31,7 +31,7 @@ namespace mem /*! * \class ScopedCopyablePtr * \brief This class provides RAII for object allocations via new. It is a - * light wrapper around std::auto_ptr and has the same semantics + * light wrapper around std::unique_ptr and has the same semantics * except that the copy constructor and assignment operator are deep * copies (that is, they use T's copy constructor) rather than * transferring ownership. @@ -39,7 +39,7 @@ namespace mem * This is useful for cases where you have a class which has a member * variable that's dynamically allocated and you want to provide a * valid copy constructor / assignment operator. With raw pointers or - * std::auto_ptr's, you'll have to write the copy constructor / + * std::unique_ptr's, you'll have to write the copy constructor / * assignment operator for this class - this is tedious and * error-prone since you need to include all the members in the class. * Using ScopedCopyablePtr's instead, the compiler-generated copy diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ScopedPtr.h b/externals/coda-oss/modules/c++/mem/include/mem/ScopedPtr.h index 2b8b4b049..5a6e4c660 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ScopedPtr.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/ScopedPtr.h @@ -37,7 +37,7 @@ namespace mem /*! * \class ScopedPtr * \brief This class provides RAII for object allocations via new. It is a - * light wrapper around std::auto_ptr and has the same semantics + * light wrapper around std::unique_ptr and has the same semantics * except that the copy constructor and assignment operator are deep * copies (by using T's clone() method) rather than transferring * ownership. @@ -45,7 +45,7 @@ namespace mem * This is useful for cases where you have a class which has a member * variable that's dynamically allocated and you want to provide a * valid copy constructor / assignment operator. With raw pointers or - * std::auto_ptr's, you'll have to write the copy constructor / + * std::unique_ptr's, you'll have to write the copy constructor / * assignment operator for this class - this is tedious and * error-prone since you need to include all the members in the class. * Using ScopedCloneablePtr's instead, the compiler-generated copy @@ -77,12 +77,6 @@ class ScopedPtr { reset(std::move(ptr)); } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - explicit ScopedPtr(mem::auto_ptr ptr) - { - reset(ptr); - } -#endif ScopedPtr(const ScopedPtr& rhs) { @@ -161,12 +155,6 @@ class ScopedPtr { mPtr = std::move(ptr); } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - void reset(mem::auto_ptr ptr) - { - reset(std::unique_ptr(ptr.release())); - } -#endif }; } diff --git a/externals/coda-oss/modules/c++/mem/include/mem/SharedPtrCpp11.h b/externals/coda-oss/modules/c++/mem/include/mem/SharedPtrCpp11.h index af6dc52e1..867634180 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/SharedPtrCpp11.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/SharedPtrCpp11.h @@ -32,29 +32,6 @@ namespace mem { -// This won't work everywhere since C++11's std::unique_ptr<> often requires -// "&&" and std::move. But for member data and the like it can reduce some -// boiler-plate code; note that it's often possible to just use std::unique_ptr -// directly. This is mostly needed to support existing interfaces. -#if CODA_OSS_cpp17 // std::auto_ptr removed in C++17 - #if defined(CODA_OSS_no_autoptr) && (!CODA_OSS_no_autoptr) - #error "std::auto_ptr was removed in C++17." - #endif - #define CODA_OSS_autoptr_is_std 0 // mem::auto_ptr != std::auto_ptr -#else // C++11 or C++14 still have std::auto_ptr, but it's depricated - #ifdef CODA_OSS_no_autoptr // don't use std::auto_ptr even if it's available - #define CODA_OSS_autoptr_is_std 0 // mem::auto_ptr != std::auto_ptr - #else - #define CODA_OSS_autoptr_is_std 1 // mem::auto_ptr == std::auto_ptr - #endif -#endif - template using auto_ptr = -#if CODA_OSS_autoptr_is_std - std::auto_ptr; -#else - std::unique_ptr; -#endif - // Pretty much give-up on mem::SharedPtr as it's too hard to get something that will // compile with all the different compilers; let somebody else worry about that // via std::shared_ptr. The only code change is use_count() instead of getCount(), diff --git a/externals/coda-oss/modules/c++/mem/include/mem/VectorOfPointers.h b/externals/coda-oss/modules/c++/mem/include/mem/VectorOfPointers.h index c7e793c3a..d244dc153 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/VectorOfPointers.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/VectorOfPointers.h @@ -90,14 +90,6 @@ struct VectorOfPointers mValues.resize(mValues.size() + 1); mValues.back() = value.release(); } - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - template - void push_back(mem::auto_ptr value) - { - std::unique_ptr scopedValue(value.release()); - push_back(std::move(scopedValue)); - } - #endif typedef typename std::vector::iterator iterator; typedef typename std::vector::const_iterator const_iterator; @@ -199,14 +191,6 @@ template mValues.resize(mValues.size() + 1); mValues.back().reset(value.release()); } - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - template - void push_back(mem::auto_ptr value) - { - std::unique_ptr scopedValue(value.release()); - push_back(std::move(scopedValue)); - } - #endif template void push_back(std::shared_ptr value) diff --git a/externals/coda-oss/modules/c++/mt/include/mt/AbstractCPUAffinityInitializer.h b/externals/coda-oss/modules/c++/mt/include/mt/AbstractCPUAffinityInitializer.h index 677942a49..b543bb8e9 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/AbstractCPUAffinityInitializer.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/AbstractCPUAffinityInitializer.h @@ -44,9 +44,9 @@ class AbstractCPUAffinityInitializer * \returns a new thread initializer. In general, this should return * a different affinity initializer each time it is called. */ - mem::auto_ptr newThreadInitializer() + std::unique_ptr newThreadInitializer() { - return mem::auto_ptr( + return std::unique_ptr( newThreadInitializerImpl()); } diff --git a/externals/coda-oss/modules/c++/mt/include/mt/AbstractTiedThreadPool.h b/externals/coda-oss/modules/c++/mt/include/mt/AbstractTiedThreadPool.h index 8f697fd9a..a9de990bf 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/AbstractTiedThreadPool.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/AbstractTiedThreadPool.h @@ -48,10 +48,10 @@ class AbstractTiedThreadPool : public AbstractThreadPool mAffinityInit = affinityInit; } - virtual mem::auto_ptr + virtual std::unique_ptr getCPUAffinityThreadInitializer() { - mem::auto_ptr threadInit(nullptr); + std::unique_ptr threadInit(nullptr); // If we were passed a schematic // for initializing thread affinity... @@ -74,11 +74,11 @@ class AbstractTiedThreadPool : public AbstractThreadPool #if CODA_OSS_cpp17 std::unique_ptr&& init) = 0; #else - mem::auto_ptr init) = 0; + std::unique_ptr init) = 0; virtual mt::TiedWorkerThread* newTiedWorker(mt::RequestQueue* q, std::unique_ptr&& init) { - mem::auto_ptr init_(init.release()); + std::unique_ptr init_(init.release()); return newTiedWorker(q, init_); } #endif diff --git a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h index e8f428faa..cde51eb61 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h @@ -39,7 +39,7 @@ namespace mt { struct AbstractNextCPUProviderLinux { - virtual mem::auto_ptr nextCPU() = 0; + virtual std::unique_ptr nextCPU() = 0; }; /*! @@ -69,9 +69,9 @@ class CPUAffinityInitializerLinux : public AbstractCPUAffinityInitializer * \returns a new CPUAffinityInitializerLinux for the next available * CPU that can be bound to. */ - mem::auto_ptr newThreadInitializer() + std::unique_ptr newThreadInitializer() { - return mem::auto_ptr( + return std::unique_ptr( newThreadInitializerImpl()); } diff --git a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerWin32.h b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerWin32.h index 52c7ceec7..5431f5af0 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerWin32.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerWin32.h @@ -44,9 +44,9 @@ class CPUAffinityInitializerWin32 : public AbstractCPUAffinityInitializer * \todo Not yet implemented * \returns NULL */ - mem::auto_ptr newThreadInitializer() + std::unique_ptr newThreadInitializer() { - return mem::auto_ptr( + return std::unique_ptr( newThreadInitializerImpl()); } diff --git a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityThreadInitializerLinux.h b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityThreadInitializerLinux.h index d60862dbd..8fb26d8ba 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityThreadInitializerLinux.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityThreadInitializerLinux.h @@ -52,10 +52,6 @@ class CPUAffinityThreadInitializerLinux : */ CPUAffinityThreadInitializerLinux( std::unique_ptr&& cpu); -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - CPUAffinityThreadInitializerLinux( - mem::auto_ptr cpu); -#endif /*! * Attempt to bind to the affinity mask given during construction diff --git a/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h b/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h index 745aff022..dfc2b8901 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h @@ -84,9 +84,6 @@ struct CODA_OSS_API ThreadGroup * \param runnable auto_ptr to sys::Runnable */ void createThread(std::unique_ptr&& runnable); - #if CODA_OSS_autoptr_is_std - void createThread(mem::auto_ptr runnable); - #endif /*! * Waits for all threads to complete. @@ -138,7 +135,7 @@ struct CODA_OSS_API ThreadGroup * the internal CPUAffinityInitializer. If no initializer * was created, will return NULL. */ - mem::auto_ptr getNextInitializer(); + std::unique_ptr getNextInitializer(); /*! * \class ThreadGroupRunnable @@ -164,13 +161,6 @@ struct CODA_OSS_API ThreadGroup mt::ThreadGroup& parentThreadGroup, std::unique_ptr&& threadInit = std::unique_ptr(nullptr)); - #if CODA_OSS_autoptr_is_std - ThreadGroupRunnable( - mem::auto_ptr runnable, - mt::ThreadGroup& parentThreadGroup, - mem::auto_ptr threadInit = - mem::auto_ptr(nullptr)); - #endif ThreadGroupRunnable(const ThreadGroupRunnable&) = delete; ThreadGroupRunnable& operator=(const ThreadGroupRunnable&) = delete; diff --git a/externals/coda-oss/modules/c++/mt/include/mt/TiedWorkerThread.h b/externals/coda-oss/modules/c++/mt/include/mt/TiedWorkerThread.h index eb73bd111..72964722a 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/TiedWorkerThread.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/TiedWorkerThread.h @@ -49,8 +49,8 @@ class TiedWorkerThread : public mt::WorkerThread #if !CODA_OSS_cpp17 TiedWorkerThread( mt::RequestQueue* requestQueue, - mem::auto_ptr cpuAffinityInit = - mem::auto_ptr(nullptr)) : + std::unique_ptr cpuAffinityInit = + std::unique_ptr(nullptr)) : TiedWorkerThread(requestQueue, std::unique_ptr(cpuAffinityInit.release())) { } diff --git a/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp b/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp index fec4ad256..bc5cbdd8a 100644 --- a/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp +++ b/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp @@ -60,7 +60,7 @@ class AvailableCPUProvider : public AbstractNextCPUProviderLinux { } - virtual mem::auto_ptr nextCPU() + virtual std::unique_ptr nextCPU() { if (mNextCPUIndex >= mCPUs.size()) { @@ -69,9 +69,9 @@ class AvailableCPUProvider : public AbstractNextCPUProviderLinux throw except::Exception(Ctxt(msg.str())); } - mem::auto_ptr mask(new sys::ScopedCPUMaskUnix()); + std::unique_ptr mask(new sys::ScopedCPUMaskUnix()); CPU_SET_S(mCPUs.at(mNextCPUIndex++), mask->getSize(), mask->getMask()); - return mem::auto_ptr(mask.release()); + return std::unique_ptr(mask.release()); } private: @@ -87,11 +87,11 @@ class OffsetCPUProvider : public AbstractNextCPUProviderLinux { } - virtual mem::auto_ptr nextCPU() + virtual std::unique_ptr nextCPU() { - mem::auto_ptr mask(new sys::ScopedCPUMaskUnix()); + std::unique_ptr mask(new sys::ScopedCPUMaskUnix()); CPU_SET_S(mNextCPU++, mask->getSize(), mask->getMask()); - return mem::auto_ptr(mask.release()); + return std::unique_ptr(mask.release()); } private: diff --git a/externals/coda-oss/modules/c++/mt/source/CPUAffinityThreadInitializerLinux.cpp b/externals/coda-oss/modules/c++/mt/source/CPUAffinityThreadInitializerLinux.cpp index 30cc43c70..ab0db6dff 100644 --- a/externals/coda-oss/modules/c++/mt/source/CPUAffinityThreadInitializerLinux.cpp +++ b/externals/coda-oss/modules/c++/mt/source/CPUAffinityThreadInitializerLinux.cpp @@ -40,13 +40,6 @@ CPUAffinityThreadInitializerLinux::CPUAffinityThreadInitializerLinux( mCPU(std::move(cpu)) { } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 -CPUAffinityThreadInitializerLinux::CPUAffinityThreadInitializerLinux( - mem::auto_ptr cpu) : - CPUAffinityThreadInitializerLinux(std::unique_ptr(cpu.release())) -{ -} -#endif void CPUAffinityThreadInitializerLinux::initialize() { diff --git a/externals/coda-oss/modules/c++/mt/source/ThreadGroup.cpp b/externals/coda-oss/modules/c++/mt/source/ThreadGroup.cpp index d6f25c698..85bf054c5 100644 --- a/externals/coda-oss/modules/c++/mt/source/ThreadGroup.cpp +++ b/externals/coda-oss/modules/c++/mt/source/ThreadGroup.cpp @@ -71,12 +71,6 @@ void ThreadGroup::createThread(std::unique_ptr&& runnable) mThreads.push_back(thread); thread->start(); } -#if CODA_OSS_autoptr_is_std -void ThreadGroup::createThread(mem::auto_ptr runnable) -{ - createThread(std::unique_ptr(runnable.release())); -} -#endif void ThreadGroup::joinAll() { @@ -121,7 +115,7 @@ void ThreadGroup::addException(const except::Exception& ex) } } -mem::auto_ptr ThreadGroup::getNextInitializer() +std::unique_ptr ThreadGroup::getNextInitializer() { std::unique_ptr threadInit; if (mAffinityInit.get()) @@ -129,7 +123,7 @@ mem::auto_ptr ThreadGroup::getNextInitializer() threadInit = mAffinityInit->newThreadInitializer(); } - return mem::auto_ptr(threadInit.release()); + return std::unique_ptr(threadInit.release()); } ThreadGroup::ThreadGroupRunnable::ThreadGroupRunnable( @@ -141,17 +135,6 @@ ThreadGroup::ThreadGroupRunnable::ThreadGroupRunnable( mCPUInit(std::move(threadInit)) { } -#if CODA_OSS_autoptr_is_std -ThreadGroup::ThreadGroupRunnable::ThreadGroupRunnable( - mem::auto_ptr runnable, - ThreadGroup& parentThreadGroup, - mem::auto_ptr threadInit) : - ThreadGroupRunnable(std::unique_ptr(runnable.release()), - parentThreadGroup, - std::unique_ptr(threadInit.release())) -{ -} -#endif void ThreadGroup::ThreadGroupRunnable::run() { diff --git a/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnection.h b/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnection.h index 4dc34607b..b9e917835 100644 --- a/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnection.h +++ b/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnection.h @@ -69,12 +69,6 @@ class SSLConnection : public NetConnection SSL_CTX* ctx, bool serverAuth = false, const std::string& host = ""); - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - SSLConnection(mem::auto_ptr socket, - SSL_CTX * ctx, - bool serverAuth = false, - const std::string& host = ""); - #endif /*! * Destructor diff --git a/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnectionClientFactory.h b/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnectionClientFactory.h index 7bdb82f06..eb5bfb72e 100644 --- a/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnectionClientFactory.h +++ b/externals/coda-oss/modules/c++/net.ssl/include/net/ssl/SSLConnectionClientFactory.h @@ -101,9 +101,6 @@ class SSLConnectionClientFactory : public NetConnectionClientFactory * \return A new SSLConnection */ virtual NetConnection* newConnection(std::unique_ptr&& toServer); - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - virtual NetConnection* newConnection(mem::auto_ptr toServer); - #endif private: # if defined(USE_OPENSSL) diff --git a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp index 9420d7d8d..e0f37d1e7 100644 --- a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp @@ -42,15 +42,6 @@ net::ssl::SSLConnection::SSLConnection(std::unique_ptr&& socket, setupSocket(host); } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 -net::ssl::SSLConnection::SSLConnection(mem::auto_ptr socket, - SSL_CTX * ctx, - bool serverAuth, - const std::string& host) : - SSLConnection(std::unique_ptr(socket.release()), ctx, serverAuth, host) -{ -} -#endif net::ssl::SSLConnection::~SSLConnection() { diff --git a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp index 6714192d3..c3cefdd41 100644 --- a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp @@ -111,9 +111,3 @@ net::NetConnection* net::ssl::SSLConnectionClientFactory::newConnection( return (new net::NetConnection(std::move(toServer))); #endif } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 -net::NetConnection * net::ssl::SSLConnectionClientFactory::newConnection(mem::auto_ptr toServer) -{ - return newConnection(std::unique_ptr(toServer.release())); -} -#endif diff --git a/externals/coda-oss/modules/c++/net/include/net/ClientSocketFactory.h b/externals/coda-oss/modules/c++/net/include/net/ClientSocketFactory.h index fee262681..d4b59ab9a 100644 --- a/externals/coda-oss/modules/c++/net/include/net/ClientSocketFactory.h +++ b/externals/coda-oss/modules/c++/net/include/net/ClientSocketFactory.h @@ -81,9 +81,9 @@ class ClientSocketFactory * * \return A socket */ - mem::auto_ptr create(const SocketAddress& address) + std::unique_ptr create(const SocketAddress& address) { - mem::auto_ptr s(new Socket(mProto)); + std::unique_ptr s(new Socket(mProto)); setOptions(*s); diff --git a/externals/coda-oss/modules/c++/net/include/net/NetConnection.h b/externals/coda-oss/modules/c++/net/include/net/NetConnection.h index 1e10ed0dc..bf42a8a8d 100644 --- a/externals/coda-oss/modules/c++/net/include/net/NetConnection.h +++ b/externals/coda-oss/modules/c++/net/include/net/NetConnection.h @@ -64,10 +64,6 @@ class NetConnection : public io::BidirectionalStream //! we own the ptr after this transaction NetConnection(std::unique_ptr&& socket) : mSocket(socket.release()) {} - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - NetConnection(mem::auto_ptr socket) : mSocket(socket.release()) - {} - #endif /*! * Copy constructor diff --git a/externals/coda-oss/modules/c++/net/include/net/NetConnectionClientFactory.h b/externals/coda-oss/modules/c++/net/include/net/NetConnectionClientFactory.h index e70cfa0d3..791b20f7b 100644 --- a/externals/coda-oss/modules/c++/net/include/net/NetConnectionClientFactory.h +++ b/externals/coda-oss/modules/c++/net/include/net/NetConnectionClientFactory.h @@ -84,9 +84,6 @@ class NetConnectionClientFactory * */ virtual NetConnection* newConnection(std::unique_ptr&& toServer); - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - virtual NetConnection* newConnection(mem::auto_ptr toServer); - #endif /*! * Destroy a spawned connection. * \param connection The connection to destroy diff --git a/externals/coda-oss/modules/c++/net/include/net/NetConnectionServer.h b/externals/coda-oss/modules/c++/net/include/net/NetConnectionServer.h index e44dd50fb..debc58d32 100644 --- a/externals/coda-oss/modules/c++/net/include/net/NetConnectionServer.h +++ b/externals/coda-oss/modules/c++/net/include/net/NetConnectionServer.h @@ -104,9 +104,9 @@ class NetConnectionServer //! The amount of backlog int mBacklog; //! The socket we are listening on - mem::auto_ptr mSocket; + std::unique_ptr mSocket; - mem::auto_ptr mAllocStrategy; + std::unique_ptr mAllocStrategy; }; } diff --git a/externals/coda-oss/modules/c++/net/include/net/ServerSocketFactory.h b/externals/coda-oss/modules/c++/net/include/net/ServerSocketFactory.h index 166bb41e0..7b6393a0b 100644 --- a/externals/coda-oss/modules/c++/net/include/net/ServerSocketFactory.h +++ b/externals/coda-oss/modules/c++/net/include/net/ServerSocketFactory.h @@ -82,9 +82,9 @@ class ServerSocketFactory * \param address Address to establish the socket for * \return The created & bound socket */ - virtual mem::auto_ptr create(const SocketAddress& address) + virtual std::unique_ptr create(const SocketAddress& address) { - mem::auto_ptr s(new Socket(mProto)); + std::unique_ptr s(new Socket(mProto)); // Bind to this address s->bind(address); @@ -127,9 +127,9 @@ class UDPServerSocketFactory : public ServerSocketFactory * * \return The produced socket */ - virtual mem::auto_ptr create(const SocketAddress& address) + virtual std::unique_ptr create(const SocketAddress& address) { - mem::auto_ptr s(new Socket(mProto)); + std::unique_ptr s(new Socket(mProto)); // Make sure we're set up for broadcasting if necessary int on = 1; @@ -185,9 +185,9 @@ class TCPServerSocketFactory : ServerSocketFactory * listen(). * */ - virtual mem::auto_ptr create(const SocketAddress& address) + virtual std::unique_ptr create(const SocketAddress& address) { - mem::auto_ptr s(new Socket(mProto)); + std::unique_ptr s(new Socket(mProto)); // Reuse socket address (important for most TCP apps) int on = 1; diff --git a/externals/coda-oss/modules/c++/net/include/net/Socket.h b/externals/coda-oss/modules/c++/net/include/net/Socket.h index 1ce687dae..a5dea0c2b 100644 --- a/externals/coda-oss/modules/c++/net/include/net/Socket.h +++ b/externals/coda-oss/modules/c++/net/include/net/Socket.h @@ -248,7 +248,7 @@ class Socket * \param fromClient Client socket address returned * \return A new socket connection to the client */ - mem::auto_ptr accept(SocketAddress& fromClient); + std::unique_ptr accept(SocketAddress& fromClient); net::Socket_T getHandle() const { diff --git a/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp b/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp index d6392a66b..7ae294eda 100644 --- a/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp +++ b/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp @@ -65,9 +65,9 @@ net::NetConnection* net::NetConnectionClientFactory::newConnection( { return new net::NetConnection(std::move(toServer)); } -#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 +#if CODA_OSS_autoptr_is_std // std::unique_ptr removed in C++17 net::NetConnection* net::NetConnectionClientFactory::newConnection( - mem::auto_ptr toServer) + std::unique_ptr toServer) { return new net::NetConnection(toServer); } diff --git a/externals/coda-oss/modules/c++/net/source/Socket.cpp b/externals/coda-oss/modules/c++/net/source/Socket.cpp index 726f47df9..9c0c791b9 100644 --- a/externals/coda-oss/modules/c++/net/source/Socket.cpp +++ b/externals/coda-oss/modules/c++/net/source/Socket.cpp @@ -70,12 +70,12 @@ void net::Socket::bind(const net::SocketAddress& address) } } -mem::auto_ptr net::Socket::accept(net::SocketAddress& fromClient) +std::unique_ptr net::Socket::accept(net::SocketAddress& fromClient) { net::SockAddrIn_T& in = fromClient.getAddress(); net::SockLen_T addrLen = sizeof(in); - return mem::auto_ptr(new Socket(::accept(mNative, (net::SockAddr_T *) &in, &addrLen), true)); + return std::unique_ptr(new Socket(::accept(mNative, (net::SockAddr_T *) &in, &addrLen), true)); } size_t net::Socket::recv(void* b, size_t len, int flags) diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h index 3b8ec4611..a674a4f60 100644 --- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h +++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h @@ -105,7 +105,7 @@ struct FileWriter protected: std::string mFileName; - mem::auto_ptr mStream; + std::unique_ptr mStream; bool mAdopt; }; diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/IFDEntry.h b/externals/coda-oss/modules/c++/tiff/include/tiff/IFDEntry.h index 0ca8ccb3f..31ecedddb 100644 --- a/externals/coda-oss/modules/c++/tiff/include/tiff/IFDEntry.h +++ b/externals/coda-oss/modules/c++/tiff/include/tiff/IFDEntry.h @@ -268,12 +268,6 @@ class IFDEntry : public io::Serializable ++mCount; value.release(); } - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - void addValue(mem::auto_ptr value) - { - addValue(std::unique_ptr(value.release())); - } - #endif /** ***************************************************************** * Adds a double value to the IFD entry. diff --git a/externals/coda-oss/modules/c++/types/include/types/RgAz.h b/externals/coda-oss/modules/c++/types/include/types/RgAz.h index 749e54cdf..eed26b92c 100644 --- a/externals/coda-oss/modules/c++/types/include/types/RgAz.h +++ b/externals/coda-oss/modules/c++/types/include/types/RgAz.h @@ -57,7 +57,8 @@ template class RgAz T az{}; RgAz() = default; - RgAz(T r, T c) noexcept : rg(r), az(c) { } + RgAz(const T& r, const T& c) noexcept : rg(r), az(c) { } + RgAz(T&& r, T&& c) noexcept : rg(std::move(r)), az(std::move(c)) { } template RgAz(const RgAz& p) { diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h index b9efc192f..f0708af48 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h @@ -413,9 +413,6 @@ struct Element // SOAPElement derives :-( #ifndef SWIG // SWIG doesn't like std::unique_ptr virtual Element& addChild(std::unique_ptr&& node); #endif // SWIG - #if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17 - virtual Element& addChild(mem::auto_ptr node); - #endif /*! * Returns all of the children of this element diff --git a/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp b/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp index 21191fafe..b46711ecf 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp @@ -343,12 +343,6 @@ xml::lite::Element& xml::lite::Element::addChild(std::unique_ptr node) -{ - return addChild(std::unique_ptr(node.release())); -} -#endif void xml::lite::Element::changePrefix(Element* element, const std::string& prefix, const std::string& uri)