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
b78e23e7
Commit
b78e23e7
authored
4 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Set the descriptor on the chosen loader
parent
55eed720
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/API/src/FileLoaderRegistry.cpp
+21
-1
21 additions, 1 deletion
Framework/API/src/FileLoaderRegistry.cpp
with
21 additions
and
1 deletion
Framework/API/src/FileLoaderRegistry.cpp
+
21
−
1
View file @
b78e23e7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidAPI/FileLoaderRegistry.h"
#include
"MantidAPI/FileLoaderRegistry.h"
#include
"MantidAPI/IFileLoader.h"
#include
"MantidAPI/IFileLoader.h"
#include
"MantidAPI/NexusFileLoader.h"
#include
<Poco/File.h>
#include
<Poco/File.h>
...
@@ -26,6 +27,20 @@ template <> struct DescriptorCallback<Kernel::FileDescriptor> {
...
@@ -26,6 +27,20 @@ template <> struct DescriptorCallback<Kernel::FileDescriptor> {
};
};
/// @endcond
/// @endcond
/// @cond
template
<
typename
T
>
struct
DescriptorSetter
{
// general one does nothing
void
apply
(
boost
::
shared_ptr
<
NexusFileLoader
>
&
/*unused*/
,
std
::
shared_ptr
<
T
>
&
/*unused*/
)
{}
};
template
<
>
struct
DescriptorSetter
<
Kernel
::
NexusHDF5Descriptor
>
{
void
apply
(
boost
::
shared_ptr
<
NexusFileLoader
>
&
loader
,
std
::
shared_ptr
<
Kernel
::
NexusHDF5Descriptor
>
&
descriptor
)
{
loader
->
setFileInfo
(
descriptor
);
}
};
/// @endcond
/**
/**
* @param filename A string giving a filename
* @param filename A string giving a filename
* @param names The collection of names to search through
* @param names The collection of names to search through
...
@@ -42,9 +57,10 @@ searchForLoader(const std::string &filename,
...
@@ -42,9 +57,10 @@ searchForLoader(const std::string &filename,
const
auto
&
factory
=
AlgorithmFactory
::
Instance
();
const
auto
&
factory
=
AlgorithmFactory
::
Instance
();
IAlgorithm_sptr
bestLoader
;
IAlgorithm_sptr
bestLoader
;
int
maxConfidence
(
0
);
int
maxConfidence
(
0
);
//Mantid::Kernel::NexusHDF5Descriptor>(filename);
//
Mantid::Kernel::NexusHDF5Descriptor>(filename);
auto
descriptor
=
std
::
make_shared
<
DescriptorType
>
(
filename
);
auto
descriptor
=
std
::
make_shared
<
DescriptorType
>
(
filename
);
DescriptorCallback
<
DescriptorType
>
callback
;
DescriptorCallback
<
DescriptorType
>
callback
;
DescriptorSetter
<
DescriptorType
>
setdescriptor
;
auto
iend
=
names
.
end
();
auto
iend
=
names
.
end
();
for
(
auto
it
=
names
.
begin
();
it
!=
iend
;
++
it
)
{
for
(
auto
it
=
names
.
begin
();
it
!=
iend
;
++
it
)
{
...
@@ -72,6 +88,10 @@ searchForLoader(const std::string &filename,
...
@@ -72,6 +88,10 @@ searchForLoader(const std::string &filename,
callback
.
apply
(
descriptor
);
callback
.
apply
(
descriptor
);
}
}
auto
nxsLoader
=
boost
::
dynamic_pointer_cast
<
NexusFileLoader
>
(
bestLoader
);
if
(
nxsLoader
)
setdescriptor
.
apply
(
nxsLoader
,
descriptor
);
return
bestLoader
;
return
bestLoader
;
}
}
}
// namespace
}
// namespace
...
...
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