Skip to content
Snippets Groups Projects
Commit 023bb950 authored by Anton Piccardo-Selg's avatar Anton Piccardo-Selg
Browse files

Refs #10833 Rename knowledge serializer

parent d4363304
No related branches found
No related tags found
No related merge requests found
......@@ -22,12 +22,12 @@ src/MedianAndBelowThresholdRange.cpp
src/MetadataToFieldData.cpp
src/NoThresholdRange.cpp
src/ProgressAction.cpp
src/RebinningKnowledgeSerializer.cpp
src/SynchronisingGeometryPresenter.cpp
src/TimeStepToTimeStep.cpp
src/TimeToTimeStep.cpp
src/UserDefinedThresholdRange.cpp
src/VatesXMLDefinitions.cpp
src/VatesKnowledgeSerializer.cpp
src/vtkDataSetFactory.cpp
src/vtkDataSetToGeometry.cpp
src/vtkDataSetToImplicitFunction.cpp
......@@ -74,14 +74,14 @@ inc/MantidVatesAPI/IMDDimensionComparitor.h
inc/MantidVatesAPI/MetadataToFieldData.h
inc/MantidVatesAPI/NoThresholdRange.h
inc/MantidVatesAPI/ProgressAction.h
inc/MantidVatesAPI/RebinningKnowledgeSerializer.h
inc/MantidVatesAPI/SQWLoadingPresenter.h
inc/MantidVatesAPI/SynchronisingGeometryPresenter.h
inc/MantidVatesAPI/ThresholdRange.h
inc/MantidVatesAPI/TimeStepToTimeStep.h
inc/MantidVatesAPI/TimeToTimeStep.h
inc/MantidVatesAPI/UserDefinedThresholdRange.h
inc/MantidVatesAPI/VatesXMLDefinitions.h
inc/MantidVatesAPI/VatesXMLDefinitions.h
inc/MantidVatesAPI/VatesKnowledgeSerializer.h
inc/MantidVatesAPI/vtkDataSetFactory.h
inc/MantidVatesAPI/vtkDataSetToGeometry.h
inc/MantidVatesAPI/vtkDataSetToImplicitFunction.h
......@@ -130,7 +130,6 @@ test/MDHWInMemoryLoadingPresenterTest.h
test/MDHWLoadingPresenterTest.h
test/MDHWNexusLoadingPresenterTest.h
test/MetadataToFieldDataTest.h
test/RebinningKnowledgeSerializerTest.h
test/SQWLoadingPresenterTest.h
test/SynchronisingGeometryPresenterTest.h
test/TimeStepToTimeStepTest.h
......@@ -139,6 +138,7 @@ test/UserDefinedThresholdRangeTest.h
test/MedianAndBelowThresholdRangeTest.h
test/NoThresholdRangeTest.h
test/IgnoreZerosThresholdRangeTest.h
test/VatesKnowledgeSerializerTest.h
test/vtkDataSetToScaledDataSetTest.h
test/vtkDataSetToNonOrthogonalDataSetTest.h
)
......
#ifndef VATES_REBINNING_KNOWLEDGE_SERIALIZER_H
#define VATES_REBINNING_KNOWLEDGE_SERIALIZER_H
#ifndef VATES_KNOWLEDGE_SERIALIZER_H
#define VATES_KNOWLEDGE_SERIALIZER_H
#include <boost/shared_ptr.hpp>
#include <string>
......@@ -24,8 +24,7 @@ enum LocationPolicy{LocationMandatory, LocationNotRequired};
/**
This type assists with the generation of well-formed xml meeting the xsd scehema layed-out for
Rebinning/cutting type operations. The individual components utilised here may not be able to form well-formed
This type assists with the generation of well-formed xml meeting the xsd scehema. The individual components utilised here may not be able to form well-formed
xml in their own right and therefore do not have a toXMLString method.
This implementation is based on a builder pattern using the create mechanism for xml string generation.
......@@ -53,7 +52,7 @@ enum LocationPolicy{LocationMandatory, LocationNotRequired};
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org> */
class DLLExport RebinningKnowledgeSerializer
class DLLExport VatesKnowledgeSerializer
{
private:
......@@ -66,7 +65,7 @@ private:
LocationPolicy m_locationPolicy;
public:
RebinningKnowledgeSerializer(LocationPolicy locationPolicy=LocationMandatory);
VatesKnowledgeSerializer(LocationPolicy locationPolicy=LocationMandatory);
/// Set the implicit function to use called.
void setImplicitFunction(boost::shared_ptr<const Mantid::Geometry::MDImplicitFunction> spFunction);
......
......@@ -3,7 +3,7 @@
#include "MantidAPI/FrameworkManager.h"
#include "MantidGeometry/MDGeometry/NullImplicitFunction.h"
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesKnowledgeSerializer.h"
#include "MantidVatesAPI/MetadataToFieldData.h"
#include "MantidVatesAPI/VatesXMLDefinitions.h"
#include "MantidVatesAPI/Common.h"
......@@ -148,7 +148,7 @@ namespace Mantid
vtkFieldData* outputFD = vtkFieldData::New();
//Serialize metadata
RebinningKnowledgeSerializer serializer(LocationNotRequired);
VatesKnowledgeSerializer serializer(LocationNotRequired);
serializer.setWorkspaceName(wsName);
serializer.setGeometryXML(xmlBuilder.create());
serializer.setImplicitFunction( Mantid::Geometry::MDImplicitFunction_sptr(new Mantid::Geometry::NullImplicitFunction()));
......
......@@ -4,7 +4,7 @@
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidGeometry/MDGeometry/NullImplicitFunction.h"
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesKnowledgeSerializer.h"
#include "MantidVatesAPI/MetadataToFieldData.h"
#include "MantidVatesAPI/VatesXMLDefinitions.h"
#include "MantidVatesAPI/vtkDataSetToNonOrthogonalDataSet.h"
......@@ -142,7 +142,7 @@ namespace Mantid
vtkFieldData* outputFD = vtkFieldData::New();
//Serialize metadata
RebinningKnowledgeSerializer serializer(LocationNotRequired);
VatesKnowledgeSerializer serializer(LocationNotRequired);
serializer.setWorkspaceName(wsName);
serializer.setGeometryXML(xmlBuilder.create());
serializer.setImplicitFunction( Mantid::Geometry::MDImplicitFunction_sptr(new Mantid::Geometry::NullImplicitFunction()));
......
......@@ -4,7 +4,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include "MantidGeometry/MDGeometry/MDGeometryXMLDefinitions.h"
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesXMLDefinitions.h"
using Mantid::Geometry::MDGeometryXMLDefinitions;
......@@ -13,7 +13,7 @@ namespace Mantid
namespace VATES
{
RebinningKnowledgeSerializer::RebinningKnowledgeSerializer(LocationPolicy locationPolicy) :
VatesKnowledgeSerializer::VatesKnowledgeSerializer(LocationPolicy locationPolicy) :
m_wsLocationXML(""),
m_wsNameXML(""),
m_wsName(""),
......@@ -22,13 +22,13 @@ RebinningKnowledgeSerializer::RebinningKnowledgeSerializer(LocationPolicy locati
{
}
void RebinningKnowledgeSerializer::setImplicitFunction(boost::shared_ptr<const Mantid::Geometry::MDImplicitFunction> spFunction)
void VatesKnowledgeSerializer::setImplicitFunction(boost::shared_ptr<const Mantid::Geometry::MDImplicitFunction> spFunction)
{
this->m_spFunction = spFunction;
}
/// Set the workspace name to apply.
void RebinningKnowledgeSerializer::setWorkspace(boost::shared_ptr<const Mantid::API::IMDWorkspace> workspace)
void VatesKnowledgeSerializer::setWorkspace(boost::shared_ptr<const Mantid::API::IMDWorkspace> workspace)
{
this->m_wsNameXML = MDGeometryXMLDefinitions::workspaceNameXMLTagStart() + workspace->getName() + MDGeometryXMLDefinitions::workspaceNameXMLTagEnd();
......@@ -36,19 +36,19 @@ void RebinningKnowledgeSerializer::setWorkspace(boost::shared_ptr<const Mantid::
this->m_geomXML = workspace->getGeometryXML();
}
void RebinningKnowledgeSerializer::setWorkspaceName(std::string wsName)
void VatesKnowledgeSerializer::setWorkspaceName(std::string wsName)
{
this->m_wsName = wsName;
this->m_wsNameXML = std::string(MDGeometryXMLDefinitions::workspaceNameXMLTagStart() + wsName + MDGeometryXMLDefinitions::workspaceNameXMLTagEnd());
}
void RebinningKnowledgeSerializer::setGeometryXML(std::string geomXML)
void VatesKnowledgeSerializer::setGeometryXML(std::string geomXML)
{
this->m_geomXML = geomXML;
}
/// Create the xml string correponding to the set values.
std::string RebinningKnowledgeSerializer::createXMLString() const
std::string VatesKnowledgeSerializer::createXMLString() const
{
if(true == this->m_geomXML.empty())
......@@ -72,22 +72,22 @@ std::string RebinningKnowledgeSerializer::createXMLString() const
}
}
const std::string& RebinningKnowledgeSerializer::getWorkspaceName() const
const std::string& VatesKnowledgeSerializer::getWorkspaceName() const
{
return this->m_wsName;
}
const std::string& RebinningKnowledgeSerializer::getWorkspaceGeometry() const
const std::string& VatesKnowledgeSerializer::getWorkspaceGeometry() const
{
return this->m_geomXML;
}
bool RebinningKnowledgeSerializer::hasFunctionInfo() const
bool VatesKnowledgeSerializer::hasFunctionInfo() const
{
return NULL != m_spFunction.get();
}
bool RebinningKnowledgeSerializer::hasGeometryInfo() const
bool VatesKnowledgeSerializer::hasGeometryInfo() const
{
return !m_geomXML.empty() && !m_wsName.empty();
}
......
......@@ -5,7 +5,7 @@
#include <gtest/gtest.h>
#include <cxxtest/TestSuite.h>
#include <MantidGeometry/MDGeometry/IMDDimension.h>
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesKnowledgeSerializer.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidGeometry/MDGeometry/MDImplicitFunction.h"
#include "MantidKernel/System.h"
......@@ -15,7 +15,7 @@
using namespace Mantid::VATES;
class RebinningKnowledgeSerializerTest: public CxxTest::TestSuite
class VatesKnowledgeSerializerTest: public CxxTest::TestSuite
{
private:
......@@ -39,7 +39,7 @@ public:
void testNoWorkspaceThrows()
{
RebinningKnowledgeSerializer generator;
VatesKnowledgeSerializer generator;
Mantid::Geometry::MDImplicitFunction_sptr impFunction(new MockImplicitFunction);
generator.setImplicitFunction(impFunction);
TSM_ASSERT_THROWS("Cannot generate the xml without the workspace", generator.createXMLString(), std::runtime_error);
......@@ -55,7 +55,7 @@ void testNoLocationDoesNotThrow()
EXPECT_CALL(*pImpFunction, toXMLString()).Times(1).WillRepeatedly(testing::Return("<ImplicitFunction/>"));
Mantid::Geometry::MDImplicitFunction_sptr impFunction(pImpFunction);
RebinningKnowledgeSerializer generator(LocationNotRequired); //Location is not required.
VatesKnowledgeSerializer generator(LocationNotRequired); //Location is not required.
generator.setImplicitFunction(impFunction);
generator.setWorkspace(workspace);
......@@ -68,7 +68,7 @@ void testNoNameThrows()
Mantid::Geometry::MDImplicitFunction_sptr impFunction(new MockImplicitFunction);
MockIMDWorkspace* pWorkspace = new MockIMDWorkspace;
boost::shared_ptr<const Mantid::API::IMDWorkspace> workspace(pWorkspace);
RebinningKnowledgeSerializer generator;
VatesKnowledgeSerializer generator;
generator.setImplicitFunction(impFunction);
generator.setWorkspace(workspace);
......@@ -83,7 +83,7 @@ void testCreateXMLWithComponents() //Uses individual setters for geometry, locat
EXPECT_CALL(*pImpFunction, toXMLString()).Times(1).WillRepeatedly(testing::Return("<ImplicitFunction/>"));
Mantid::Geometry::MDImplicitFunction_sptr impFunction(pImpFunction);
RebinningKnowledgeSerializer generator;
VatesKnowledgeSerializer generator;
//Apply setters.
generator.setImplicitFunction(impFunction);
generator.setWorkspaceName("name");
......@@ -96,7 +96,7 @@ void testCreateXMLWithComponents() //Uses individual setters for geometry, locat
void testCreateXMLWithoutFunction()
{
RebinningKnowledgeSerializer generator;
VatesKnowledgeSerializer generator;
//Apply setters.
generator.setWorkspaceName("name");
generator.setGeometryXML("<DimensionSet/>");
......@@ -107,7 +107,7 @@ void testCreateXMLWithoutFunction()
void testGetGeometryXML()
{
RebinningKnowledgeSerializer generator;
VatesKnowledgeSerializer generator;
generator.setWorkspaceName("name");
std::string dimensionXMLString = "<DimensionSet/>";
generator.setGeometryXML(dimensionXMLString);
......@@ -118,8 +118,8 @@ void testGetGeometryXML()
void testHasFunction()
{
RebinningKnowledgeSerializer withoutFunction;
RebinningKnowledgeSerializer withFunction;
VatesKnowledgeSerializer withoutFunction;
VatesKnowledgeSerializer withFunction;
Mantid::Geometry::MDImplicitFunction_sptr impFunction(new MockImplicitFunction);
withFunction.setImplicitFunction(impFunction);
......@@ -130,21 +130,21 @@ void testHasFunction()
void testHasGeometryInfoWithoutGeometry()
{
//Note that functions do not apply to this test set.
RebinningKnowledgeSerializer withoutGeometry;
VatesKnowledgeSerializer withoutGeometry;
withoutGeometry.setWorkspaceName("-");
TSM_ASSERT_EQUALS("No Geometry provided. ::hasGeometryInfo() should return false.", false, withoutGeometry.hasGeometryInfo());
}
void testHasGeometryInfoWithoutWSName()
{
RebinningKnowledgeSerializer withoutWSName;
VatesKnowledgeSerializer withoutWSName;
withoutWSName.setGeometryXML("-");
TSM_ASSERT_EQUALS("No WS name provided. ::hasGeometryInfo() should return false.", false, withoutWSName.hasGeometryInfo());
}
void testHasGeometryAndWSInfo()
{
RebinningKnowledgeSerializer withFullGeometryAndWSInfo;
VatesKnowledgeSerializer withFullGeometryAndWSInfo;
withFullGeometryAndWSInfo.setGeometryXML("-");
withFullGeometryAndWSInfo.setWorkspaceName("-");
TSM_ASSERT_EQUALS("All geometry and ws information has been provided. ::hasGeometryInfo() should return true.", true, withFullGeometryAndWSInfo.hasGeometryInfo());
......
......@@ -5,7 +5,7 @@
#include "MantidGeometry/MDGeometry/MDPlaneImplicitFunction.h"
#include "MantidQtSliceViewer/SliceViewerWindow.h"
#include "MantidQtFactory/WidgetFactory.h"
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include "MantidVatesAPI/VatesKnowledgeSerializer.h"
// Have to deal with ParaView warnings and Intel compiler the hard way.
#if defined(__INTEL_COMPILER)
......@@ -223,7 +223,7 @@ void MultiSliceView::showCutInSliceViewer(int axisIndex,
origin[2] = sliceOffsetOnAxis * orient[2];
// Create the XML holder
VATES::RebinningKnowledgeSerializer rks(VATES::LocationNotRequired);
VATES::VatesKnowledgeSerializer rks(VATES::LocationNotRequired);
rks.setWorkspaceName(wsName.toStdString());
rks.setGeometryXML(geomXML);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment