Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
89cae23d
Commit
89cae23d
authored
Oct 28, 2018
by
Simon Spannagel
Browse files
USe pure C-interface when calling library functions
parent
01536fc6
Pipeline
#561351
passed with stages
in 23 minutes and 26 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core/module/ModuleManager.cpp
View file @
89cae23d
...
...
@@ -289,9 +289,11 @@ void ModuleManager::load_modules() {
throw
corryvreckan
::
DynamicLibraryError
(
config
.
getName
());
}
bool
global
=
reinterpret_cast
<
bool
(
*
)()
>
(
globalFunction
)();
// NOLINT
bool
dut_only
=
reinterpret_cast
<
bool
(
*
)()
>
(
dutFunction
)();
// NOLINT
std
::
vector
<
std
::
string
>
types
=
reinterpret_cast
<
std
::
vector
<
std
::
string
>
(
*
)()
>
(
typeFunction
)();
// NOLINT
bool
global
=
reinterpret_cast
<
bool
(
*
)()
>
(
globalFunction
)();
// NOLINT
bool
dut_only
=
reinterpret_cast
<
bool
(
*
)()
>
(
dutFunction
)();
// NOLINT
char
*
type_tokens
=
reinterpret_cast
<
char
*
(
*
)()
>
(
typeFunction
)();
// NOLINT
std
::
vector
<
std
::
string
>
types
=
get_type_vector
(
type_tokens
);
// Apply the module specific options to the module configuration
conf_mgr_
->
applyOptions
(
config
.
getName
(),
config
);
...
...
@@ -324,6 +326,22 @@ void ModuleManager::load_modules() {
LOG_PROGRESS
(
STATUS
,
"MOD_LOAD_LOOP"
)
<<
"Loaded "
<<
configs
.
size
()
<<
" modules"
;
}
std
::
vector
<
std
::
string
>
ModuleManager
::
get_type_vector
(
char
*
type_tokens
)
{
std
::
vector
<
std
::
string
>
types
;
std
::
stringstream
tokenstream
(
type_tokens
);
while
(
tokenstream
.
good
())
{
std
::
string
token
;
getline
(
tokenstream
,
token
,
','
);
if
(
token
.
empty
())
{
continue
;
}
std
::
transform
(
token
.
begin
(),
token
.
end
(),
token
.
begin
(),
::
tolower
);
types
.
push_back
(
token
);
}
return
types
;
}
std
::
pair
<
ModuleIdentifier
,
Module
*>
ModuleManager
::
create_unique_module
(
void
*
library
,
Configuration
config
,
std
::
vector
<
std
::
string
>
)
{
// Create the identifier
...
...
src/core/module/ModuleManager.hpp
View file @
89cae23d
...
...
@@ -65,6 +65,8 @@ namespace corryvreckan {
std
::
shared_ptr
<
Detector
>
m_reference
;
// Create string vector for detector types:
std
::
vector
<
std
::
string
>
get_type_vector
(
char
*
tokens
);
// Log file if specified
std
::
ofstream
log_file_
;
...
...
src/core/module/dynamic_module_impl.cpp
View file @
89cae23d
...
...
@@ -52,20 +52,13 @@ namespace corryvreckan {
*
* Used by the ModuleManager to determine if module should instantiate for a given detector
*/
std
::
vector
<
std
::
string
>
corryvreckan_detector_types
();
std
::
vector
<
std
::
string
>
corryvreckan_detector_types
()
{
char
*
corryvreckan_detector_types
();
char
*
corryvreckan_detector_types
()
{
#if defined(CORRYVRECKAN_DETECTOR_TYPE) || defined(DOXYGEN)
auto
tokenstream
=
std
::
stringstream
(
STR
(
CORRYVRECKAN_DETECTOR_TYPE
));
std
::
vector
<
std
::
string
>
tokens
;
while
(
tokenstream
.
good
())
{
std
::
string
token
;
getline
(
tokenstream
,
token
,
','
);
std
::
transform
(
token
.
begin
(),
token
.
end
(),
token
.
begin
(),
::
tolower
);
tokens
.
push_back
(
token
);
}
return
tokens
;
auto
types
=
new
std
::
string
(
STR
(
CORRYVRECKAN_DETECTOR_TYPE
));
return
const_cast
<
char
*>
(
types
->
c_str
());
#else
return
std
::
vector
<
std
::
string
>
();
return
new
char
();
#endif
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment