Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
39c0446a
Commit
39c0446a
authored
9 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Adding methods to get properties while consulting PropertyManager property
parent
d1cde78b
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h
+6
-1
6 additions, 1 deletion
...ntid/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h
Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp
+44
-1
44 additions, 1 deletion
Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp
with
50 additions
and
2 deletions
Code/Mantid/Framework/API/inc/MantidAPI/DataProcessorAlgorithm.h
+
6
−
1
View file @
39c0446a
...
...
@@ -43,6 +43,8 @@ class DLLExport DataProcessorAlgorithm : public Algorithm {
public:
DataProcessorAlgorithm
();
virtual
~
DataProcessorAlgorithm
();
virtual
std
::
string
getPropertyValue
(
const
std
::
string
&
name
)
const
;
virtual
TypedValue
getProperty
(
const
std
::
string
&
name
)
const
;
protected:
virtual
boost
::
shared_ptr
<
Algorithm
>
createChildAlgorithm
(
...
...
@@ -53,6 +55,7 @@ protected:
void
setLoadAlgFileProp
(
const
std
::
string
&
filePropName
);
void
setAccumAlg
(
const
std
::
string
&
alg
);
void
setPropManagerPropName
(
const
std
::
string
&
propName
);
void
mapPropertyName
(
const
std
::
string
&
nameInProp
,
const
std
::
string
&
nameInPropManager
);
ITableWorkspace_sptr
determineChunk
();
void
loadChunk
();
Workspace_sptr
load
(
const
std
::
string
&
inputData
,
...
...
@@ -60,7 +63,7 @@ protected:
std
::
vector
<
std
::
string
>
splitInput
(
const
std
::
string
&
input
);
void
forwardProperties
();
boost
::
shared_ptr
<
Kernel
::
PropertyManager
>
getProcessProperties
(
const
std
::
string
&
propertyManager
=
std
::
string
());
getProcessProperties
(
const
std
::
string
&
propertyManager
=
std
::
string
())
const
;
/// MPI option. If false, we will use one job event if MPI is available
bool
m_useMPI
;
Workspace_sptr
assemble
(
const
std
::
string
&
partialWSName
,
...
...
@@ -130,6 +133,8 @@ private:
/// The name of the parameter that names the property manager. The default
/// value is "ReductionProperties".
std
::
string
m_propertyManagerPropertyName
;
/// Map property names to names in supplied properties manager
std
::
map
<
std
::
string
,
std
::
string
>
m_nameToPMName
;
};
}
// namespace API
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp
+
44
−
1
View file @
39c0446a
...
...
@@ -96,6 +96,49 @@ void DataProcessorAlgorithm::setPropManagerPropName(const std::string &propName)
m_propertyManagerPropertyName
=
propName
;
}
void
DataProcessorAlgorithm
::
mapPropertyName
(
const
std
::
string
&
nameInProp
,
const
std
::
string
&
nameInPropManager
)
{
m_nameToPMName
[
nameInProp
]
=
nameInPropManager
;
}
std
::
string
DataProcessorAlgorithm
::
getPropertyValue
(
const
std
::
string
&
name
)
const
{
// explicitely specifying a property wins
if
(
!
isDefault
(
name
))
{
return
Algorithm
::
getPropertyValue
(
name
);
}
// return it if it is in the held property manager
auto
mapping
=
m_nameToPMName
.
find
(
name
);
if
(
mapping
!=
m_nameToPMName
.
end
())
{
auto
pm
=
this
->
getProcessProperties
();
if
(
pm
->
existsProperty
(
mapping
->
second
))
{
return
pm
->
getPropertyValue
(
mapping
->
second
);
}
}
// let the parent class version win
return
Algorithm
::
getPropertyValue
(
name
);
}
PropertyManagerOwner
::
TypedValue
DataProcessorAlgorithm
::
getProperty
(
const
std
::
string
&
name
)
const
{
// explicitely specifying a property wins
if
(
!
isDefault
(
name
))
{
return
Algorithm
::
getProperty
(
name
);
}
// return it if it is in the held property manager
auto
mapping
=
m_nameToPMName
.
find
(
name
);
if
(
mapping
!=
m_nameToPMName
.
end
())
{
auto
pm
=
this
->
getProcessProperties
();
if
(
pm
->
existsProperty
(
mapping
->
second
))
{
return
pm
->
getProperty
(
mapping
->
second
);
}
}
// let the parent class version win
return
Algorithm
::
getProperty
(
name
);
}
ITableWorkspace_sptr
DataProcessorAlgorithm
::
determineChunk
()
{
throw
std
::
runtime_error
(
"DataProcessorAlgorithm::determineChunk is not implemented"
);
...
...
@@ -248,7 +291,7 @@ Workspace_sptr DataProcessorAlgorithm::load(const std::string &inputData,
* @param propertyManager :: Name of the property manager to retrieve.
*/
boost
::
shared_ptr
<
PropertyManager
>
DataProcessorAlgorithm
::
getProcessProperties
(
const
std
::
string
&
propertyManager
)
{
const
std
::
string
&
propertyManager
)
const
{
std
::
string
propertyManagerName
(
propertyManager
);
if
(
propertyManager
.
empty
()
&&
(
!
m_propertyManagerPropertyName
.
empty
()))
{
propertyManagerName
=
this
->
getPropertyValue
(
m_propertyManagerPropertyName
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment