Commit e61d19df authored by Lefebvre, Jordan's avatar Lefebvre, Jordan
Browse files

Fixing arldatastream static members for Windows dll builds.

parent c719250c
Pipeline #16666 passed with stages
in 17 minutes and 20 seconds
......@@ -13,12 +13,13 @@ class ARLDataStream::PImpl
public:
std::string file;
std::shared_ptr<radix::eafstream> stream;
int recordSize = 0;
int recordSize = 0;
static const int indexHeaderLength = 50, recordHeaderLength = 108;
};
void ARLDataStream::expand(const std::string& val, ARLIndexHeader& index)
{
if (val.size() < indexHeaderLength)
if (val.size() < ARLDataStream::PImpl::indexHeaderLength)
{
throw std::runtime_error(
"Incorrect size for string expansion to ARLIndexHeader.");
......@@ -38,7 +39,7 @@ void ARLDataStream::expand(const std::string& val, ARLIndexHeader& index)
void ARLDataStream::expand(const std::string& val, const ARLIndexHeader& index,
ARLRecordHeader& header)
{
if (val.size() < recordHeaderLength)
if (val.size() < ARLDataStream::PImpl::recordHeaderLength)
{
throw std::runtime_error(
"Incorrect size for string expansion to ARLHeader.");
......@@ -89,7 +90,8 @@ ARLDataStream::ARLDataStream(const std::string& file,
bool ARLDataStream::read_index_header(ARLIndexHeader& iheader)
{
std::string headerString = p->stream->readString(indexHeaderLength);
std::string headerString =
p->stream->readString(ARLDataStream::PImpl::indexHeaderLength);
expand(headerString, iheader);
radix_line("Read index header: year = " << iheader.year);
......@@ -141,11 +143,13 @@ bool ARLDataStream::read_next_index_header(ARLIndexHeader& iheader)
bool ARLDataStream::read_record_header(const ARLIndexHeader& iheader,
ARLRecordHeader& rheader)
{
std::string headerString = p->stream->readString(recordHeaderLength);
std::string headerString =
p->stream->readString(ARLDataStream::PImpl::recordHeaderLength);
expand(headerString, iheader, rheader);
// Calculate and save record size
p->recordSize = (rheader.nx * rheader.ny) + indexHeaderLength;
p->recordSize =
(rheader.nx * rheader.ny) + ARLDataStream::PImpl::indexHeaderLength;
radix_line(" Read record header: model = " << rheader.model_id);
radix_line(" nx = " << rheader.nx);
......@@ -160,7 +164,8 @@ bool ARLDataStream::write_record_header(const ARLIndexHeader& iheader,
const ARLRecordHeader& rheader)
{
// Calculate and save record size
p->recordSize = (rheader.nx * rheader.ny) + indexHeaderLength;
p->recordSize =
(rheader.nx * rheader.ny) + ARLDataStream::PImpl::indexHeaderLength;
radix_line(" Write record header: model = " << rheader.model_id);
radix_line(" nx = " << rheader.nx);
......
......@@ -26,8 +26,6 @@ class RADIX_PUBLIC ARLDataStream
std::unique_ptr<PImpl, void (*)(PImpl*)> p;
private:
static const int indexHeaderLength = 50, recordHeaderLength = 108;
/**
* @brief expand Expands string of 50 characters to an ARLIndexHeader
* @param val String for expansion
......
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