Skip to content

Commit c30ae27

Browse files
author
Dan Smith
committed
no more gsl::make_span
1 parent e61dca0 commit c30ae27

5 files changed

Lines changed: 26 additions & 19 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.14)
22
project(six-library)
33

44
set(CMAKE_CXX_STANDARD 11)
5+
set(CXX_STANDARD_REQUIRED true)
56

67
if (${CMAKE_PROJECT_NAME} STREQUAL six-library)
78
# we are the top-level project and are responsible for configuration

six/modules/c++/cphd/tests/test_round_trip.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <fstream>
2525
#include <memory>
2626
#include <thread>
27+
#include <std/span>
2728

2829
#include <cphd/CPHDReader.h>
2930
#include <cphd/CPHDWriter.h>
@@ -39,7 +40,6 @@
3940
#include <cphd/Metadata.h>
4041
#include <cphd/PVPBlock.h>
4142

42-
4343
/*!
4444
* Reads in CPHD file from InputFile
4545
* Writes out CPHD file to OutputFile
@@ -85,7 +85,7 @@ void testRoundTrip(const std::string& inPathname, const std::string& outPathname
8585
for (size_t channel = 0, idx = 0; channel < metadata.data.getNumChannels(); ++channel)
8686
{
8787
const size_t bufSize = metadata.data.getCompressedSignalSize(channel);
88-
wideband.read(channel, gsl::make_span(&data[idx], bufSize));
88+
wideband.read(channel, std::span<std::byte>(&data[idx], bufSize));
8989
idx += bufSize;
9090
}
9191
writer.write(
@@ -101,7 +101,7 @@ void testRoundTrip(const std::string& inPathname, const std::string& outPathname
101101
const size_t bufSize = metadata.data.getSignalSize(channel);
102102
wideband.read(channel, 0, cphd::Wideband::ALL,
103103
0, cphd::Wideband::ALL, numThreads,
104-
gsl::make_span(&data[idx], bufSize));
104+
std::span<std::byte>(&data[idx], bufSize));
105105
idx += bufSize;
106106
}
107107

six/modules/c++/cphd/unittests/test_read_wideband.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,28 @@ namespace testing
4343
}
4444
}
4545
}
46-
#else
46+
#endif // GTEST_API_
4747

48-
inline bool operator==(std::byte lhs, char rhs)
49-
{
50-
return static_cast<char>(lhs) == rhs;
51-
}
52-
inline bool operator!=(std::byte lhs, char rhs)
48+
namespace
5349
{
54-
return !(lhs == rhs);
50+
inline bool operator==(std::byte lhs, char rhs)
51+
{
52+
return static_cast<char>(lhs) == rhs;
53+
}
54+
inline bool operator!=(std::byte lhs, char rhs)
55+
{
56+
return !(lhs == rhs);
57+
}
5558
}
56-
57-
inline std::ostream& operator<<(std::ostream& os, std::byte v)
59+
namespace str
5860
{
59-
os << static_cast<unsigned char>(v);
60-
return os;
61+
inline std::ostream& operator<<(std::ostream& os, std::byte v)
62+
{
63+
os << static_cast<unsigned char>(v);
64+
return os;
65+
}
6166
}
6267

63-
#endif // GTEST_API_
64-
6568
namespace
6669
{
6770
TEST_CASE(testReadCompressedChannel)

six/modules/c++/cphd/unittests/test_signal_block_round.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ std::vector<std::complex<T> > generateData(size_t length)
5555
srand(0);
5656
for (size_t ii = 0; ii < data.size(); ++ii)
5757
{
58-
float real = static_cast<T>(rand() / 100);
59-
float imag = static_cast<T>(rand() / 100);
58+
auto real = static_cast<T>(rand() / 100);
59+
auto imag = static_cast<T>(rand() / 100);
6060
data[ii] = std::complex<T>(real, imag);
6161
}
6262
return data;

six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,14 @@ TEST_CASE(test_create_sicd_from_mem_8i)
494494
test_create_sicd_from_mem("test_create_sicd_from_mem_8i_noamp.sicd", six::PixelType::AMP8I_PHS8I, false /*makeAmplitudeTable*/);
495495
}
496496

497-
inline std::ostream& operator<<(std::ostream& os, const six::sicd::ImageData::AMP8I_PHS8I_t& p)
497+
namespace str
498+
{
499+
inline std::ostream & operator<<(std::ostream & os, const six::sicd::ImageData::AMP8I_PHS8I_t & p)
498500
{
499501
os << p.first << p.second;
500502
return os;
501503
}
504+
}
502505
template<typename TNearestNeighbor>
503506
static void test_near_point(const std::complex<float>& p, const six::sicd::ImageData::AMP8I_PHS8I_t& expected,
504507
TNearestNeighbor nearest_neighbor_f)

0 commit comments

Comments
 (0)