Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
6b6cb6eb
Commit
6b6cb6eb
authored
Mar 02, 2012
by
Russell Taylor
Browse files
Clear a couple of MSVC warnings. Re #4473.
Also move some definitions from the PeaksWorkspace header to the cpp.
parent
0fce0283
Changes
4
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
View file @
6b6cb6eb
...
...
@@ -70,7 +70,7 @@ namespace API
/** Removes the indicated peak
* @param peakNum the peak to remove. peakNum starts at 0
*/
virtual
void
removePeak
(
const
int
peakNum
)
=
0
;
virtual
void
removePeak
(
int
peakNum
)
=
0
;
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
...
...
@@ -83,7 +83,7 @@ namespace API
* @param peakNum :: index of the peak to get.
* @return a reference to a Peak object.
*/
virtual
IPeak
&
getPeak
(
const
int
peakNum
)
=
0
;
virtual
IPeak
&
getPeak
(
int
peakNum
)
=
0
;
//---------------------------------------------------------------------------------------------
/** Return a pointer to the Peak
...
...
Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
View file @
6b6cb6eb
...
...
@@ -87,77 +87,14 @@ namespace DataObjects
void
sort
(
std
::
vector
<
std
::
pair
<
std
::
string
,
bool
>
>
&
criteria
);
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
int
getNumberPeaks
()
const
{
return
int
(
peaks
.
size
());
}
//---------------------------------------------------------------------------------------------
/** Removes the indicated peak
* @param peakNum the peak to remove. peakNum starts at 0
*/
void
removePeak
(
const
int
peakNum
)
{
if
(
peakNum
>=
static_cast
<
int
>
(
peaks
.
size
())
||
peakNum
<
0
)
throw
std
::
invalid_argument
(
"PeaksWorkspace::removePeak(): peakNum is out of range."
);
peaks
.
erase
(
peaks
.
begin
()
+
peakNum
);
}
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
* @param ipeak :: Peak object to add (copy) into this.
*/
void
addPeak
(
const
API
::
IPeak
&
ipeak
)
{
if
(
dynamic_cast
<
const
Peak
*>
(
&
ipeak
))
{
peaks
.
push_back
((
const
Peak
&
)
ipeak
);
}
else
{
peaks
.
push_back
(
Peak
(
ipeak
));
}
}
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak
* @param peakNum :: index of the peak to get.
* @return a reference to a Peak object.
*/
API
::
IPeak
&
getPeak
(
const
int
peakNum
)
{
if
(
peakNum
>=
static_cast
<
int
>
(
peaks
.
size
())
||
peakNum
<
0
)
throw
std
::
invalid_argument
(
"PeaksWorkspace::getPeak(): peakNum is out of range."
);
return
peaks
[
peakNum
];
}
//---------------------------------------------------------------------------------------------
/** Create an instance of a Peak
* @param QLabFrame :: Q of the center of the peak, in reciprocal space
* @param detectorDistance :: distance between the sample and the detector.
* @return a pointer to a new Peak object.
*/
API
::
IPeak
*
createPeak
(
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
=
1.0
)
{
return
new
Peak
(
this
->
getInstrument
(),
QLabFrame
,
detectorDistance
);
}
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peaks vector */
std
::
vector
<
Peak
>
&
getPeaks
()
{
return
peaks
;
}
//---------------------------------------------------------------------------------------------
/// Return the memory used in bytes
virtual
size_t
getMemorySize
()
const
{
return
getNumberPeaks
()
*
sizeof
(
Peak
);
}
int
getNumberPeaks
()
const
;
void
removePeak
(
int
peakNum
);
void
addPeak
(
const
API
::
IPeak
&
ipeak
);
API
::
IPeak
&
getPeak
(
int
peakNum
);
API
::
IPeak
*
createPeak
(
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
=
1.0
);
std
::
vector
<
Peak
>
&
getPeaks
();
virtual
size_t
getMemorySize
()
const
;
// ====================================== ITableWorkspace Methods ==================================
/// Number of columns in the workspace.
...
...
Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
View file @
6b6cb6eb
...
...
@@ -185,6 +185,77 @@ namespace DataObjects
std
::
stable_sort
(
peaks
.
begin
(),
peaks
.
end
(),
comparator
);
}
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
*/
int
PeaksWorkspace
::
getNumberPeaks
()
const
{
return
int
(
peaks
.
size
());
}
//---------------------------------------------------------------------------------------------
/** Removes the indicated peak
* @param peakNum the peak to remove. peakNum starts at 0
*/
void
PeaksWorkspace
::
removePeak
(
const
int
peakNum
)
{
if
(
peakNum
>=
static_cast
<
int
>
(
peaks
.
size
())
||
peakNum
<
0
)
throw
std
::
invalid_argument
(
"PeaksWorkspace::removePeak(): peakNum is out of range."
);
peaks
.
erase
(
peaks
.
begin
()
+
peakNum
);
}
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
* @param ipeak :: Peak object to add (copy) into this.
*/
void
PeaksWorkspace
::
addPeak
(
const
API
::
IPeak
&
ipeak
)
{
if
(
dynamic_cast
<
const
Peak
*>
(
&
ipeak
))
{
peaks
.
push_back
((
const
Peak
&
)
ipeak
);
}
else
{
peaks
.
push_back
(
Peak
(
ipeak
));
}
}
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak
* @param peakNum :: index of the peak to get.
* @return a reference to a Peak object.
*/
API
::
IPeak
&
PeaksWorkspace
::
getPeak
(
const
int
peakNum
)
{
if
(
peakNum
>=
static_cast
<
int
>
(
peaks
.
size
())
||
peakNum
<
0
)
throw
std
::
invalid_argument
(
"PeaksWorkspace::getPeak(): peakNum is out of range."
);
return
peaks
[
peakNum
];
}
//---------------------------------------------------------------------------------------------
/** Create an instance of a Peak
* @param QLabFrame :: Q of the center of the peak, in reciprocal space
* @param detectorDistance :: distance between the sample and the detector.
* @return a pointer to a new Peak object.
*/
API
::
IPeak
*
PeaksWorkspace
::
createPeak
(
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
)
{
return
new
Peak
(
this
->
getInstrument
(),
QLabFrame
,
detectorDistance
);
}
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peaks vector */
std
::
vector
<
Peak
>
&
PeaksWorkspace
::
getPeaks
()
{
return
peaks
;
}
//---------------------------------------------------------------------------------------------
/// Return the memory used in bytes
size_t
PeaksWorkspace
::
getMemorySize
()
const
{
return
getNumberPeaks
()
*
sizeof
(
Peak
);
}
//---------------------------------------------------------------------------------------------
/** Destructor */
...
...
Code/Mantid/Vates/VatesAPI/test/vtkPeakMarkerFactoryTest.h
View file @
6b6cb6eb
...
...
@@ -32,9 +32,9 @@ public:
MOCK_METHOD0
(
getInstrument
,
Mantid
::
Geometry
::
Instrument_const_sptr
());
MOCK_CONST_METHOD0
(
clone
,
Mantid
::
DataObjects
::
PeaksWorkspace
*
());
MOCK_CONST_METHOD0
(
getNumberPeaks
,
int
());
MOCK_METHOD1
(
removePeak
,
void
(
const
int
peakNum
)
);
MOCK_METHOD1
(
removePeak
,
void
(
int
peakNum
)
);
MOCK_METHOD1
(
addPeak
,
void
(
const
IPeak
&
ipeak
));
MOCK_METHOD1
(
getPeak
,
Mantid
::
API
::
IPeak
&
(
const
int
peakNum
));
MOCK_METHOD1
(
getPeak
,
Mantid
::
API
::
IPeak
&
(
int
peakNum
));
MOCK_METHOD2
(
createPeak
,
Mantid
::
API
::
IPeak
*
(
Mantid
::
Kernel
::
V3D
QLabFrame
,
double
detectorDistance
));
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment