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
55eed720
Commit
55eed720
authored
4 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Change to shared_ptr to allow for casting
parent
1a10ec3b
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
+7
-5
7 additions, 5 deletions
Framework/API/src/FileLoaderRegistry.cpp
with
7 additions
and
5 deletions
Framework/API/src/FileLoaderRegistry.cpp
+
7
−
5
View file @
55eed720
...
...
@@ -17,11 +17,11 @@ namespace {
//----------------------------------------------------------------------------------------------
/// @cond
template
<
typename
T
>
struct
DescriptorCallback
{
void
apply
(
T
&
/*unused*/
)
{}
// general one does nothing
void
apply
(
std
::
shared_ptr
<
T
>
&
/*unused*/
)
{}
// general one does nothing
};
template
<
>
struct
DescriptorCallback
<
Kernel
::
FileDescriptor
>
{
void
apply
(
Kernel
::
FileDescriptor
&
descriptor
)
{
descriptor
.
resetStreamToStart
();
void
apply
(
std
::
shared_ptr
<
Kernel
::
FileDescriptor
>
&
descriptor
)
{
descriptor
->
resetStreamToStart
();
}
};
/// @endcond
...
...
@@ -42,7 +42,8 @@ searchForLoader(const std::string &filename,
const
auto
&
factory
=
AlgorithmFactory
::
Instance
();
IAlgorithm_sptr
bestLoader
;
int
maxConfidence
(
0
);
DescriptorType
descriptor
(
filename
);
//Mantid::Kernel::NexusHDF5Descriptor>(filename);
auto
descriptor
=
std
::
make_shared
<
DescriptorType
>
(
filename
);
DescriptorCallback
<
DescriptorType
>
callback
;
auto
iend
=
names
.
end
();
...
...
@@ -56,7 +57,7 @@ searchForLoader(const std::string &filename,
auto
alg
=
boost
::
static_pointer_cast
<
FileLoaderType
>
(
factory
.
create
(
name
,
version
));
// highest version
try
{
const
int
confidence
=
alg
->
confidence
(
descriptor
);
const
int
confidence
=
alg
->
confidence
(
*
(
descriptor
.
get
())
);
logger
.
debug
()
<<
name
<<
" returned with confidence="
<<
confidence
<<
'\n'
;
if
(
confidence
>
maxConfidence
)
// strictly greater
...
...
@@ -70,6 +71,7 @@ searchForLoader(const std::string &filename,
}
callback
.
apply
(
descriptor
);
}
return
bestLoader
;
}
}
// 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