-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #4399. Split out the workspace property types
Introduces a macro to decalare WorkspaceProperty exports.
- Loading branch information
1 parent
f59015d
commit a10c5f0
Showing
13 changed files
with
107 additions
and
62 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
Code/Mantid/Framework/PythonInterface/inc/MantidPythonInterface/api/WorkspacePropertyMacro.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef MANTID_PYTHONINTERFACE_WORKSPACEPROPERTYMACRO_H_ | ||
#define MANTID_PYTHONINTERFACE_WORKSPACEPROPERTYMACRO_H_ | ||
/* | ||
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
#include "MantidPythonInterface/kernel/PropertyWithValue.h" | ||
#include "MantidAPI/WorkspaceProperty.h" | ||
#include <boost/python/register_ptr_to_python.hpp> | ||
|
||
/** | ||
* Defines a macro for exporting new WorkspaceProperty types. | ||
* This automatically exports a new PropertyWithValue class for the given type. | ||
* | ||
* @param Type :: The workspace type (not the shared_ptr wrapped type) | ||
* @param ClassName :: A string defining the final class name in Python | ||
*/ | ||
#define EXPORT_WORKSPACE_PROPERTY(Type, ClassName) \ | ||
EXPORT_PROP_W_VALUE(boost::shared_ptr<Type>, Type); \ | ||
boost::python::register_ptr_to_python<Mantid::API::WorkspaceProperty<Type>*>(); \ | ||
boost::python::class_<Mantid::API::WorkspaceProperty<Type>,\ | ||
boost::python::bases<Mantid::Kernel::PropertyWithValue<boost::shared_ptr<Type> >, Mantid::API::IWorkspaceProperty>,\ | ||
boost::noncopyable>(ClassName, boost::python::no_init) \ | ||
; | ||
|
||
#endif /* MANTID_PYTHONINTERFACE_WORKSPACEPROPERTYMACRO_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IEventWorkspaceProperty.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "MantidPythonInterface/api/WorkspacePropertyMacro.h" | ||
#include "MantidAPI/IEventWorkspace.h" | ||
|
||
void export_IEventWorkspaceProperty() | ||
{ | ||
using Mantid::API::IEventWorkspace; | ||
EXPORT_WORKSPACE_PROPERTY(IEventWorkspace, "IEventWorkspaceProperty"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspaceProperty.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "MantidPythonInterface/api/WorkspacePropertyMacro.h" | ||
#include "MantidAPI/ITableWorkspace.h" | ||
|
||
void export_ITableWorkspaceProperty() | ||
{ | ||
using Mantid::API::ITableWorkspace; | ||
EXPORT_WORKSPACE_PROPERTY(ITableWorkspace, "ITableWorkspaceProperty"); | ||
} |
14 changes: 14 additions & 0 deletions
14
Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IWorkspaceProperty.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "MantidAPI/IWorkspaceProperty.h" | ||
#include <boost/python/class.hpp> | ||
|
||
void export_IWorkspaceProperty() | ||
{ | ||
using namespace boost::python; | ||
using Mantid::API::IWorkspaceProperty; | ||
|
||
class_<IWorkspaceProperty, boost::noncopyable>("IWorkspaceProperty", no_init) | ||
.def("isOptional", &IWorkspaceProperty::isOptional, "Is the input workspace property optional") | ||
.def("isLocking", &IWorkspaceProperty::isLocking, "Will the workspace be locked when starting an algorithm") | ||
; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspaceProperty.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "MantidPythonInterface/api/WorkspacePropertyMacro.h" | ||
|
||
void export_MatrixWorkspaceProperty() | ||
{ | ||
using Mantid::API::MatrixWorkspace; | ||
EXPORT_WORKSPACE_PROPERTY(MatrixWorkspace, "MatrixWorkspaceProperty"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceProperty.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "MantidPythonInterface/api/WorkspacePropertyMacro.h" | ||
#include "MantidAPI/Workspace.h" | ||
|
||
void export_WorkspaceProperty() | ||
{ | ||
using Mantid::API::Workspace; | ||
EXPORT_WORKSPACE_PROPERTY(Workspace, "WorkspaceProperty"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters