Skip to content

Commit

Permalink
Refs #11583 improvements for coverity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed Apr 20, 2015
1 parent 708af6c commit 8abd623
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 22 deletions.
Expand Up @@ -23,7 +23,7 @@ class DLLExport CompositePeaksPresenterVsi : public PeaksPresenterVsi {
}
std::vector<Mantid::API::IPeaksWorkspace_sptr> getPeaksWorkspaces() const;
virtual std::vector<bool> getViewablePeaks() const;
virtual void updateViewFrustum(ViewFrustum_sptr frustum);
virtual void updateViewFrustum(ViewFrustum_const_sptr frustum);
virtual std::string getFrame() const;
virtual std::string getPeaksWorkspaceName() const{
throw std::runtime_error(
Expand Down
Expand Up @@ -15,11 +15,11 @@ namespace VATES {
class DLLExport ConcretePeaksPresenterVsi : public PeaksPresenterVsi {
public:
ConcretePeaksPresenterVsi(Mantid::API::IPeaksWorkspace_sptr peaksWorkspace,
ViewFrustum_sptr frustum, std::string wsFrame);
ViewFrustum_const_sptr frustum, std::string wsFrame);
~ConcretePeaksPresenterVsi();
virtual Mantid::API::IPeaksWorkspace_sptr getPeaksWorkspace() const;
virtual std::vector<bool> getViewablePeaks() const;
virtual void updateViewFrustum(ViewFrustum_sptr frustum);
virtual void updateViewFrustum(ViewFrustum_const_sptr frustum);
virtual std::string getFrame() const;
virtual std::string getPeaksWorkspaceName() const;
virtual void
Expand All @@ -35,7 +35,7 @@ class DLLExport ConcretePeaksPresenterVsi : public PeaksPresenterVsi {
/// Viewable Peaks
mutable std::vector<bool> m_viewablePeaks;
/// The viewable region
ViewFrustum_sptr m_viewableRegion;
ViewFrustum_const_sptr m_viewableRegion;
/// The peaks workspace
Mantid::API::IPeaksWorkspace_sptr m_peaksWorkspace;
/// The frame
Expand Down
Expand Up @@ -23,7 +23,7 @@ class DLLExport NullPeaksPresenterVsi : public PeaksPresenterVsi {
throw std::runtime_error(
"NullPeaksPresenterVsi does not implement this method. Misused");
}
virtual void updateViewFrustum(ViewFrustum_sptr) {}
virtual void updateViewFrustum(ViewFrustum_const_sptr) {}
virtual std::string getFrame() const {
throw std::runtime_error(
"NullPeaksPresenterVsi does not implement this method. Misused");
Expand Down
Expand Up @@ -17,7 +17,7 @@ class DLLExport PeaksPresenterVsi {
virtual ~PeaksPresenterVsi(){};
virtual std::vector<bool> getViewablePeaks() const = 0;
virtual Mantid::API::IPeaksWorkspace_sptr getPeaksWorkspace() const = 0;
virtual void updateViewFrustum(ViewFrustum_sptr frustum) = 0;
virtual void updateViewFrustum(ViewFrustum_const_sptr frustum) = 0;
virtual std::string getFrame() const = 0;
virtual std::string getPeaksWorkspaceName() const = 0;
virtual void getPeaksInfo(Mantid::API::IPeaksWorkspace_sptr peaksWorkspace,
Expand Down
Expand Up @@ -174,6 +174,7 @@ class DLLExport ViewFrustum

/// shared pointer to the view frustum
typedef boost::shared_ptr<Mantid::VATES::ViewFrustum> ViewFrustum_sptr;
typedef boost::shared_ptr<const Mantid::VATES::ViewFrustum> ViewFrustum_const_sptr;
}
}
#endif
Expand Up @@ -17,7 +17,7 @@ CompositePeaksPresenterVsi::~CompositePeaksPresenterVsi() {}
* Update the view frustum
* @param frustum The view frustum
*/
void CompositePeaksPresenterVsi::updateViewFrustum(ViewFrustum_sptr frustum) {
void CompositePeaksPresenterVsi::updateViewFrustum(ViewFrustum_const_sptr frustum) {
for (std::vector<PeaksPresenterVsi_sptr>::iterator it =
m_peaksPresenters.begin();
it != m_peaksPresenters.end(); ++it) {
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Vates/VatesAPI/src/ConcretePeaksPresenterVsi.cpp
Expand Up @@ -17,7 +17,7 @@ namespace VATES {
* @param frame The coordinate frame
*/
ConcretePeaksPresenterVsi::ConcretePeaksPresenterVsi(
Mantid::API::IPeaksWorkspace_sptr peaksWorkspace, ViewFrustum_sptr frustum,
Mantid::API::IPeaksWorkspace_sptr peaksWorkspace, ViewFrustum_const_sptr frustum,
std::string frame)
: m_viewableRegion(frustum), m_peaksWorkspace(peaksWorkspace),
m_frame(frame) {}
Expand All @@ -29,7 +29,7 @@ ConcretePeaksPresenterVsi::~ConcretePeaksPresenterVsi() {}
* Update the view frustum
* @param frustum The view frustum.
*/
void ConcretePeaksPresenterVsi::updateViewFrustum(ViewFrustum_sptr frustum) {
void ConcretePeaksPresenterVsi::updateViewFrustum(ViewFrustum_const_sptr frustum) {
m_viewableRegion = frustum;
}

Expand Down
Expand Up @@ -10,6 +10,7 @@


#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <stdexcept>

#include "MockObjects.h"
Expand Down Expand Up @@ -60,7 +61,7 @@ class CompositePeaksPresenterVsiTest : public CxxTest::TestSuite {
TopPlane top(0.0, -1.0, 0.0, 1.0);
FarPlane farPlane(0.0, 0.0, 1.0, 1.0);
NearPlane nearPlane(0.0, 0.0, -1.0,1.0);
ViewFrustum_sptr frustum(new ViewFrustum(left, right, bottom, top, farPlane, nearPlane));
ViewFrustum_const_sptr frustum = boost::make_shared<const Mantid::VATES::ViewFrustum>(left, right, bottom, top, farPlane, nearPlane);

boost::shared_ptr<MockPeaksWorkspaceComposite> pw_ptr(new MockPeaksWorkspaceComposite());

Expand Down Expand Up @@ -95,7 +96,7 @@ class CompositePeaksPresenterVsiTest : public CxxTest::TestSuite {
TopPlane top(0.0, -1.0, 0.0, 1.0);
FarPlane farPlane(0.0, 0.0, 1.0, 1.0);
NearPlane nearPlane(0.0, 0.0, -1.0,1.0);
ViewFrustum_sptr frustum(new ViewFrustum(left, right, bottom, top, farPlane, nearPlane));
ViewFrustum_const_sptr frustum = boost::make_shared<const Mantid::VATES::ViewFrustum>(left, right, bottom, top, farPlane, nearPlane);

boost::shared_ptr<MockPeaksWorkspaceComposite> pw_ptr(new MockPeaksWorkspaceComposite());
std::string name = "pw1";
Expand Down
Expand Up @@ -12,6 +12,7 @@
#include "MantidKernel/V3D.h"
#include "MockObjects.h"
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>

#include <cxxtest/TestSuite.h>
#include <gmock/gmock.h>
Expand Down Expand Up @@ -53,7 +54,7 @@ class ConcretePeaksPresenterVsiTest : public CxxTest::TestSuite {
TopPlane top(0.0, -1.0, 0.0, 1.0);
FarPlane farPlane(0.0, 0.0, 1.0, 1.0);
NearPlane nearPlane(0.0, 0.0, -1.0,1.0);
ViewFrustum_sptr frustum(new ViewFrustum(left, right, bottom, top, farPlane, nearPlane));
ViewFrustum_const_sptr frustum = boost::make_shared<const Mantid::VATES::ViewFrustum>(left, right, bottom, top, farPlane, nearPlane);

boost::shared_ptr<MockPeaksWorkspaceConcrete> pw_ptr(new MockPeaksWorkspaceConcrete());
// Act
Expand All @@ -73,7 +74,7 @@ class ConcretePeaksPresenterVsiTest : public CxxTest::TestSuite {
TopPlane top(0.0, -1.0, 0.0, 1.0);
FarPlane farPlane(0.0, 0.0, 1.0, 1.0);
NearPlane nearPlane(0.0, 0.0, -1.0,1.0);
ViewFrustum_sptr frustum(new ViewFrustum(left, right, bottom, top, farPlane, nearPlane));
ViewFrustum_const_sptr frustum = boost::make_shared<const Mantid::VATES::ViewFrustum>(left, right, bottom, top, farPlane, nearPlane);

Mantid::Kernel::V3D coordinate(1,0,0);
double peakRadius = 10;
Expand Down
Expand Up @@ -4,6 +4,7 @@
#include "MantidVatesSimpleGuiViewWidgets/WidgetDllOption.h"
#include "MantidVatesAPI/ViewFrustum.h"


namespace Mantid
{
namespace Vates
Expand Down Expand Up @@ -45,7 +46,7 @@ class EXPORT_OPT_MANTIDVATES_SIMPLEGUI_VIEWWIDGETS CameraManager

~CameraManager();

Mantid::VATES::ViewFrustum_sptr getCurrentViewFrustum();
Mantid::VATES::ViewFrustum_const_sptr getCurrentViewFrustum();

void setCameraToPeak(double xpos, double ypos, double zpos, double peakRadius);
};
Expand Down
Expand Up @@ -12,7 +12,7 @@
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>

#include <boost/make_shared.hpp>
namespace Mantid
{
namespace Vates
Expand All @@ -30,7 +30,7 @@ namespace Mantid
/**
* Get the plane equation for the view frustum.
*/
Mantid::VATES::ViewFrustum_sptr CameraManager::getCurrentViewFrustum()
Mantid::VATES::ViewFrustum_const_sptr CameraManager::getCurrentViewFrustum()
{
double left[4];
double right[4];
Expand Down Expand Up @@ -88,12 +88,12 @@ namespace Mantid
far[k] = planes[k + 20];
}

Mantid::VATES::ViewFrustum_sptr frustum(new Mantid::VATES::ViewFrustum(Mantid::VATES::LeftPlane(left[0], left[1], left[2], left[3]),
Mantid::VATES::RightPlane(right[0], right[1], right[2], right[3]),
Mantid::VATES::BottomPlane(bottom[0], bottom[1], bottom[2], bottom[3]),
Mantid::VATES::TopPlane(top[0], top[1], top[2], top[3]),
Mantid::VATES::FarPlane(far[0], far[1], far[2], far[3]),
Mantid::VATES::NearPlane(near[0], near[1], near[2], near[3])));
Mantid::VATES::ViewFrustum_const_sptr frustum = boost::make_shared<const Mantid::VATES::ViewFrustum>(Mantid::VATES::LeftPlane(left[0], left[1], left[2], left[3]),
Mantid::VATES::RightPlane(right[0], right[1], right[2], right[3]),
Mantid::VATES::BottomPlane(bottom[0], bottom[1], bottom[2], bottom[3]),
Mantid::VATES::TopPlane(top[0], top[1], top[2], top[3]),
Mantid::VATES::FarPlane(far[0], far[1], far[2], far[3]),
Mantid::VATES::NearPlane(near[0], near[1], near[2], near[3]));

return frustum;
}
Expand Down
Expand Up @@ -11,6 +11,7 @@
#include "MantidKernel/V3D.h"
#include "MantidKernel/SpecialCoordinateSystem.h"
#include "MantidKernel/Logger.h"
#include "MantidVatesAPI/ViewFrustum.h"
#include "MantidVatesAPI/PeaksPresenterVsi.h"
#include "MantidVatesAPI/NullPeaksPresenterVsi.h"
#include "MantidVatesAPI/ConcretePeaksPresenterVsi.h"
Expand Down

0 comments on commit 8abd623

Please sign in to comment.