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
a4091df7
Commit
a4091df7
authored
Oct 26, 2015
by
Serrière Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename stimulation generation file.
Signed-off-by:
Serrière Guillaume
<
guillaume.serriere@inria.fr
>
parent
23fba713
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
146 deletions
+176
-146
build-tool/stimulation-generator/src/cpp_code_generator.cpp
build-tool/stimulation-generator/src/cpp_code_generator.cpp
+0
-45
build-tool/stimulation-generator/src/cpp_define_generator.cpp
...d-tool/stimulation-generator/src/cpp_define_generator.cpp
+0
-32
build-tool/stimulation-generator/src/ovbt_sg_cpp_code_generator.cpp
.../stimulation-generator/src/ovbt_sg_cpp_code_generator.cpp
+45
-0
build-tool/stimulation-generator/src/ovbt_sg_cpp_define_generator.cpp
...timulation-generator/src/ovbt_sg_cpp_define_generator.cpp
+32
-0
build-tool/stimulation-generator/src/ovbt_sg_defines.h
build-tool/stimulation-generator/src/ovbt_sg_defines.h
+4
-4
build-tool/stimulation-generator/src/ovbt_sg_file_generator_base.h
...l/stimulation-generator/src/ovbt_sg_file_generator_base.h
+28
-0
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
+67
-0
build-tool/stimulation-generator/src/stim_generator.cpp
build-tool/stimulation-generator/src/stim_generator.cpp
+0
-65
No files found.
build-tool/stimulation-generator/src/cpp_code_generator.cpp
deleted
100644 → 0
View file @
23fba713
#include "defines.h"
#include "file_generator_base.h"
#include <fstream>
using
namespace
std
;
bool
CCppCodeGenerator
::
openFile
(
const
char
*
sFilename
)
{
m_oFile
.
open
(
sFilename
,
ios
::
out
|
ios
::
trunc
);
if
(
!
m_oFile
.
is_open
())
return
false
;
m_oFile
<<
"#include
\"
toolkit/ovtk_all.h
\"
"
<<
endl
<<
endl
;
m_oFile
<<
"using namespace OpenViBE;"
<<
endl
;
m_oFile
<<
"using namespace OpenViBE::Kernel;"
<<
endl
;
m_oFile
<<
"using namespace OpenViBEToolkit;"
<<
endl
<<
endl
<<
endl
;
m_oFile
<<
"boolean OpenViBEToolkit::initializeStimulationList(const IKernelContext& rKernelContext)"
<<
endl
;
m_oFile
<<
"{"
<<
endl
;
m_oFile
<<
"
\t
ITypeManager& l_rTypeManager=rKernelContext.getTypeManager();"
<<
endl
<<
endl
;
return
true
;
}
bool
CCppCodeGenerator
::
appendStimulation
(
SStimulation
&
rStim
)
{
m_oFile
<<
"
\t
l_rTypeManager.registerEnumerationEntry(OV_TypeId_Stimulation,
\"
"
<<
rStim
.
m_sName
<<
"
\"
, "
<<
rStim
.
m_sId
<<
");"
<<
endl
;
return
true
;
}
bool
CCppCodeGenerator
::
closeFile
(
void
)
{
m_oFile
<<
endl
<<
"
\t
return true;"
<<
endl
;
m_oFile
<<
"}"
<<
endl
;
m_oFile
.
close
();
return
true
;
}
build-tool/stimulation-generator/src/cpp_define_generator.cpp
deleted
100644 → 0
View file @
23fba713
#include "defines.h"
#include "file_generator_base.h"
#include <fstream>
using
namespace
std
;
bool
CCppDefineGenerator
::
openFile
(
const
char
*
sFilename
)
{
m_oFile
.
open
(
sFilename
,
ios
::
out
|
ios
::
trunc
);
if
(
!
m_oFile
.
is_open
())
return
false
;
m_oFile
<<
"#ifndef __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
;
m_oFile
<<
"#define __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
<<
endl
;
return
true
;
}
bool
CCppDefineGenerator
::
appendStimulation
(
SStimulation
&
rStim
)
{
m_oFile
<<
"#define "
<<
rStim
.
m_sId
<<
" "
<<
rStim
.
m_sHexaCode
<<
endl
;
return
true
;
}
bool
CCppDefineGenerator
::
closeFile
(
void
)
{
m_oFile
<<
endl
<<
"#endif // __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
;
m_oFile
.
close
();
return
true
;
}
build-tool/stimulation-generator/src/ovbt_sg_cpp_code_generator.cpp
0 → 100644
View file @
a4091df7
#include "ovbt_sg_defines.h"
#include "ovbt_sg_file_generator_base.h"
#include <fstream>
using
namespace
std
;
bool
CCppCodeGenerator
::
openFile
(
const
char
*
sFilename
)
{
m_oFile
.
open
(
sFilename
,
ios
::
out
|
ios
::
trunc
);
if
(
!
m_oFile
.
is_open
())
return
false
;
m_oFile
<<
"#include
\"
toolkit/ovtk_all.h
\"
"
<<
endl
<<
endl
;
m_oFile
<<
"using namespace OpenViBE;"
<<
endl
;
m_oFile
<<
"using namespace OpenViBE::Kernel;"
<<
endl
;
m_oFile
<<
"using namespace OpenViBEToolkit;"
<<
endl
<<
endl
<<
endl
;
m_oFile
<<
"boolean OpenViBEToolkit::initializeStimulationList(const IKernelContext& rKernelContext)"
<<
endl
;
m_oFile
<<
"{"
<<
endl
;
m_oFile
<<
"
\t
ITypeManager& l_rTypeManager=rKernelContext.getTypeManager();"
<<
endl
<<
endl
;
return
true
;
}
bool
CCppCodeGenerator
::
appendStimulation
(
SStimulation
&
rStim
)
{
m_oFile
<<
"
\t
l_rTypeManager.registerEnumerationEntry(OV_TypeId_Stimulation,
\"
"
<<
rStim
.
m_sName
<<
"
\"
, "
<<
rStim
.
m_sId
<<
");"
<<
endl
;
return
true
;
}
bool
CCppCodeGenerator
::
closeFile
(
void
)
{
m_oFile
<<
endl
<<
"
\t
return true;"
<<
endl
;
m_oFile
<<
"}"
<<
endl
;
m_oFile
.
close
();
return
true
;
}
build-tool/stimulation-generator/src/ovbt_sg_cpp_define_generator.cpp
0 → 100644
View file @
a4091df7
#include "ovbt_sg_defines.h"
#include "ovbt_sg_file_generator_base.h"
#include <fstream>
using
namespace
std
;
bool
CCppDefineGenerator
::
openFile
(
const
char
*
sFilename
)
{
m_oFile
.
open
(
sFilename
,
ios
::
out
|
ios
::
trunc
);
if
(
!
m_oFile
.
is_open
())
return
false
;
m_oFile
<<
"#ifndef __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
;
m_oFile
<<
"#define __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
<<
endl
;
return
true
;
}
bool
CCppDefineGenerator
::
appendStimulation
(
SStimulation
&
rStim
)
{
m_oFile
<<
"#define "
<<
rStim
.
m_sId
<<
" "
<<
rStim
.
m_sHexaCode
<<
endl
;
return
true
;
}
bool
CCppDefineGenerator
::
closeFile
(
void
)
{
m_oFile
<<
endl
<<
"#endif // __OpenViBEToolkit_Stimulations_Defines_H__"
<<
endl
;
m_oFile
.
close
();
return
true
;
}
build-tool/stimulation-generator/src/defines.h
→
build-tool/stimulation-generator/src/
ovbt_sg_
defines.h
View file @
a4091df7
build-tool/stimulation-generator/src/file_generator_base.h
→
build-tool/stimulation-generator/src/
ovbt_sg_
file_generator_base.h
View file @
a4091df7
#include "defines.h"
#include "
ovbt_sg_
defines.h"
#include <fstream>
#include <fstream>
...
...
build-tool/stimulation-generator/src/ovbt_sg_main.cpp
0 → 100644
View file @
a4091df7
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "ovbt_sg_defines.h"
#include "ovbt_sg_file_generator_base.h"
using
namespace
std
;
string
getBrutHexaCode
(
string
l_oFormatedHexaCode
)
{
string
res
=
l_oFormatedHexaCode
;
res
.
erase
(
res
.
begin
(),
res
.
begin
()
+
2
);
return
res
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
3
)
return
-
1
;
vector
<
SStimulation
>
l_oStimulationList
;
vector
<
CFileGeneratorBase
*>
l_oGeneratorList
;
ifstream
l_oStimulationFile
(
argv
[
1
]);
string
l_sName
,
l_sId
,
l_sHexaCode
;
while
(
l_oStimulationFile
>>
l_sName
>>
l_sId
>>
l_sHexaCode
)
{
SStimulation
l_oTemp
=
{
l_sName
,
l_sId
,
l_sHexaCode
};
l_oStimulationList
.
push_back
(
l_oTemp
);
}
CFileGeneratorBase
*
gen
=
new
CCppDefineGenerator
();
if
(
!
gen
->
openFile
(
argv
[
2
]))
{
cerr
<<
"Unable to open "
<<
argv
[
2
]
<<
endl
;
return
-
1
;
}
l_oGeneratorList
.
push_back
(
gen
);
gen
=
new
CCppCodeGenerator
();
if
(
!
gen
->
openFile
(
argv
[
3
]))
{
cerr
<<
"Unable to open "
<<
argv
[
3
]
<<
endl
;
return
-
1
;
}
l_oGeneratorList
.
push_back
(
gen
);
//Now we generate all files that needs to be done
for
(
vector
<
SStimulation
>::
iterator
it
=
l_oStimulationList
.
begin
();
it
!=
l_oStimulationList
.
end
();
++
it
)
{
SStimulation
&
l_oTemp
=
*
it
;
for
(
vector
<
CFileGeneratorBase
*>::
iterator
it_gen
=
l_oGeneratorList
.
begin
();
it_gen
!=
l_oGeneratorList
.
end
();
++
it_gen
)
{
(
*
it_gen
)
->
appendStimulation
(
l_oTemp
);
}
}
for
(
vector
<
CFileGeneratorBase
*>::
iterator
it_gen
=
l_oGeneratorList
.
begin
();
it_gen
!=
l_oGeneratorList
.
end
();
++
it_gen
)
{
(
*
it_gen
)
->
closeFile
();
}
return
0
;
}
build-tool/stimulation-generator/src/stim_generator.cpp
deleted
100644 → 0
View file @
23fba713
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "defines.h"
#include "file_generator_base.h"
using
namespace
std
;
string
getBrutHexaCode
(
string
l_oFormatedHexaCode
)
{
string
res
=
l_oFormatedHexaCode
;
res
.
erase
(
res
.
begin
(),
res
.
begin
()
+
2
);
return
res
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
3
)
return
-
1
;
vector
<
SStimulation
>
l_oStimulationList
;
vector
<
CFileGeneratorBase
*>
l_oGeneratorList
;
ifstream
l_oStimulationFile
(
argv
[
1
]);
string
l_sName
,
l_sId
,
l_sHexaCode
;
while
(
l_oStimulationFile
>>
l_sName
>>
l_sId
>>
l_sHexaCode
)
{
SStimulation
l_oTemp
=
{
l_sName
,
l_sId
,
l_sHexaCode
};
l_oStimulationList
.
push_back
(
l_oTemp
);
}
CFileGeneratorBase
*
gen
=
new
CCppDefineGenerator
();
if
(
!
gen
->
openFile
(
argv
[
2
]))
{
cerr
<<
"Unable to open "
<<
argv
[
2
]
<<
endl
;
}
l_oGeneratorList
.
push_back
(
gen
);
gen
=
new
CCppCodeGenerator
();
if
(
!
gen
->
openFile
(
argv
[
3
]))
{
cerr
<<
"Unable to open "
<<
argv
[
3
]
<<
endl
;
}
l_oGeneratorList
.
push_back
(
gen
);
//Now we generate all files that needs to be done
for
(
vector
<
SStimulation
>::
iterator
it
=
l_oStimulationList
.
begin
();
it
!=
l_oStimulationList
.
end
();
++
it
)
{
SStimulation
&
l_oTemp
=
*
it
;
//cout << l_oTemp.m_sName << "," << l_oTemp.m_sId << "," << l_oTemp.m_sHexaCode << endl;
for
(
vector
<
CFileGeneratorBase
*>::
iterator
it_gen
=
l_oGeneratorList
.
begin
();
it_gen
!=
l_oGeneratorList
.
end
();
++
it_gen
)
{
(
*
it_gen
)
->
appendStimulation
(
l_oTemp
);
}
}
for
(
vector
<
CFileGeneratorBase
*>::
iterator
it_gen
=
l_oGeneratorList
.
begin
();
it_gen
!=
l_oGeneratorList
.
end
();
++
it_gen
)
{
(
*
it_gen
)
->
closeFile
();
}
return
0
;
}
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