Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial implementation of MaskWorkspace. refs #5045

Functional version - but no specific methods yet.
Not used anywhere yet.
  • Loading branch information...
commit dc300f62c6c9b4392587abf4da239e3bffd914ea 1 parent 5241251
@stuartcampbell stuartcampbell authored
View
3  Code/Mantid/Framework/DataObjects/CMakeLists.txt
@@ -11,6 +11,7 @@ set ( SRC_FILES
src/ManagedDataBlock2D.cpp
src/ManagedHistogram1D.cpp
src/ManagedWorkspace2D.cpp
+ src/MaskWorkspace.cpp
src/MementoTableWorkspace.cpp
src/OffsetsWorkspace.cpp
src/Peak.cpp
@@ -43,6 +44,7 @@ set ( INC_FILES
inc/MantidDataObjects/ManagedDataBlock2D.h
inc/MantidDataObjects/ManagedHistogram1D.h
inc/MantidDataObjects/ManagedWorkspace2D.h
+ inc/MantidDataObjects/MaskWorkspace.h
inc/MantidDataObjects/MementoTableWorkspace.h
inc/MantidDataObjects/OffsetsWorkspace.h
inc/MantidDataObjects/Peak.h
@@ -66,6 +68,7 @@ set ( TEST_FILES
test/ManagedDataBlock2DTest.h
test/ManagedHistogram1DTest.h
test/ManagedWorkspace2DTest.h
+ test/MaskWorkspaceTest.h
test/MementoTableWorkspaceTest.h
test/OffsetsWorkspaceTest.h
test/PeakColumnTest.h
View
42 Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/MaskWorkspace.h
@@ -0,0 +1,42 @@
+#ifndef MANTID_DATAOBJECTS_MASKWORKSPACE_H
+#define MANTID_DATAOBJECTS_MASKWORKSPACE_H
+
+#include "MantidAPI/MatrixWorkspace.h"
+#include "MantidDataObjects/SpecialWorkspace2D.h"
+#include "MantidDataObjects/Workspace2D.h"
+#include "MantidKernel/System.h"
+
+namespace Mantid
+{
+namespace DataObjects
+{
+
+ class DLLExport MaskWorkspace : public SpecialWorkspace2D
+ {
+ public:
+ MaskWorkspace();
+ MaskWorkspace(std::size_t numvectors);
+ MaskWorkspace(Mantid::Geometry::Instrument_const_sptr instrument);
+ ~MaskWorkspace();
+
+ virtual const std::string id() const;
+
+ private:
+ /// Private copy constructor. NO COPY ALLOWED
+ MaskWorkspace(const MaskWorkspace&);
+ /// Private copy assignment operator. NO ASSIGNMENT ALLOWED
+ MaskWorkspace& operator=(const MaskWorkspace&);
+
+ };
+
+ ///shared pointer to the MaskWorkspace class
+ typedef boost::shared_ptr<MaskWorkspace> MaskWorkspace_sptr;
+
+ ///shared pointer to a const MaskWorkspace
+ typedef boost::shared_ptr<const MaskWorkspace> MaskWorkspace_const_sptr;
+
+} // namespace DataObjects
+} // namespace Mantid
+
+
+#endif // MANTID_DATAOBJECTS_MASKWORKSPACE_H
View
110 Code/Mantid/Framework/DataObjects/src/MaskWorkspace.cpp
@@ -0,0 +1,110 @@
+#include "MantidDataObjects/MaskWorkspace.h"
+#include "MantidKernel/System.h"
+#include "MantidAPI/WorkspaceFactory.h"
+
+namespace Mantid
+{
+namespace DataObjects
+{
+
+ //Register the workspace
+ DECLARE_WORKSPACE(MaskWorkspace)
+
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor - Default.
+ * @return MaskWorkspace
+ */
+ MaskWorkspace::MaskWorkspace()
+ {
+ }
+
+ /**
+ * Constructor - with a given dimension.
+ * @param[in] numvectors Number of vectors/histograms for this workspace.
+ * @return MaskWorkspace
+ */
+ MaskWorkspace::MaskWorkspace(std::size_t numvectors)
+ {
+ this->init(numvectors, 1, 1);
+ }
+
+ /**
+ * Constructor - using an instrument.
+ * @param[in] instrument Instrument that is the base for this workspace.
+ * @return MaskWorkspace
+ */
+ MaskWorkspace::MaskWorkspace(Mantid::Geometry::Instrument_const_sptr instrument)
+ : SpecialWorkspace2D(instrument)
+ {
+ }
+
+ //--------------------------------------------------------------------------
+
+ /**
+ * Destructor
+ */
+ MaskWorkspace::~MaskWorkspace()
+ {
+
+ }
+
+ //--------------------------------------------------------------------------
+
+ /**
+ * Gets the name of the workspace type.
+ * @return Standard string name
+ */
+ const std::string MaskWorkspace::id() const
+ {
+ return "MaskWorkspace";
+ }
+
+} //namespace DataObjects
+} //namespace Mantid
+
+
+///\cond TEMPLATE
+
+namespace Mantid
+{
+ namespace Kernel
+ {
+
+ template<> DLLExport
+ Mantid::DataObjects::MaskWorkspace_sptr IPropertyManager::getValue<Mantid::DataObjects::MaskWorkspace_sptr>(const std::string &name) const
+ {
+ PropertyWithValue<Mantid::DataObjects::MaskWorkspace_sptr>* prop =
+ dynamic_cast<PropertyWithValue<Mantid::DataObjects::MaskWorkspace_sptr>*>(getPointerToProperty(name));
+ if (prop)
+ {
+ return *prop;
+ }
+ else
+ {
+ std::string message = "Attempt to assign property "+ name +" to incorrect type. Expected MaskWorkspace.";
+ throw std::runtime_error(message);
+ }
+ }
+
+ template<> DLLExport
+ Mantid::DataObjects::MaskWorkspace_const_sptr IPropertyManager::getValue<Mantid::DataObjects::MaskWorkspace_const_sptr>(const std::string &name) const
+ {
+ PropertyWithValue<Mantid::DataObjects::MaskWorkspace_sptr>* prop =
+ dynamic_cast<PropertyWithValue<Mantid::DataObjects::MaskWorkspace_sptr>*>(getPointerToProperty(name));
+ if (prop)
+ {
+ return prop->operator()();
+ }
+ else
+ {
+ std::string message = "Attempt to assign property "+ name +" to incorrect type. Expected const MaskWorkspace.";
+ throw std::runtime_error(message);
+ }
+ }
+
+ } // namespace Kernel
+} // namespace Mantid
+
+///\endcond TEMPLATE
View
18 Code/Mantid/Framework/DataObjects/test/MaskWorkspaceTest.h
@@ -0,0 +1,18 @@
+#ifndef MANTID_DATAOBJECTS_MASKWORKSPACETEST_H
+#define MANTID_DATAOBJECTS_MASKWORKSPACETEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "MantidDataObjects/MaskWorkspace.h"
+
+class MaskWorkspaceTest : public CxxTest::TestSuite
+{
+public:
+
+ void test_Nothing()
+ {
+ //TODO: Test Something!
+ }
+};
+
+#endif // MANTID_DATAOBJECTS_MASKWORKSPACETEST_H
Please sign in to comment.
Something went wrong with that request. Please try again.