Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
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
mantidproject
mantid
Commits
74a6db0f
Commit
74a6db0f
authored
6 years ago
by
Sam Jenkins
Browse files
Options
Downloads
Patches
Plain Diff
Re #23103 replaced some raw pointers in sample.h
parent
def6eab3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/API/inc/MantidAPI/Sample.h
+1
-1
1 addition, 1 deletion
Framework/API/inc/MantidAPI/Sample.h
Framework/API/src/Sample.cpp
+10
-16
10 additions, 16 deletions
Framework/API/src/Sample.cpp
with
11 additions
and
17 deletions
Framework/API/inc/MantidAPI/Sample.h
+
1
−
1
View file @
74a6db0f
...
...
@@ -127,7 +127,7 @@ private:
/// An owned pointer to the SampleEnvironment object
boost
::
shared_ptr
<
Geometry
::
SampleEnvironment
>
m_environment
;
/// Pointer to the OrientedLattice of the sample, NULL if not set.
Geometry
::
OrientedLattice
*
m_lattice
;
std
::
unique_ptr
<
Geometry
::
OrientedLattice
>
m_lattice
;
/// CrystalStructure of the sample
std
::
unique_ptr
<
Geometry
::
CrystalStructure
>
m_crystalStructure
;
...
...
This diff is collapsed.
Click to expand it.
Framework/API/src/Sample.cpp
+
10
−
16
View file @
74a6db0f
...
...
@@ -48,16 +48,16 @@ Sample::Sample(const Sample ©)
m_geom_id
(
copy
.
m_geom_id
),
m_thick
(
copy
.
m_thick
),
m_height
(
copy
.
m_height
),
m_width
(
copy
.
m_width
)
{
if
(
copy
.
m_lattice
)
m_lattice
=
new
OrientedLattice
(
copy
.
getOrientedLattice
());
m_lattice
=
std
::
make_unique
<
OrientedLattice
>
(
copy
.
getOrientedLattice
());
if
(
copy
.
hasCrystalStructure
())
{
m_crystalStructure
.
reset
(
new
Geometry
::
CrystalStructure
(
copy
.
getCrystalStructure
())
)
;
m_crystalStructure
=
std
::
make_unique
<
Geometry
::
CrystalStructure
>
(
copy
.
getCrystalStructure
());
}
}
/// Destructor
Sample
::~
Sample
()
{
delete
m_lattice
;
}
Sample
::~
Sample
()
{}
/** Assignment operator
* @param rhs :: const reference to the sample object
...
...
@@ -75,12 +75,10 @@ Sample &Sample::operator=(const Sample &rhs) {
m_thick
=
rhs
.
m_thick
;
m_height
=
rhs
.
m_height
;
m_width
=
rhs
.
m_width
;
if
(
m_lattice
!=
nullptr
)
delete
m_lattice
;
if
(
rhs
.
m_lattice
)
m_lattice
=
new
OrientedLattice
(
rhs
.
getOrientedLattice
());
m_lattice
=
std
::
make_unique
<
OrientedLattice
>
(
rhs
.
getOrientedLattice
());
else
m_lattice
=
nullptr
;
m_lattice
.
reset
(
nullptr
)
;
m_crystalStructure
.
reset
();
if
(
rhs
.
hasCrystalStructure
())
{
...
...
@@ -179,13 +177,10 @@ OrientedLattice &Sample::getOrientedLattice() {
* @param latt :: A pointer to a OrientedLattice.
*/
void
Sample
::
setOrientedLattice
(
OrientedLattice
*
latt
)
{
if
(
m_lattice
!=
nullptr
)
{
delete
m_lattice
;
}
if
(
latt
!=
nullptr
)
m_lattice
=
new
OrientedLattice
(
*
latt
);
m_lattice
=
std
::
make_unique
<
OrientedLattice
>
(
*
latt
);
else
m_lattice
=
nullptr
;
m_lattice
.
reset
(
nullptr
)
;
}
/** @return true if the sample has an OrientedLattice */
...
...
@@ -394,7 +389,7 @@ int Sample::loadNexus(::NeXus::File *file, const std::string &group) {
int
num_oriented_lattice
;
file
->
readData
(
"num_oriented_lattice"
,
num_oriented_lattice
);
if
(
num_oriented_lattice
>
0
)
{
m_lattice
=
new
OrientedLattice
;
m_lattice
=
std
::
make_unique
<
OrientedLattice
>
()
;
m_lattice
->
loadNexus
(
file
,
"oriented_lattice"
);
}
}
...
...
@@ -418,8 +413,7 @@ int Sample::loadNexus(::NeXus::File *file, const std::string &group) {
*/
void
Sample
::
clearOrientedLattice
()
{
if
(
m_lattice
)
{
delete
m_lattice
;
m_lattice
=
nullptr
;
m_lattice
.
reset
(
nullptr
);
}
}
}
// namespace API
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment