Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
ce22f586
Commit
ce22f586
authored
Oct 23, 2018
by
Purves, Murray
Browse files
WIP Cleanup before starting on write methods
parent
5a8c55dd
Pipeline
#16598
failed with stages
in 18 minutes and 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/arldatastream.cc
View file @
ce22f586
...
@@ -102,6 +102,8 @@ bool ARLDataStream::read_index_header(ARLIndexHeader& iheader)
...
@@ -102,6 +102,8 @@ bool ARLDataStream::read_index_header(ARLIndexHeader& iheader)
return
true
;
return
true
;
}
}
bool
ARLDataStream
::
write_index_header
(
const
ARLIndexHeader
&
iheader
)
{}
bool
ARLDataStream
::
read_next_index_header
(
ARLIndexHeader
&
iheader
)
bool
ARLDataStream
::
read_next_index_header
(
ARLIndexHeader
&
iheader
)
{
{
int
bytesToSkip
=
roundUpInt
(
p
->
stream
->
bytesRead
(),
p
->
recordSize
)
-
int
bytesToSkip
=
roundUpInt
(
p
->
stream
->
bytesRead
(),
p
->
recordSize
)
-
...
@@ -131,6 +133,11 @@ bool ARLDataStream::read_record_header(const ARLIndexHeader& iheader,
...
@@ -131,6 +133,11 @@ bool ARLDataStream::read_record_header(const ARLIndexHeader& iheader,
return
true
;
return
true
;
}
}
bool
ARLDataStream
::
write_record_header
(
const
ARLIndexHeader
&
iheader
,
const
ARLRecordHeader
&
rheader
)
{
}
bool
ARLDataStream
::
read_record
(
const
ARLIndexHeader
&
iheader
,
bool
ARLDataStream
::
read_record
(
const
ARLIndexHeader
&
iheader
,
const
ARLRecordHeader
&
rheader
,
const
ARLRecordHeader
&
rheader
,
std
::
vector
<
std
::
vector
<
double
>
>&
record
)
std
::
vector
<
std
::
vector
<
double
>
>&
record
)
...
@@ -186,21 +193,11 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
...
@@ -186,21 +193,11 @@ bool ARLDataStream::read_record(const ARLIndexHeader& iheader,
return
true
;
return
true
;
}
}
/**
bool
ARLDataStream
::
write_record
(
* @brief The ARLRecord::PImpl class
const
ARLIndexHeader
&
iheader
,
const
ARLRecordHeader
&
rheader
,
*/
const
std
::
vector
<
std
::
vector
<
double
>
>&
record
)
class
ARLRecord
::
PImpl
{
public:
};
ARLRecord
::
ARLRecord
()
:
p
(
new
ARLRecord
::
PImpl
(),
[](
ARLRecord
::
PImpl
*
impl
)
{
delete
impl
;
})
{
}
ARLRecord
::
ARLRecord
(
const
ARLRecord
&
orig
)
:
p
(
new
ARLRecord
::
PImpl
(),
[](
ARLRecord
::
PImpl
*
impl
)
{
delete
impl
;
})
{
{
return
false
;
}
}
}
// namespace radix
}
// namespace radix
radixio/arldatastream.hh
View file @
ce22f586
...
@@ -14,10 +14,9 @@
...
@@ -14,10 +14,9 @@
namespace
radix
namespace
radix
{
{
//
//
// Forward declare ARLRecord and ARLHeader
// Forward declare ARLRecord
Header
and ARL
Index
Header
struct
ARLIndexHeader
;
struct
ARLIndexHeader
;
struct
ARLRecordHeader
;
struct
ARLRecordHeader
;
class
ARLRecord
;
class
RADIX_PUBLIC
ARLDataStream
class
RADIX_PUBLIC
ARLDataStream
{
{
...
@@ -56,15 +55,19 @@ class RADIX_PUBLIC ARLDataStream
...
@@ -56,15 +55,19 @@ class RADIX_PUBLIC ARLDataStream
* @return
* @return
*/
*/
bool
read_index_header
(
ARLIndexHeader
&
iheader
);
bool
read_index_header
(
ARLIndexHeader
&
iheader
);
bool
write_index_header
(
const
ARLIndexHeader
&
iheader
);
/**
/**
* @brief next_index_header Sets the stream position to that of the next
index
* @brief
read_
next_index_header Sets the stream position to that of the next
* header and reads that header
*
index
header and reads that header
* @return
* @return
*/
*/
bool
read_next_index_header
(
ARLIndexHeader
&
iheader
);
bool
read_next_index_header
(
ARLIndexHeader
&
iheader
);
bool
read_record_header
(
const
ARLIndexHeader
&
iheader
,
bool
read_record_header
(
const
ARLIndexHeader
&
iheader
,
ARLRecordHeader
&
rheader
);
ARLRecordHeader
&
rheader
);
bool
write_record_header
(
const
ARLIndexHeader
&
iheader
,
const
ARLRecordHeader
&
rheader
);
/**
/**
* @brief read_record Reads a single record from the stream
* @brief read_record Reads a single record from the stream
...
@@ -77,7 +80,9 @@ class RADIX_PUBLIC ARLDataStream
...
@@ -77,7 +80,9 @@ class RADIX_PUBLIC ARLDataStream
std
::
vector
<
std
::
vector
<
double
>
>&
record
);
std
::
vector
<
std
::
vector
<
double
>
>&
record
);
// TODO
// TODO
// bool write_record(const ARLRecord& record);
bool
write_record
(
const
ARLIndexHeader
&
iheader
,
const
ARLRecordHeader
&
rheader
,
const
std
::
vector
<
std
::
vector
<
double
>
>&
record
);
};
// class ARLDataStream
};
// class ARLDataStream
...
@@ -126,18 +131,6 @@ struct RADIX_PUBLIC ARLIndexHeader
...
@@ -126,18 +131,6 @@ struct RADIX_PUBLIC ARLIndexHeader
std
::
string
kvar
;
std
::
string
kvar
;
};
};
class
RADIX_PUBLIC
ARLRecord
{
// forward declare private implementation
class
PImpl
;
// unique pointer to private implmentation
std
::
unique_ptr
<
PImpl
,
void
(
*
)(
PImpl
*
)
>
p
;
public:
ARLRecord
();
ARLRecord
(
const
ARLRecord
&
orig
);
};
// ARLRecord
}
// namespace radix
}
// namespace radix
//#include "arldatastream.i.hh"
//#include "arldatastream.i.hh"
...
...
radixio/tests/tstArlDataStream.cc
View file @
ce22f586
...
@@ -85,6 +85,35 @@ TEST(RadixIO, ReadArlElements)
...
@@ -85,6 +85,35 @@ TEST(RadixIO, ReadArlElements)
EXPECT_NEAR
(
240.6
,
testRecord
[
143
][
72
],
240.6
*
tolerance
);
EXPECT_NEAR
(
240.6
,
testRecord
[
143
][
72
],
240.6
*
tolerance
);
}
}
TEST
(
RadixIO
,
WriteArlElements
)
{
double
tolerance
=
0.001
;
std
::
string
testFile
=
"/home/ohp/data/met/RP195111.gbl"
;
ARLDataStream
testStream
(
testFile
);
// Read the initial index header
ARLIndexHeader
testTopIndexHeader
;
bool
success
=
testStream
.
read_index_header
(
testTopIndexHeader
);
ASSERT_TRUE
(
success
);
ARLRecordHeader
testRecordHeader
;
success
=
testStream
.
read_record_header
(
testTopIndexHeader
,
testRecordHeader
);
ASSERT_TRUE
(
success
);
// Read the data starting from the next index header
ARLIndexHeader
testIndexHeader
;
success
=
testStream
.
read_next_index_header
(
testIndexHeader
);
ASSERT_TRUE
(
success
);
// Read data
std
::
vector
<
std
::
vector
<
double
>>
testRecord
;
success
=
testStream
.
read_record
(
testIndexHeader
,
testRecordHeader
,
testRecord
);
ASSERT_TRUE
(
success
);
// Write this data back out to a file
}
// TEST(RadixIO, ReadArlWholeFile)
// TEST(RadixIO, ReadArlWholeFile)
//{
//{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment