Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce use of explicit "new" #497

Merged
merged 216 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
25c99e0
add contact details
Jul 20, 2020
05c5da2
update .gitignore
Aug 11, 2020
11b7a17
not sure what to do with CMakeSettings.json
Aug 11, 2020
6b1badc
Merge branch 'master' into develop/jdsmith
Aug 11, 2020
447f29a
Create CMakeSettings.json
Aug 11, 2020
89b7807
new/updated "docs" directory
Aug 11, 2020
f0e51d4
update externals/nitro with latest from nitro repo
Aug 11, 2020
a1d4038
use in32_t, etc. instead of nitf::Int32_t
Aug 11, 2020
aac9d2c
Merge branch 'feature/use_standard_C_types' into develop/jdsmith
Aug 11, 2020
52001ee
Merge branch 'feature/update_nitro' into develop/jdsmith
Aug 11, 2020
c36469f
Revert "Merge branch 'feature/update_nitro' into develop/jdsmith"
Aug 11, 2020
b42f93e
Revert "Merge branch 'feature/use_standard_C_types' into develop/jdsm…
Aug 11, 2020
e212252
use in32_t, etc. instead of nitf::Int32_t
Aug 11, 2020
7eb2813
update externals/nitro with latest from nitro repo
Aug 11, 2020
0a75cff
Revert "update externals/nitro with latest from nitro repo"
Aug 11, 2020
66e7669
update nitro/nrt
Aug 11, 2020
554c974
update "nitro"
Aug 11, 2020
60a45b8
nitf::Int8 -> int8_t
Aug 11, 2020
ce6044b
updates from coda-oss and nitro
Aug 31, 2020
acc353e
update externals/nitro with latest from "main"
Sep 16, 2020
b36a809
update externals/coda-oss with latest from "main"
Sep 16, 2020
e6fe2f1
Merge branch 'develop/master' into develop/main
Sep 16, 2020
cbb9b90
don't want "docs" directory in externals/nitro
Sep 16, 2020
130e3cd
fix bad merge
Sep 16, 2020
f121bad
ignore CMake-generated files
Sep 16, 2020
ce51201
std::auto_ptr -> std::unique_ptr
Sep 16, 2020
c95e858
need std::auto_ptr<> overloads for pre-generated Python wrapper code
Sep 16, 2020
914710c
provide std::auto_ptr "overloads" so that existing Python wrapper cod…
Sep 19, 2020
916f62a
impelement std::auto_ptr "overrides"
Sep 19, 2020
8cd8a70
latest from nitro:main
Sep 22, 2020
533878c
Merge pull request #349 from ngageoint/develop/main
Sep 22, 2020
d0d9f24
update externals/nitro
Oct 5, 2020
a85c00b
update coda-oss
Oct 5, 2020
75868bb
Merge pull request #354 from ngageoint/develop/main
Oct 5, 2020
4388277
Create codeql-analysis.yml
Oct 6, 2020
3f13025
Merge commit 'd216783a2d5ae168a34bc41da70c5c0004648c4a' into main
Oct 6, 2020
d13fd97
update coda-oss with latest from "main"
Oct 13, 2020
7b79bdf
Merge branch 'main' into develop/jdsmith
Oct 13, 2020
1fc1444
update nitro with latest from "main"
Oct 13, 2020
b6617ec
Merge pull request #356 from ngageoint/develop/jdsmith
Oct 13, 2020
571196e
Revert "Create codeql-analysis.yml"
Oct 13, 2020
8730781
fix nitf::Field to get rid of compiler errors
Oct 13, 2020
790ab26
build externals/coda-oss by itself
Oct 13, 2020
7e99996
Merge pull request #357 from ngageoint/develop/jdsmith
Oct 13, 2020
54b2d6f
build with Visual Studio 2019 (#358)
Oct 14, 2020
165fb1d
use c++11 (#359)
Oct 17, 2020
67ee284
get rid of hard-coded paths with <filesystem> (#360)
Oct 17, 2020
bb1dbe6
can't have "check_valid_six" as a directory for *ix build
Oct 17, 2020
e8636f4
build crop_sicd
Oct 17, 2020
52207d7
build crop_sicd in Visual Studio (#361)
Oct 17, 2020
d16b60d
Merge branch 'main' of github.com:ngageoint/six-library into main
Oct 20, 2020
495d74a
update coda-oss with latest from "main"
Oct 20, 2020
92af349
update coda-oss with latest from "main" (#362)
Oct 20, 2020
c7ff931
coda-oss updates to make TextEncoding part of the OutputStream
Oct 21, 2020
2be4824
updates from coda-oss to make TextEncoding part of the OutputStream
Oct 21, 2020
97ecde9
fix StringStream() .ctor()
Oct 21, 2020
39344b1
Merge branch 'main' into develop/update_externals
Oct 21, 2020
cdb0893
one more coda-oss update
Oct 21, 2020
fe9dfff
latest from coda-oss "main" (#364)
Oct 21, 2020
1edffff
latest from "main" on coda-oss: xml.lite updates for UTF-8
Oct 26, 2020
f996fa8
Merge branch 'main' into develop/update_externals
Oct 26, 2020
8ff2451
restore changes lost in merge
Oct 26, 2020
21a550c
update coda-oss (#365)
Oct 26, 2020
18613b5
Merge branch 'main' into develop/update_externals
Oct 26, 2020
d3423b3
latest from coda-oss
Oct 26, 2020
404dadc
another update to coda-oss (#366)
Oct 26, 2020
f71c7ed
Merge branch 'main' into develop/update_externals
Oct 26, 2020
313a601
latest from coda-oss
Oct 26, 2020
5c48090
Develop/update externals (#367)
Oct 26, 2020
f332607
latest from coda-oss
Nov 2, 2020
3a042b6
latest from coda-oss (#368)
Nov 2, 2020
70d253c
Merge branch 'main' into develop/update_externals
Nov 3, 2020
29d743f
latest from "main" on coda-oss
Nov 3, 2020
950668d
latest from coda-oss (#369)
Nov 3, 2020
f014cf4
use Filesystem.h from coda-oss instead of <filesystem>
Nov 3, 2020
90e42da
use sys::Filesystem
Nov 4, 2020
5c4bfb6
Merge branch 'develop/update_externals' into main
Nov 4, 2020
3c07e72
update "nitro" and "coda-oss" (#370)
Nov 9, 2020
f9283e8
preserve utf8 in XML text (#363)
Nov 9, 2020
ce28071
use .tar, not .tar.gz
Nov 9, 2020
79aa44f
add another unit-test (#371)
Nov 30, 2020
4538574
remove some compiler warnings (#372)
Dec 1, 2020
0eae36f
update "nitro"
Dec 1, 2020
4ac10f9
update coda-oss and fix compiler errors
Dec 1, 2020
0e60d32
use int64_t, etc. instead of sys::Int64_T
Dec 1, 2020
2c86f4e
mem::SharedPtr -> std::shared_ptr
Dec 1, 2020
a0f9185
update coda-oss and nitro with less use of sys::
Dec 1, 2020
d9e7b59
Merge branch 'develop/update_externals' into develop/use_c++11
Dec 1, 2020
b445329
unit-test paths are wrong for "externals"
Dec 1, 2020
f1b6d22
update externals (#373)
Dec 1, 2020
acb882d
Merge branch 'main' into develop/use_c++11
Dec 1, 2020
472cd0b
update "nitro" to get SegmentMemorySource overloads
Dec 2, 2020
403b5a2
Merge branch 'develop/update_externals' into develop/use_c++11
Dec 2, 2020
b03c979
use c++11 features (#374)
Dec 2, 2020
400ab90
use std::unique_ptr<[]> instead of mem::ScopedArray
Dec 2, 2020
7b88491
use int32_t et. al. instead of sys::Int32_T
Dec 2, 2020
af38657
use std::byte (not quite working yet, but need to move code to a fast…
Dec 2, 2020
36535d9
Merge branch 'main' into develop/use_c++11
Dec 2, 2020
5d3b4bc
build with std::byte
Dec 2, 2020
48deaeb
latest "nitro" (#375)
Dec 5, 2020
d7bd790
Merge branch 'main' into develop/use_c++11
Dec 5, 2020
4a46f6c
use std::thread::hardware_concurrency() instead of sys::OS().getNumCP…
Dec 5, 2020
aa22a37
sys::Off_T -> ptrdiff_t
Dec 5, 2020
42a4e29
Revert "sys::Off_T -> ptrdiff_t"
Dec 5, 2020
1ba1665
sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t
Dec 5, 2020
10df67a
latest from "coda-oss" (#376)
Dec 5, 2020
d038e0e
more use of C++11 (#377)
Dec 5, 2020
ef45d66
fix build errors from recent changes (#378)
Dec 5, 2020
e8f8bd1
use filesystem::path and std::endian
Dec 5, 2020
690ed8f
Merge branch 'main' into develop/use_c++11
Dec 5, 2020
6e673a4
less use of sys::
Dec 5, 2020
9c6b41d
NULL -> nullptr
Dec 5, 2020
37f1620
NULL -> nullptr (#379)
Dec 5, 2020
e2084e8
latest from coda-oss (#381)
Dec 5, 2020
12f6f27
latest from develop/jdsmith (#382)
Dec 5, 2020
a2d5396
latest from "nitro" (#383)
Dec 5, 2020
514403d
latest from develop/jdsmith (#385)
Dec 8, 2020
f990e77
latest from "nitro" (#387)
Dec 19, 2020
6ba3ffd
latest changes from develop/jdsmith (#386)
Dec 19, 2020
f217f23
update externals (#388)
Dec 19, 2020
433e819
reduce use of toString() (#389)
Dec 22, 2020
21e2b67
latest from coda-oss (#390)
Dec 29, 2020
825a667
latest from coda-oss and nitro (#391)
Dec 30, 2020
f283be3
update coda-oss with latest from https://github.com/mdaus/coda-oss
Jan 9, 2021
ae630e6
update externals/nitro/docs
Jan 9, 2021
0b99300
latest from "nitro"
Jan 9, 2021
db45e1e
Revert "latest from "nitro""
Jan 11, 2021
e89da71
latest from nitro/master
Jan 11, 2021
3adb502
ignore build/ directory
Jan 11, 2021
89522fe
Revert "latest from nitro/master"
Jan 11, 2021
e82f28c
update externals/nitro/docs
Jan 11, 2021
8fe3028
update "c", "java", "mex", and "python" directories -- but not "c++"
Jan 11, 2021
b3c1dbd
update other nitro top-level files ... everything except modules/c++
Jan 11, 2021
a398eef
VCXPROJ files from nitro
Jan 11, 2021
7a9b240
several changes from nitro/c++ ... hoping this builds.
Jan 11, 2021
a688092
fix build error on Linux
Jan 11, 2021
84db123
more changes from nitro/modules/c++
Jan 11, 2021
7aba3b8
fix IOStreamWriter ctor
Jan 11, 2021
d9a5c2f
more changes from nitro/modules/c++
Jan 11, 2021
5e5870f
paths are wrong when in "externals"
Jan 11, 2021
7b8ca70
remove externals/nitro/docs
Jan 11, 2021
92d5bb5
Merge branch 'develop/update_externals' of github.com:ngageoint/six-l…
Jan 11, 2021
e6a58a2
slam in "main"
Jan 12, 2021
65026c2
latest from coda-oss/main
Jan 12, 2021
99a0a01
adjust coda-oss for our usage
Jan 12, 2021
4e6a752
latest from nitro/main
Jan 12, 2021
1bd0cb3
std::span removed from "nitro"
Jan 12, 2021
fa19905
need to redo C++17
Jan 12, 2021
120ee00
fix missing #include file
Jan 13, 2021
da30b96
remove "nitro" files not needed in externals/nitro
Jan 13, 2021
dd710d5
paths are wrong in "externals"
Jan 13, 2021
e69391b
Revert "remove "nitro" files not needed in externals/nitro"
Jan 13, 2021
436986f
Revert "Revert "remove "nitro" files not needed in externals/nitro""
Jan 13, 2021
ebe9550
slam in externals as merging creates too many conflicts
Jan 13, 2021
4e23991
Merge branch 'develop/update_externals' into main
Jan 13, 2021
6de2fa0
merge brought back a deleted #include
Jan 13, 2021
1073b39
add back "java" and "mex"
Jan 16, 2021
6fca258
lates from coda-oss/main
Jan 16, 2021
1083ac1
latest from "nitro"
Jan 16, 2021
e21d4fc
paths are wrong in "externals"
Jan 16, 2021
9e21803
need to redo C++17 support
Jan 16, 2021
c10f233
std::span -> gsl::span
Jan 16, 2021
f897082
Merge branch 'master' into develop/update_externals
Jan 19, 2021
fa0a138
Revert "std::span -> gsl::span"
Jan 19, 2021
b856b54
latest from coda-oss and nitro
Jan 19, 2021
70a3e72
these are the correct files from "master"
Jan 19, 2021
8242847
gsl::span -> std::span
Jan 19, 2021
0ec8633
get #includes right for PCH
Jan 19, 2021
460a96b
didn't want this change
Jan 19, 2021
671a89a
trigger build on GitHub
Jan 19, 2021
bd7d9f7
#include <nitf/coda-oss.hpp> instead of sys/Conf.h to get stuff added…
Jan 19, 2021
0ecff95
remove files that shouldn't have been committed
Jan 19, 2021
a015595
Merge branch 'develop/update_externals' into develop/use_c++11
Jan 19, 2021
160f01e
#define CODA_OSS_AUGMENT_std_namespace before #include <sys/Conf.h>
Jan 20, 2021
df90a44
Merge branch 'master' into develop/use_c++11
Jan 20, 2021
fb5176c
#include <scene/sys_Conf.h> rather than <nitf/coda-oss.hpp>
Jan 20, 2021
b7413c6
do a better job of being sure we have additional stuff in "std" from …
Jan 20, 2021
e76c365
no auto_ptr in C++17
Jan 25, 2021
7bb1bb4
Merge branch 'master' into develop/use_c++11
Jan 25, 2021
652dadf
no std::auto_ptr in C++17
Jan 25, 2021
09450c2
Merge branch 'master' into develop/use_c++11
Jan 26, 2021
4bcd2a7
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Jan 27, 2021
67b41f9
Merge branch 'master' into develop/use_c++11
Jan 27, 2021
afaf4d4
mem::auto_ptr instead of std::auto_ptr for C++17
Jan 27, 2021
0892e19
fix a few more errors with building with C++17
Jan 27, 2021
d165f62
Merge branch 'master' into develop/use_c++11
Feb 1, 2021
d0cf3be
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Feb 1, 2021
91f6c48
std::auto_ptr -> mem::auto_ptr for C++17
Feb 1, 2021
7eb4f3f
Merge branch 'master' into develop/use_c++11
Feb 9, 2021
7bc8624
Merge branch 'master' into develop/use_c++11
Feb 10, 2021
a0ec957
old compilers don't like certain kinds of braced-initialization
Feb 10, 2021
b72de0b
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
809f998
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
555055e
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
87623bb
Merge branch 'master' into develop/use_c++11
Feb 17, 2021
6d69985
turn off some CA diagnostics from other code
Feb 17, 2021
8954395
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Feb 20, 2021
ce0db35
Merge branch 'master' into develop/use_c++11
Nov 2, 2021
49048ae
reduce use of explicit "new" and pointers in CPHDReader
Nov 2, 2021
dbc48b8
another "version" -> "strVersion"; added unit-test
Nov 2, 2021
75ea632
version -> strVersion to avoid conflicting with global "version"
Nov 2, 2021
e7938bc
reduce use of explicit "new"
Nov 2, 2021
8fdb3e3
use std::make_unique() instead of explicit "new"
Nov 3, 2021
5787a69
use a std::unique_ptr for storing an "owned" logger
Nov 3, 2021
3c74dbd
new Logger class to more easily manage logging configuration
Nov 3, 2021
f18fbe4
use new Logger class to reduce boiler-plate code
Nov 3, 2021
82db8c1
use the new six::Logger class to reduce boilerplate logger code
Nov 3, 2021
b9368a9
more use of six::Logger to manage logging
Nov 3, 2021
905f7f5
more use of six::Logger to reduce boilerplate code
Nov 3, 2021
396b4fa
simplify six::Logger
Nov 3, 2021
11e66dc
fix G++ compiler errors
Nov 3, 2021
f8ab35d
switch remaining code to new six::Logger infrastructure
Nov 3, 2021
da788ab
build Logger.cpp w/CMake
Nov 3, 2021
dce2a7d
reduce use of explicit "new"
Nov 4, 2021
9edba14
sys::Uint32_T -> uint32_t
Nov 4, 2021
e341b8e
mem::ScopedArray<T> -> std::unique_ptr<T[]>
Nov 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions six/modules/c++/cphd/include/cphd/CPHDReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ namespace cphd
* Requires a valid CPHD file,and optional schemas
* for XML format verification
*/
class CPHDReader
struct CPHDReader final
{
public:
/*
* \func CPHDReader constructor
* \brief Construct CPHDReader from an input stream
Expand Down Expand Up @@ -81,22 +80,22 @@ class CPHDReader
//! Get parameter functions
size_t getNumChannels() const
{
return mMetadata->data.getNumChannels();
return mMetadata.data.getNumChannels();
}
//! 0-based channel number
size_t getNumVectors(size_t channel) const
{
return mMetadata->data.getNumVectors(channel);
return mMetadata.data.getNumVectors(channel);
}
//! 0-based channel number
size_t getNumSamples(size_t channel) const
{
return mMetadata->data.getNumSamples(channel);
return mMetadata.data.getNumSamples(channel);
}
//! returns total per complex sample (2, 4, or 8)
size_t getNumBytesPerSample() const
{
return mMetadata->data.getNumBytesPerSample();
return mMetadata.data.getNumBytesPerSample();
}

/*
Expand All @@ -122,12 +121,12 @@ class CPHDReader
//! Get metadata object
const Metadata& getMetadata() const
{
return *mMetadata;
return mMetadata;
}
//! Get per vector parameters
const PVPBlock& getPVPBlock() const
{
return *mPVPBlock;
return mPVPBlock;
}
//! Get signal data
const Wideband& getWideband() const
Expand All @@ -145,11 +144,11 @@ class CPHDReader
//! New cphd file header
FileHeader mFileHeader;
//! Metadata read in from CPHD file
std::unique_ptr<Metadata> mMetadata;
Metadata mMetadata;
//! Support Block book-keeping info read in from CPHD file
std::unique_ptr<SupportBlock> mSupportBlock;
//! Per Vector Parameter info read in from CPHD file
std::unique_ptr<PVPBlock> mPVPBlock;
PVPBlock mPVPBlock;
//! Signal block book-keeping info read in from CPHD file
std::unique_ptr<Wideband> mWideband;

Expand Down
5 changes: 2 additions & 3 deletions six/modules/c++/cphd/include/cphd/CPHDWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ struct DataWriterLittleEndian final : public DataWriter


private:
// Size of scratch space
const size_t mScratchSize;
// Scratch space buffer
const std::unique_ptr<std::byte[]> mScratch;
std::vector<std::byte> mScratch;
};

/*
Expand Down Expand Up @@ -389,6 +387,7 @@ struct CPHDWriter

//! DataWriter object
std::unique_ptr<DataWriter> mDataWriter;
void initializeDataWriter();

// Book-keeping element
//! metadata information
Expand Down
25 changes: 20 additions & 5 deletions six/modules/c++/cphd/include/cphd/CPHDXMLControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@

#ifndef __CPHD_CPHD_XML_CONTROL_H__
#define __CPHD_CPHD_XML_CONTROL_H__
#pragma once

#include <memory>
#include <unordered_map>
#include <std/filesystem>
#include <vector>

#include <scene/sys_Conf.h>
#include <logging/Logger.h>
#include <xml/lite/Element.h>
#include <xml/lite/Document.h>
#include <cphd/CPHDXMLParser.h>
#include <cphd/Types.h>
#include <six/Logger.h>

namespace cphd
{
Expand All @@ -54,7 +57,7 @@ class CPHDXMLControl
CPHDXMLControl(logging::Logger* log = nullptr, bool ownLog = false);

//! Destructor
virtual ~CPHDXMLControl();
virtual ~CPHDXMLControl() = default;

/*
* \func setLogger
Expand All @@ -63,7 +66,15 @@ class CPHDXMLControl
* \param log provide logger object
* \param ownLog flag indicates if log should be deleted
*/
void setLogger(logging::Logger* log, bool ownLog = false);
template<typename TLogger>
void setLogger(TLogger&& logger)
{
mLogger.setLogger(std::forward<TLogger>(logger));
}
void setLogger(logging::Logger* logger, bool ownLog)
{
mLogger.setLogger(logger, ownLog);
}

/*!
* \func toXMLString
Expand Down Expand Up @@ -117,10 +128,14 @@ class CPHDXMLControl
virtual std::unique_ptr<Metadata> fromXML(
const xml::lite::Document* doc,
const std::vector<std::string>& schemaPaths = std::vector<std::string>());
virtual Metadata fromXML(const xml::lite::Document& doc,
const std::vector<std::filesystem::path>& schemaPaths = std::vector<std::filesystem::path>());


protected:
logging::Logger *mLog;
bool mOwnLog;
logging::Logger *mLog = nullptr;
bool mOwnLog = false;
six::Logger mLogger;

private:
//! \return Hardcoded version to uri mapping
Expand Down
2 changes: 1 addition & 1 deletion six/modules/c++/cphd/include/cphd/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace cphd
* This object contains all of the sub-blocks for CPHD.
*
*/
struct Metadata : MetadataBase
struct Metadata final : MetadataBase
{
//! Default constructor
//! Initializes CPHD version to default version specified in FileHeader
Expand Down
3 changes: 3 additions & 0 deletions six/modules/c++/cphd/include/cphd/PVPBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

namespace cphd
{
class FileHeader;
/*
* \struct AddedPVP
* \brief Template Specialization to get additional pvp
Expand Down Expand Up @@ -98,6 +99,7 @@ struct PVPBlock
* if provided number of bytes is not sufficient
*/
PVPBlock(const Pvp& pvp, const Data& data);
PVPBlock(const Metadata&);

/*!
* \func PVPBlock
Expand Down Expand Up @@ -323,6 +325,7 @@ struct PVPBlock
int64_t startPVP,
int64_t sizePVP,
size_t numThreads);
int64_t load(io::SeekableInputStream& inStream, const FileHeader&, size_t numThreads);

//! Equality operators
bool operator==(const PVPBlock& other) const
Expand Down
15 changes: 9 additions & 6 deletions six/modules/c++/cphd/include/cphd/SupportBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@

namespace cphd
{
class FileHeader;


/*
* \struct SupportBlock
*
* \brief This class contains information about the SupportBlock CPHD data.
*/
// Provides methods to read support block data from CPHD file/stream
class SupportBlock
struct SupportBlock final
{
public:
/*
* \func SupportBlock
*
Expand Down Expand Up @@ -80,6 +81,8 @@ class SupportBlock
const cphd::Data& data,
int64_t startSupport,
int64_t sizeSupport);
SupportBlock(std::shared_ptr<io::SeekableInputStream> inStream,
const cphd::Data& data, const FileHeader&);

// Noncopyable
SupportBlock(const SupportBlock&) = delete;
Expand Down Expand Up @@ -138,12 +141,12 @@ class SupportBlock
// Same as above but allocates the memory
void read(const std::string& id,
size_t numThreads,
mem::ScopedArray<sys::ubyte>& data) const;
std::unique_ptr<sys::ubyte[]>& data) const;
void read(const std::string& id,
size_t numThreads,
std::unique_ptr<std::byte[]>& data) const
{
mem::ScopedArray<sys::ubyte> data_;
std::unique_ptr<sys::ubyte[]> data_;
read(id, numThreads, data_);
data.reset(reinterpret_cast<std::byte*>(data_.release()));
}
Expand All @@ -161,11 +164,11 @@ class SupportBlock
*
*/
void readAll(size_t numThreads,
mem::ScopedArray<sys::ubyte>& data) const;
std::unique_ptr<sys::ubyte[]>& data) const;
void readAll(size_t numThreads,
std::unique_ptr<std::byte[]>& data) const
{
mem::ScopedArray<sys::ubyte> data_;
std::unique_ptr<sys::ubyte[]> data_;
readAll(numThreads, data_);
data.reset(reinterpret_cast<std::byte*>(data_.release()));
}
Expand Down
13 changes: 7 additions & 6 deletions six/modules/c++/cphd/include/cphd/Wideband.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@

namespace cphd
{
class FileHeader;

/*
* \class Wideband
* \brief Information about the wideband CPHD data
*/
// It contains the cphd::Data structure (for channel and vector sizes).
// Provides methods read wideband data from CPHD file/stream
class Wideband
struct Wideband final
{
public:
static const size_t ALL;

/*!
Expand Down Expand Up @@ -211,15 +212,15 @@ class Wideband
size_t firstSample,
size_t lastSample,
size_t numThreads,
mem::ScopedArray<sys::ubyte>& data) const;
std::unique_ptr<sys::ubyte[]>& data) const;
std::unique_ptr<std::byte[]>read(size_t channel,
size_t firstVector,
size_t lastVector,
size_t firstSample,
size_t lastSample,
size_t numThreads) const
{
mem::ScopedArray<sys::ubyte> data;
std::unique_ptr<sys::ubyte[]> data;
read(channel, firstVector, lastVector, firstSample, lastSample, numThreads, data);

return std::unique_ptr<std::byte[]>(reinterpret_cast<std::byte*>(data.release()));
Expand All @@ -238,10 +239,10 @@ class Wideband
* \throw except::Exception If BufferView memory allocated is insufficient
*/
// Same as above for compressed Signal Array
void read(size_t channel, mem::ScopedArray<sys::ubyte>& data) const;
void read(size_t channel, std::unique_ptr<sys::ubyte[]>& data) const;
void read(size_t channel, std::unique_ptr<std::byte[]>& data) const
{
mem::ScopedArray<sys::ubyte> data_;
std::unique_ptr<sys::ubyte[]> data_;
read(channel, data_);
data.reset(reinterpret_cast<std::byte*>(data_.release()));
}
Expand Down
15 changes: 7 additions & 8 deletions six/modules/c++/cphd/source/ByteSwap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cphd/ByteSwap.h>

#include <string>
#include <std/memory>

#include <sys/Conf.h>
#include <mt/ThreadPlanner.h>
Expand Down Expand Up @@ -195,13 +196,12 @@ void byteSwapAndPromote(const void* input,
startRow,
numRowsThisThread))
{
std::unique_ptr<sys::Runnable> scaler(
new ByteSwapAndPromoteRunnable<InT>(
auto scaler = std::make_unique<ByteSwapAndPromoteRunnable<InT>>(
input,
startRow,
numRowsThisThread,
dims.col,
output));
output);
threads.createThread(std::move(scaler));
}

Expand Down Expand Up @@ -233,13 +233,13 @@ void byteSwapAndScale(const void* input,
startRow,
numRowsThisThread))
{
std::unique_ptr<sys::Runnable> scaler(new ByteSwapAndScaleRunnable<InT>(
auto scaler = std::make_unique<ByteSwapAndScaleRunnable<InT>>(
input,
startRow,
numRowsThisThread,
dims.col,
scaleFactors,
output));
output);
threads.createThread(std::move(scaler));
}

Expand Down Expand Up @@ -273,12 +273,11 @@ void byteSwap(void* buffer,
startElement,
numElementsThisThread))
{
std::unique_ptr<sys::Runnable> thread(new ByteSwapRunnable(
auto thread = std::make_unique<ByteSwapRunnable>(
buffer,
elemSize,
startElement,
numElementsThisThread));

numElementsThisThread);
threads.createThread(std::move(thread));
}
threads.joinAll();
Expand Down
Loading