Commit d59edd77 authored by Norby, Tom's avatar Norby, Tom

[Fortify] Unique pointer to raw.

parent 8c927e75
Pipeline #100114 failed with stages
in 3 minutes and 18 seconds
......@@ -78,7 +78,7 @@ void ARLDataStream::expand(const std::string& val,
ARLDataStream::ARLDataStream(const std::string& file,
std::ios_base::openmode mode)
: p(new PImpl(), [](PImpl* impl) { delete impl; })
: p(new PImpl())
{
p->file = file;
p->stream = std::make_shared<radix::eafstream>(p->file.c_str(),
......@@ -89,6 +89,8 @@ ARLDataStream::ARLDataStream(const std::string& file,
}
}
ARLDataStream::~ARLDataStream() { delete p; }
bool ARLDataStream::read_record_header(ARLRecordHeader& rheader)
{
bool result = false;
......
......@@ -22,8 +22,7 @@ class RADIX_PUBLIC ARLDataStream
{
// forward declare private implementation
class PImpl;
// unique pointer to private implmentation
std::unique_ptr<PImpl, void (*)(PImpl*)> p;
PImpl* p;
private:
/**
......@@ -46,7 +45,7 @@ class RADIX_PUBLIC ARLDataStream
public:
ARLDataStream() = delete;
ARLDataStream(const std::string& file, std::ios_base::openmode mode);
~ARLDataStream();
/**
* @brief read_index_header Reads a single index header from the stream
* @param iheader ARLIndexHeader&
......
......@@ -110,7 +110,7 @@ eafstream &eafstream::operator>>(float &value)
eafstream &eafstream::operator>>(std::vector<float> &value)
{
float *tData;
tData = readFloatArray((int)value.size());
tData = readFloatArray(value.size());
std::copy(tData, tData + value.size(), value.begin());
delete[] tData;
return *this;
......
......@@ -48,12 +48,12 @@ class F71Case::PImpl
float flux;
};
F71Case::F71Case()
: p(new PImpl(), [](PImpl* impl) { delete impl; })
: p(new PImpl())
{
}
F71Case::F71Case(const F71Case& orig)
: p(new PImpl(), [](PImpl* impl) { delete impl; })
: p(new PImpl())
{
p->light_element_nuclides = orig.p->light_element_nuclides;
p->actinide_nuclides = orig.p->actinide_nuclides;
......@@ -92,6 +92,8 @@ F71Case::F71Case(const F71Case& orig)
p->flux = orig.p->flux;
}
F71Case::~F71Case() { delete p; }
const std::vector<int>& F71Case::lightElementNuclides() const
{
return p->light_element_nuclides;
......
......@@ -76,12 +76,12 @@ class RADIX_PUBLIC F71Case
{
// forward declare private implementation
class PImpl;
// unique pointer to private implmentation
std::unique_ptr<PImpl, void (*)(PImpl*)> p;
PImpl* p;
public:
F71Case();
F71Case(const F71Case& orig);
~F71Case();
const std::vector<int>& lightElementNuclides() const;
void setLightElementNuclides(const std::vector<int>& zaids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment