Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
abd62711
Commit
abd62711
authored
Jun 14, 2016
by
Ludovic Courtès
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: plugins_manager: Add 'load_data' static methods.
parent
7396f610
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
sources/core/plugins_manager.cpp
sources/core/plugins_manager.cpp
+30
-0
sources/core/plugins_manager.h
sources/core/plugins_manager.h
+9
-0
No files found.
sources/core/plugins_manager.cpp
View file @
abd62711
...
...
@@ -466,6 +466,36 @@ ptr<data> plugins_manager::get_data(const std::string& n, const arguments& args)
return
ptr
<
data
>
(
new
vertical_segment
())
;
}
}
ptr
<
data
>
plugins_manager
::
load_data
(
const
std
::
string
&
type
,
std
::
istream
&
input
,
const
arguments
&
args
)
{
ptr
<
data
>
result
=
get_data
(
type
,
args
);
if
(
result
)
result
->
load
(
input
,
args
);
return
result
;
}
// Load data from an input file.
ptr
<
data
>
plugins_manager
::
load_data
(
const
std
::
string
&
file
,
const
std
::
string
&
type
,
const
arguments
&
args
)
{
std
::
ifstream
stream
;
// Raise an exception when 'open' fails, and open in binary mode to
// placate Windows.
stream
.
exceptions
(
std
::
ios
::
failbit
);
stream
.
open
(
file
.
c_str
(),
std
::
ifstream
::
binary
);
stream
.
exceptions
(
std
::
ios
::
goodbit
);
ptr
<
data
>
result
=
load_data
(
type
,
stream
,
args
);
stream
.
close
();
// FIXME: make it auto-close
return
result
;
}
ptr
<
fitter
>
plugins_manager
::
get_fitter
(
const
std
::
string
&
n
)
{
if
(
n
.
empty
())
...
...
sources/core/plugins_manager.h
View file @
abd62711
...
...
@@ -57,6 +57,15 @@ class plugins_manager
//! filename n. Return null if no one exist.
static
ptr
<
data
>
get_data
(
const
std
::
string
&
n
,
const
arguments
&
args
=
arguments
());
//! \brief Load from INPUT an instance of TYPE and return it.
static
ptr
<
data
>
load_data
(
const
std
::
string
&
type
,
std
::
istream
&
input
,
const
arguments
&
args
=
arguments
());
//! \brief Load from FILE an instance of TYPE and return it.
static
ptr
<
data
>
load_data
(
const
std
::
string
&
file
,
const
std
::
string
&
type
,
const
arguments
&
args
=
arguments
());
//! \brief get an instance of the fitter that is defined in the plugin with
//! filename n. Return null if no one exist.
static
ptr
<
fitter
>
get_fitter
(
const
std
::
string
&
n
)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment