Commit 597dc38d authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #7386. Rename functions.

parent b2d1be39
......@@ -46,7 +46,7 @@ namespace API
virtual void setHKL(double H, double K, double L) = 0;
virtual void setHKL(Mantid::Kernel::V3D HKL) = 0;
virtual Mantid::Kernel::V3D getDetectorPosition() const = 0;
virtual Mantid::Kernel::V3D getDetectorPositionSafe() const = 0;
virtual Mantid::Kernel::V3D getDetectorPositionNoCheck() const = 0;
virtual Mantid::Kernel::V3D getQLabFrame() const = 0;
virtual Mantid::Kernel::V3D getQSampleFrame() const = 0;
......
......@@ -70,7 +70,7 @@ namespace DataObjects
Mantid::Kernel::V3D getQLabFrame() const;
Mantid::Kernel::V3D getQSampleFrame() const;
Mantid::Kernel::V3D getDetectorPosition() const;
Mantid::Kernel::V3D getDetectorPositionSafe() const;
Mantid::Kernel::V3D getDetectorPositionNoCheck() const;
void setQSampleFrame(Mantid::Kernel::V3D QSampleFrame, double detectorDistance=1.0);
void setQLabFrame(Mantid::Kernel::V3D QLabFrame, double detectorDistance=1.0);
......
......@@ -807,7 +807,7 @@ namespace DataObjects
/**
Forwarding function. Exposes the detector position directly.
*/
Mantid::Kernel::V3D Peak::getDetectorPosition() const
Mantid::Kernel::V3D Peak::getDetectorPositionNoCheck() const
{
return getDetector()->getPos();
}
......@@ -816,7 +816,7 @@ namespace DataObjects
Forwarding function. Exposes the detector position directly, but checks that the detector is not null before
accessing its position. Throws if null.
*/
Mantid::Kernel::V3D Peak::getDetectorPositionSafe() const
Mantid::Kernel::V3D Peak::getDetectorPosition() const
{
auto det = getDetector();
if(det == NULL)
......
......@@ -330,14 +330,14 @@ public:
TS_ASSERT_EQUALS( p2.getDetectorID(), 19999);
}
void test_getDetectorPositionSafe()
void test_getDetectorPosition()
{
const int detectorId = 19999;
const double wavelength = 2;
Peak p(inst, detectorId, wavelength);
V3D a = p.getDetectorPosition();
V3D b = p.getDetectorPositionSafe();
V3D b = p.getDetectorPositionNoCheck();
TSM_ASSERT_EQUALS("Results should be the same", a, b);
}
......@@ -347,9 +347,9 @@ public:
const int detectorId = 19999;
const double wavelength = 2;
Peak p(inst, detectorId, wavelength);
TSM_ASSERT_THROWS_NOTHING("Nothing wrong here, detector is valid", p.getDetectorPositionSafe());
TSM_ASSERT_THROWS_NOTHING("Nothing wrong here, detector is valid", p.getDetectorPosition());
p.setQLabFrame(V3D(1,1,1), 1); // This sets the detector pointer to null and detector id to -1;
TSM_ASSERT_THROWS("Detector is not valid", p.getDetectorPositionSafe(), Mantid::Kernel::Exception::NotFoundError&);
TSM_ASSERT_THROWS("Detector is not valid", p.getDetectorPosition(), Mantid::Kernel::Exception::NotFoundError&);
}
private:
......
......@@ -236,7 +236,7 @@ class MockPeakTransformFactory : public PeakTransformFactory
double());
MOCK_CONST_METHOD0(getDetectorPosition,
Mantid::Kernel::V3D());
MOCK_CONST_METHOD0(getDetectorPositionSafe,
MOCK_CONST_METHOD0(getDetectorPositionNoCheck,
Mantid::Kernel::V3D());
};
......
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