Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
DP3
Merge requests
!977
AST-1246
Support partially copying DPBuffer
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
AST-1246
Support partially copying DPBuffer
ast-1246-partial-dpbuffer-copy
into
master
Overview
1
Commits
3
Pipelines
2
Changes
3
Merged
Maik Nijhuis
requested to merge
ast-1246-partial-dpbuffer-copy
into
master
1 year ago
Overview
1
Commits
3
Pipelines
2
Changes
3
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d6d2805e
3 commits,
1 year ago
3 files
+
70
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
base/test/unit/tDPBuffer.cc
+
40
−
1
Options
@@ -8,6 +8,7 @@
#include
<dp3/base/DPBuffer.h>
using
dp3
::
base
::
DPBuffer
;
using
dp3
::
common
::
Fields
;
namespace
{
const
double
kTime
=
42.0
;
@@ -157,8 +158,46 @@ BOOST_AUTO_TEST_CASE(copy_to_reference_copy) {
CheckIndependent
(
source
,
copy
);
}
BOOST_AUTO_TEST_CASE
(
copy_partially
)
{
const
DPBuffer
source
=
CreateFilledBuffer
();
const
DPBuffer
no_fields
(
source
,
Fields
());
BOOST_CHECK_EQUAL
(
source
.
getTime
(),
no_fields
.
getTime
());
BOOST_CHECK_EQUAL
(
source
.
getExposure
(),
no_fields
.
getExposure
());
BOOST_CHECK_EQUAL
(
source
.
getRowNrs
().
data
(),
no_fields
.
getRowNrs
().
data
());
BOOST_CHECK_EQUAL
(
no_fields
.
GetData
().
size
(),
0
);
BOOST_CHECK
(
!
no_fields
.
HasData
(
kFooDataName
));
BOOST_CHECK
(
!
no_fields
.
HasData
(
kBarDataName
));
BOOST_CHECK_EQUAL
(
no_fields
.
GetWeights
().
size
(),
0
);
BOOST_CHECK_EQUAL
(
no_fields
.
GetFlags
().
size
(),
0
);
BOOST_CHECK_EQUAL
(
no_fields
.
GetUvw
().
size
(),
0
);
const
DPBuffer
data_and_uvw
(
source
,
Fields
(
Fields
::
Single
::
kData
)
|
Fields
(
Fields
::
Single
::
kUvw
));
BOOST_CHECK_EQUAL
(
data_and_uvw
.
GetWeights
().
size
(),
0
);
BOOST_CHECK_EQUAL
(
data_and_uvw
.
GetFlags
().
size
(),
0
);
BOOST_CHECK_EQUAL
(
source
.
GetData
(),
data_and_uvw
.
GetData
());
// TODO(AST-1241): Test copying extra data when the Fields support it.
BOOST_CHECK
(
!
data_and_uvw
.
HasData
(
kFooDataName
));
BOOST_CHECK
(
!
data_and_uvw
.
HasData
(
kBarDataName
));
BOOST_CHECK_EQUAL
(
source
.
GetUvw
(),
data_and_uvw
.
GetUvw
());
BOOST_CHECK_NE
(
source
.
GetData
().
data
(),
data_and_uvw
.
GetData
().
data
());
BOOST_CHECK_NE
(
source
.
GetUvw
().
data
(),
data_and_uvw
.
GetUvw
().
data
());
const
DPBuffer
weights_and_flags
(
source
,
Fields
(
Fields
::
Single
::
kWeights
)
|
Fields
(
Fields
::
Single
::
kFlags
));
BOOST_CHECK_EQUAL
(
weights_and_flags
.
GetData
().
size
(),
0
);
BOOST_CHECK
(
!
weights_and_flags
.
HasData
(
kFooDataName
));
BOOST_CHECK
(
!
weights_and_flags
.
HasData
(
kBarDataName
));
BOOST_CHECK_EQUAL
(
weights_and_flags
.
GetUvw
().
size
(),
0
);
BOOST_CHECK_EQUAL
(
source
.
GetWeights
(),
weights_and_flags
.
GetWeights
());
BOOST_CHECK_EQUAL
(
source
.
GetFlags
(),
weights_and_flags
.
GetFlags
());
BOOST_CHECK_NE
(
source
.
GetWeights
().
data
(),
weights_and_flags
.
GetWeights
().
data
());
BOOST_CHECK_NE
(
source
.
GetFlags
().
data
(),
weights_and_flags
.
GetFlags
().
data
());
}
BOOST_AUTO_TEST_CASE
(
make_independent
)
{
using
dp3
::
common
::
Fields
;
const
DPBuffer
source
=
CreateFilledBuffer
();
DPBuffer
copy
(
source
);
// 'copy' gets references (see copy_constructor test).
CheckDependent
(
source
,
copy
);
Loading