Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
extras
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
4
Merge Requests
4
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
The Openvibe Group
extras
Commits
9128c120
Commit
9128c120
authored
Oct 28, 2015
by
Serrière Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Matlab stimulation File.
Signed-off-by:
Serrière Guillaume
<
guillaume.serriere@inria.fr
>
parent
d4620ed9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
8 deletions
+74
-8
build-tool/stimulation-generator/src/ovbt_sg_file_generator_base.h
...l/stimulation-generator/src/ovbt_sg_file_generator_base.h
+7
-0
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
+9
-7
build-tool/stimulation-generator/src/ovbt_sg_matlab_generator.cpp
...ol/stimulation-generator/src/ovbt_sg_matlab_generator.cpp
+44
-0
plugins/processing/matlab/CMakeLists.txt
plugins/processing/matlab/CMakeLists.txt
+13
-0
toolkit/CMakeLists.txt
toolkit/CMakeLists.txt
+1
-1
No files found.
build-tool/stimulation-generator/src/ovbt_sg_file_generator_base.h
View file @
9128c120
...
...
@@ -26,3 +26,10 @@ public:
virtual
bool
appendStimulation
(
SStimulation
&
rStim
);
virtual
bool
closeFile
(
void
);
};
class
CMatlabGenerator
:
public
CFileGeneratorBase
{
public:
virtual
bool
openFile
(
const
char
*
sFilename
);
virtual
bool
appendStimulation
(
SStimulation
&
rStim
);
virtual
bool
closeFile
(
void
);
};
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
View file @
9128c120
...
...
@@ -32,13 +32,6 @@ generation_type parse_argument(string option)
}
}
string
getBrutHexaCode
(
string
l_oFormatedHexaCode
)
{
string
res
=
l_oFormatedHexaCode
;
res
.
erase
(
res
.
begin
(),
res
.
begin
()
+
2
);
return
res
;
}
int
generate_generator_list
(
vector
<
CFileGeneratorBase
*>
&
rList
,
generation_type
rType
,
int
argc
,
char
**
argv
)
{
switch
(
rType
)
...
...
@@ -65,6 +58,15 @@ int generate_generator_list(vector<CFileGeneratorBase*> & rList, generation_type
}
case
MATLAB
:
{
CFileGeneratorBase
*
gen
=
new
CMatlabGenerator
();
if
(
!
gen
->
openFile
(
argv
[
3
])){
cerr
<<
"Unable to open "
<<
argv
[
3
]
<<
endl
;
return
-
1
;
}
rList
.
push_back
(
gen
);
return
0
;
}
case
PYTHON
:
case
LUA
:
case
UNKNOWN
:
...
...
build-tool/stimulation-generator/src/ovbt_sg_matlab_generator.cpp
0 → 100644
View file @
9128c120
#include "ovbt_sg_defines.h"
#include "ovbt_sg_file_generator_base.h"
#include <fstream>
using
namespace
std
;
string
getBrutHexaCode
(
string
l_oFormatedHexaCode
)
{
string
res
=
l_oFormatedHexaCode
;
res
.
erase
(
res
.
begin
(),
res
.
begin
()
+
2
);
return
res
;
}
bool
CMatlabGenerator
::
openFile
(
const
char
*
sFilename
)
{
m_oFile
.
open
(
sFilename
,
ios
::
out
|
ios
::
trunc
);
if
(
!
m_oFile
.
is_open
())
return
false
;
m_oFile
<<
"function OV_stimulations()"
<<
endl
<<
endl
;
m_oFile
<<
"global OVTK_StimulationId_LabelStart;"
<<
endl
;
m_oFile
<<
"OVTK_StimulationId_LabelStart = uint64(hex2dec('00008100'));"
<<
endl
<<
endl
;
m_oFile
<<
"global OVTK_StimulationId_LabelEnd;"
<<
endl
;
m_oFile
<<
"OVTK_StimulationId_LabelEnd = uint64(hex2dec('000081ff'));"
<<
endl
<<
endl
;
return
true
;
}
bool
CMatlabGenerator
::
appendStimulation
(
SStimulation
&
rStim
)
{
m_oFile
<<
"
\t
global "
<<
rStim
.
m_sId
<<
";"
<<
endl
;
m_oFile
<<
"
\t
"
<<
rStim
.
m_sId
<<
" = uint64(hex2dec('"
<<
getBrutHexaCode
(
rStim
.
m_sHexaCode
)
<<
"'));"
<<
endl
<<
endl
;
return
true
;
}
bool
CMatlabGenerator
::
closeFile
(
void
)
{
m_oFile
<<
"end"
<<
endl
;
m_oFile
.
close
();
return
true
;
}
plugins/processing/matlab/CMakeLists.txt
View file @
9128c120
...
...
@@ -5,8 +5,21 @@ SET(PROJECT_VERSION_MINOR ${OV_GLOBAL_VERSION_MINOR})
SET
(
PROJECT_VERSION_PATCH
${
OV_GLOBAL_VERSION_PATCH
}
)
SET
(
PROJECT_VERSION
${
PROJECT_VERSION_MAJOR
}
.
${
PROJECT_VERSION_MINOR
}
.
${
PROJECT_VERSION_PATCH
}
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/share/OV_stimulations.m
DEPENDS openvibe-stimulation-generator
${
openvibe-toolkit_SOURCE_DIR
}
/share/stimulation_list.txt
COMMAND
${
stim_generator_path
}
/openvibe-stimulation-generator
--matlab
${
openvibe-toolkit_SOURCE_DIR
}
/share/stimulation_list.txt
${
CMAKE_CURRENT_SOURCE_DIR
}
/share/OV_stimulations.m
COMMENT
"Generating matlab stimulation sources..."
)
add_custom_target
(
generate_matlab_stimulations_file DEPENDS share/OV_stimulations.m
)
FILE
(
GLOB_RECURSE source_files src/*.cpp src/*.h src/*.inl
)
ADD_LIBRARY
(
${
PROJECT_NAME
}
SHARED
${
source_files
}
)
add_dependencies
(
openvibe-plugins-matlab generate_matlab_stimulations_file
)
SET_TARGET_PROPERTIES
(
${
PROJECT_NAME
}
PROPERTIES
VERSION
${
PROJECT_VERSION
}
SOVERSION
${
PROJECT_VERSION_MAJOR
}
...
...
toolkit/CMakeLists.txt
View file @
9128c120
...
...
@@ -10,7 +10,7 @@ SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_
#We need to generate the stimulation files
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/toolkit/ovtk_stimulations.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/ovtk_stimulations.cpp
DEPENDS openvibe-stimulation-generator
${
CMAKE_CURRENT_SOURCE_DIR
}
/share/stimulation_list.txt
COMMAND
echo `pwd` &
${
stim_generator_path
}
/openvibe-stimulation-generator
COMMAND
${
stim_generator_path
}
/openvibe-stimulation-generator
--cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/share/stimulation_list.txt
${
CMAKE_CURRENT_SOURCE_DIR
}
/include/toolkit/ovtk_stimulations.h
...
...
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