Skip to content

Commit e621466

Browse files
Dan SmithDan Smith
authored andcommitted
merge in develop/8AMPI_PHSI
1 parent 1e9c2cc commit e621466

7 files changed

Lines changed: 414 additions & 226 deletions

File tree

Test/six.sicd_test_AMP8I_PHS8I.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
#include "sicd_Test.h"
44

5-
#define TEST_CASE(X) TEST(sicd_test_valid_six, X)
5+
#define TEST_CASE(X) TEST(sicd_test_AMP8I_PHS8I, X)
66
#include "six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp"

externals/coda-oss/modules/c++/mem/include/mem/ScopedCloneablePtr.h

Lines changed: 6 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
*
2121
*/
2222

23-
#ifndef __MEM_SCOPED_CLONEABLE_PTR_H__
24-
#define __MEM_SCOPED_CLONEABLE_PTR_H__
23+
#ifndef CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_
24+
#define CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_
2525
#pragma once
2626

27-
#include <memory>
28-
#include <cstddef>
29-
30-
#include "sys/Conf.h"
27+
#include "mem/ScopedPtr.h"
3128

3229
namespace mem
3330
{
@@ -50,108 +47,8 @@ namespace mem
5047
* (if all the other member variables are POD or have correct
5148
* copy constructors / assignment operators).
5249
*/
53-
template <class T>
54-
class ScopedCloneablePtr
55-
{
56-
std::unique_ptr<T> mPtr;
57-
58-
public:
59-
explicit ScopedCloneablePtr(T* ptr = nullptr)
60-
{
61-
reset(ptr);
62-
}
63-
64-
explicit ScopedCloneablePtr(std::unique_ptr<T>&& ptr)
65-
{
66-
reset(std::move(ptr));
67-
}
68-
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
69-
explicit ScopedCloneablePtr(mem::auto_ptr<T> ptr)
70-
{
71-
reset(ptr);
72-
}
73-
#endif
74-
75-
ScopedCloneablePtr(const ScopedCloneablePtr& rhs)
76-
{
77-
*this = rhs;
78-
}
79-
80-
const ScopedCloneablePtr&
81-
operator=(const ScopedCloneablePtr& rhs)
82-
{
83-
if (this != &rhs)
84-
{
85-
auto rhs_ptr = rhs.get();
86-
if (rhs_ptr != nullptr)
87-
{
88-
reset(rhs_ptr->clone());
89-
}
90-
else
91-
{
92-
reset();
93-
}
94-
}
95-
96-
return *this;
97-
}
98-
99-
ScopedCloneablePtr(ScopedCloneablePtr&&) = default;
100-
ScopedCloneablePtr& operator=(ScopedCloneablePtr&&) = default;
101-
102-
bool operator==(const ScopedCloneablePtr<T>& rhs) const
103-
{
104-
auto ptr = get();
105-
auto rhs_ptr = rhs.get();
106-
if (ptr == nullptr && rhs_ptr == nullptr)
107-
{
108-
return true;
109-
}
110-
111-
if (ptr == nullptr || rhs_ptr == nullptr)
112-
{
113-
return false;
114-
}
115-
116-
return *ptr == *rhs_ptr;
117-
}
118-
119-
bool operator!=(const ScopedCloneablePtr<T>& rhs) const
120-
{
121-
return !(*this == rhs);
122-
}
123-
124-
T* get() const
125-
{
126-
return mPtr.get();
127-
}
128-
129-
T& operator*() const
130-
{
131-
return *get();
132-
}
133-
134-
T* operator->() const
135-
{
136-
return get();
137-
}
138-
139-
void reset(T* ptr = nullptr)
140-
{
141-
mPtr.reset(ptr);
142-
}
143-
144-
void reset(std::unique_ptr<T>&& ptr)
145-
{
146-
mPtr = std::move(ptr);
147-
}
148-
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
149-
void reset(mem::auto_ptr<T> ptr)
150-
{
151-
reset(std::unique_ptr<T>(ptr.release()));
152-
}
153-
#endif
154-
};
50+
template <typename T>
51+
using ScopedCloneablePtr = ScopedPtr<T, std::true_type /*CopyIsClone*/>;
15552
}
15653

157-
#endif
54+
#endif // CODA_OSS_mem_ScopedCloneablePtr_h_INCLUDED_

externals/coda-oss/modules/c++/mem/include/mem/ScopedCopyablePtr.h

Lines changed: 6 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@
2020
*
2121
*/
2222

23-
#ifndef __MEM_SCOPED_COPYABLE_PTR_H__
24-
#define __MEM_SCOPED_COPYABLE_PTR_H__
23+
#ifndef CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_
24+
#define CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_
2525
#pragma once
2626

27-
#include <memory>
28-
#include <cstddef>
29-
#include <config/coda_oss_config.h>
30-
31-
#include "sys/Conf.h"
32-
#include "mem/SharedPtr.h"
27+
#include "mem/ScopedPtr.h"
3328

3429
namespace mem
3530
{
@@ -52,113 +47,9 @@ namespace mem
5247
* (if all the other member variables are POD or have correct
5348
* copy constructors / assignment operators).
5449
*/
55-
template <class T>
56-
class ScopedCopyablePtr
57-
{
58-
std::unique_ptr<T> mPtr;
59-
60-
public:
61-
explicit ScopedCopyablePtr(T* ptr = nullptr)
62-
{
63-
reset(ptr);
64-
}
65-
explicit ScopedCopyablePtr(std::unique_ptr<T>&& ptr)
66-
{
67-
reset(std::move(ptr));
68-
}
69-
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
70-
explicit ScopedCopyablePtr(mem::auto_ptr<T> ptr)
71-
{
72-
reset(ptr);
73-
}
74-
#endif
75-
76-
ScopedCopyablePtr(const ScopedCopyablePtr& rhs)
77-
{
78-
*this = rhs;
79-
}
80-
81-
const ScopedCopyablePtr&
82-
operator=(const ScopedCopyablePtr& rhs)
83-
{
84-
if (this != &rhs)
85-
{
86-
auto rhs_ptr = rhs.get();
87-
if (rhs_ptr != nullptr)
88-
{
89-
reset(make::unique<T>(*rhs_ptr));
90-
}
91-
else
92-
{
93-
reset();
94-
}
95-
}
96-
97-
return *this;
98-
}
99-
100-
ScopedCopyablePtr(ScopedCopyablePtr&&) = default;
101-
ScopedCopyablePtr& operator=(ScopedCopyablePtr&&) = default;
102-
103-
bool operator==(const ScopedCopyablePtr<T>& rhs) const
104-
{
105-
auto ptr = get();
106-
auto rhs_ptr = rhs.get();
107-
if (ptr == nullptr && rhs_ptr == nullptr)
108-
{
109-
return true;
110-
}
111-
112-
if (ptr == nullptr || rhs_ptr == nullptr)
113-
{
114-
return false;
115-
}
116-
117-
return *ptr == *rhs_ptr;
118-
}
119-
120-
bool operator!=(const ScopedCopyablePtr<T>& rhs) const
121-
{
122-
return !(*this == rhs);
123-
}
124-
125-
// explicit operators not supported until C++11
126-
explicit operator bool() const
127-
{
128-
return get() == nullptr ? false : true;
129-
}
130-
131-
T* get() const
132-
{
133-
return mPtr.get();
134-
}
135-
136-
T& operator*() const
137-
{
138-
return *get();
139-
}
140-
141-
T* operator->() const
142-
{
143-
return get();
144-
}
145-
146-
void reset(T* ptr = nullptr)
147-
{
148-
mPtr.reset(ptr);
149-
}
50+
template <typename T>
51+
using ScopedCopyablePtr = ScopedPtr<T, std::false_type /*CopyIsClone*/>;
15052

151-
void reset(std::unique_ptr<T>&& ptr)
152-
{
153-
mPtr = std::move(ptr);
154-
}
155-
#if CODA_OSS_autoptr_is_std // std::auto_ptr removed in C++17
156-
void reset(mem::auto_ptr<T> ptr)
157-
{
158-
reset(std::unique_ptr<T>(ptr.release()));
159-
}
160-
#endif
161-
};
16253
}
16354

164-
#endif
55+
#endif // CODA_OSS_mem_ScopedCopyablePtr_h_INCLUDED_

0 commit comments

Comments
 (0)