Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
43e06e57
Commit
43e06e57
authored
1 year ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
[ConditionnalInterpreter] Fix string plus int error in clang 12.
parent
026123ea
No related branches found
No related tags found
1 merge request
!31
Build fix
Pipeline
#32945
failed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nodeTester/ConditionalInterpreter.cpp
+25
-25
25 additions, 25 deletions
src/nodeTester/ConditionalInterpreter.cpp
with
25 additions
and
25 deletions
src/nodeTester/ConditionalInterpreter.cpp
+
25
−
25
View file @
43e06e57
#include
"aidge/nodeTester/ConditionalInterpreter.hpp"
#include
"aidge/nodeTester/ConditionalInterpreter.hpp"
using
namespace
Aidge
;
using
namespace
Aidge
;
///////////////////////////////
///////////////////////////////
...
@@ -31,7 +31,7 @@ using namespace Aidge;
...
@@ -31,7 +31,7 @@ using namespace Aidge;
mLambdaRegiter
.
insert
(
"getType"
,
+
[](
NodePtr
NodeOp
){
return
NodeOp
->
type
();});
mLambdaRegiter
.
insert
(
"getType"
,
+
[](
NodePtr
NodeOp
){
return
NodeOp
->
type
();});
}
}
bool
ConditionalInterpreter
::
test
(
const
NodePtr
nodeOp
)
bool
ConditionalInterpreter
::
test
(
const
NodePtr
nodeOp
)
{
{
...
@@ -39,9 +39,9 @@ using namespace Aidge;
...
@@ -39,9 +39,9 @@ using namespace Aidge;
clearRes
();
clearRes
();
try
{
try
{
std
::
vector
<
ConditionalData
*>
r
=
visit
({
mTree
},
nodeOp
);
std
::
vector
<
ConditionalData
*>
r
=
visit
({
mTree
},
nodeOp
);
if
(
mResolution
.
size
()
!=
1
){
if
(
mResolution
.
size
()
!=
1
){
throw
std
::
runtime_error
(
"Mult
y
output interpretation output"
);
throw
std
::
runtime_error
(
"Mult
i-
output interpretation output"
);
}
else
{
}
else
{
if
(
!
mResolution
[
0
]
->
isTypeEqualTo
<
bool
>
()){
if
(
!
mResolution
[
0
]
->
isTypeEqualTo
<
bool
>
()){
throw
std
::
runtime_error
(
"TEST OUT MUST BE A BOOL "
);
throw
std
::
runtime_error
(
"TEST OUT MUST BE A BOOL "
);
...
@@ -53,7 +53,7 @@ using namespace Aidge;
...
@@ -53,7 +53,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
){
}
catch
(
const
std
::
exception
&
e
){
std
::
ostringstream
errorMessage
;
std
::
ostringstream
errorMessage
;
errorMessage
<<
"Error in test "
<<
"
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
errorMessage
<<
"Error in test "
<<
"
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
throw
std
::
runtime_error
(
errorMessage
.
str
());
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
}
}
}
...
@@ -70,7 +70,7 @@ using namespace Aidge;
...
@@ -70,7 +70,7 @@ using namespace Aidge;
switch
(
node
->
getType
()){
switch
(
node
->
getType
()){
///////////////////////////////////
///////////////////////////////////
//OPERATOR
//OPERATOR
///////////////////////////////////
///////////////////////////////////
case
ConditionalTokenTypes
::
NOT
:
case
ConditionalTokenTypes
::
NOT
:
{
{
visit
(
node
->
getChilds
(),
nodeOp
);
visit
(
node
->
getChilds
(),
nodeOp
);
...
@@ -105,10 +105,10 @@ using namespace Aidge;
...
@@ -105,10 +105,10 @@ using namespace Aidge;
///////////////////////////////////
///////////////////////////////////
//VALUE
//VALUE
///////////////////////////////////
///////////////////////////////////
case
ConditionalTokenTypes
::
KEY
:
case
ConditionalTokenTypes
::
KEY
:
break
;
break
;
case
ConditionalTokenTypes
::
INTEGER
:
case
ConditionalTokenTypes
::
INTEGER
:
{
{
...
@@ -118,7 +118,7 @@ using namespace Aidge;
...
@@ -118,7 +118,7 @@ using namespace Aidge;
case
ConditionalTokenTypes
::
FLOAT
:
case
ConditionalTokenTypes
::
FLOAT
:
{
{
fStrToFloat
(
node
);
fStrToFloat
(
node
);
}
}
break
;
break
;
case
ConditionalTokenTypes
::
STRING
:
case
ConditionalTokenTypes
::
STRING
:
...
@@ -126,7 +126,7 @@ using namespace Aidge;
...
@@ -126,7 +126,7 @@ using namespace Aidge;
fStrToStr
(
node
);
fStrToStr
(
node
);
}
}
break
;
break
;
case
ConditionalTokenTypes
::
NODE
:
//TODO
case
ConditionalTokenTypes
::
NODE
:
//TODO
{
{
...
@@ -141,14 +141,14 @@ using namespace Aidge;
...
@@ -141,14 +141,14 @@ using namespace Aidge;
{
{
visit
(
node
->
getChilds
(),
nodeOp
);
visit
(
node
->
getChilds
(),
nodeOp
);
fLambda
(
node
);
fLambda
(
node
);
}
}
break
;
break
;
case
ConditionalTokenTypes
::
BOOL
:
//TODO
case
ConditionalTokenTypes
::
BOOL
:
//TODO
{
{
ConditionalData
*
data
=
new
ConditionalData
;
ConditionalData
*
data
=
new
ConditionalData
;
if
(
node
->
getValue
()
==
"true"
){
if
(
node
->
getValue
()
==
"true"
){
data
->
setValue
<
bool
>
(
true
);
data
->
setValue
<
bool
>
(
true
);
}
else
{
}
else
{
...
@@ -170,7 +170,7 @@ using namespace Aidge;
...
@@ -170,7 +170,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
){
}
catch
(
const
std
::
exception
&
e
){
std
::
ostringstream
errorMessage
;
std
::
ostringstream
errorMessage
;
errorMessage
<<
"Error in visiting AST for node"
<<
nodeOp
->
name
()
<<
"
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
errorMessage
<<
"Error in visiting AST for node"
<<
nodeOp
->
name
()
<<
"
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
throw
std
::
runtime_error
(
errorMessage
.
str
());
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
}
}
}
...
@@ -192,7 +192,7 @@ using namespace Aidge;
...
@@ -192,7 +192,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fStrToFloat
(
const
std
::
shared_ptr
<
AstNode
<
ConditionalTokenTypes
>>&
node
)
void
ConditionalInterpreter
::
fStrToFloat
(
const
std
::
shared_ptr
<
AstNode
<
ConditionalTokenTypes
>>&
node
)
{
{
ConditionalData
*
data
=
new
ConditionalData
;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
float
>
(
std
::
stof
(
node
->
getValue
()));
data
->
setValue
<
float
>
(
std
::
stof
(
node
->
getValue
()));
mResolution
.
push_back
(
data
);
mResolution
.
push_back
(
data
);
...
@@ -205,7 +205,7 @@ using namespace Aidge;
...
@@ -205,7 +205,7 @@ using namespace Aidge;
mResolution
.
push_back
(
data
);
mResolution
.
push_back
(
data
);
}
}
void
ConditionalInterpreter
::
fLambda
(
const
std
::
shared_ptr
<
AstNode
<
ConditionalTokenTypes
>>&
node
)
void
ConditionalInterpreter
::
fLambda
(
const
std
::
shared_ptr
<
AstNode
<
ConditionalTokenTypes
>>&
node
)
{
{
//if the lambda have input
//if the lambda have input
ConditionalData
*
data
;
ConditionalData
*
data
;
...
@@ -214,7 +214,7 @@ using namespace Aidge;
...
@@ -214,7 +214,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
std
::
ostringstream
errorMessage
;
std
::
ostringstream
errorMessage
;
errorMessage
<<
"Error in conditional interpretation when run the "
<<
node
->
getValue
()
<<
" Lambda
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
errorMessage
<<
"Error in conditional interpretation when run the "
<<
node
->
getValue
()
<<
" Lambda
\n\t
"
<<
e
.
what
()
<<
"
\n
"
;
throw
std
::
runtime_error
(
errorMessage
.
str
());
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
}
clearRes
();
clearRes
();
...
@@ -224,7 +224,7 @@ using namespace Aidge;
...
@@ -224,7 +224,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fEq
(
void
)
void
ConditionalInterpreter
::
fEq
(
void
)
{
{
if
(
mResolution
.
size
()
!=
2
){
if
(
mResolution
.
size
()
!=
2
){
throw
std
::
runtime_error
(
"EQ need 2 arg and get :"
+
mResolution
.
size
());
throw
std
::
runtime_error
(
"EQ need 2 arg and get :"
+
std
::
to_string
(
mResolution
.
size
())
)
;
}
}
auto
a
=
mResolution
[
0
];
auto
a
=
mResolution
[
0
];
auto
b
=
mResolution
[
1
];
auto
b
=
mResolution
[
1
];
...
@@ -256,7 +256,7 @@ using namespace Aidge;
...
@@ -256,7 +256,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fNeq
(
void
)
void
ConditionalInterpreter
::
fNeq
(
void
)
{
{
if
(
mResolution
.
size
()
!=
2
){
if
(
mResolution
.
size
()
!=
2
){
throw
std
::
runtime_error
(
"NEQ need 2 arg and get :"
+
mResolution
.
size
());
throw
std
::
runtime_error
(
"NEQ need 2 arg and get :"
+
std
::
to_string
(
mResolution
.
size
())
)
;
}
}
auto
a
=
mResolution
[
0
];
auto
a
=
mResolution
[
0
];
auto
b
=
mResolution
[
1
];
auto
b
=
mResolution
[
1
];
...
@@ -285,7 +285,7 @@ using namespace Aidge;
...
@@ -285,7 +285,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fAnd
(
void
)
void
ConditionalInterpreter
::
fAnd
(
void
)
{
{
if
(
mResolution
.
size
()
!=
2
){
if
(
mResolution
.
size
()
!=
2
){
throw
std
::
runtime_error
(
"AND need 2 arg and get :"
+
mResolution
.
size
());
throw
std
::
runtime_error
(
"AND need 2 arg and get :"
+
std
::
to_string
(
mResolution
.
size
())
)
;
}
}
auto
a
=
mResolution
[
0
];
auto
a
=
mResolution
[
0
];
auto
b
=
mResolution
[
1
];
auto
b
=
mResolution
[
1
];
...
@@ -297,7 +297,7 @@ using namespace Aidge;
...
@@ -297,7 +297,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
&&
b
->
getValue
<
bool
>
());
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
&&
b
->
getValue
<
bool
>
());
clearRes
();
clearRes
();
mResolution
.
push_back
(
data
);
mResolution
.
push_back
(
data
);
...
@@ -306,7 +306,7 @@ using namespace Aidge;
...
@@ -306,7 +306,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fOr
(
void
)
void
ConditionalInterpreter
::
fOr
(
void
)
{
{
if
(
mResolution
.
size
()
!=
2
){
if
(
mResolution
.
size
()
!=
2
){
throw
std
::
runtime_error
(
"OR need 2 arg and get :"
+
mResolution
.
size
());
throw
std
::
runtime_error
(
"OR need 2 arg and get :"
+
std
::
to_string
(
mResolution
.
size
())
)
;
}
}
auto
a
=
mResolution
[
0
];
auto
a
=
mResolution
[
0
];
auto
b
=
mResolution
[
1
];
auto
b
=
mResolution
[
1
];
...
@@ -318,7 +318,7 @@ using namespace Aidge;
...
@@ -318,7 +318,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
||
b
->
getValue
<
bool
>
());
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
||
b
->
getValue
<
bool
>
());
clearRes
();
clearRes
();
mResolution
.
push_back
(
data
);
mResolution
.
push_back
(
data
);
...
@@ -327,7 +327,7 @@ using namespace Aidge;
...
@@ -327,7 +327,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fNot
()
void
ConditionalInterpreter
::
fNot
()
{
{
if
(
mResolution
.
size
()
!=
1
){
if
(
mResolution
.
size
()
!=
1
){
throw
std
::
runtime_error
(
"
not
need 1 arg and get :"
+
mResolution
.
size
());
throw
std
::
runtime_error
(
"
NOT
need 1 arg and get :"
+
std
::
to_string
(
mResolution
.
size
())
)
;
}
}
auto
a
=
mResolution
[
0
];
auto
a
=
mResolution
[
0
];
...
@@ -337,7 +337,7 @@ using namespace Aidge;
...
@@ -337,7 +337,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
!
a
->
getValue
<
bool
>
()
);
data
->
setValue
<
bool
>
(
!
a
->
getValue
<
bool
>
()
);
clearRes
();
clearRes
();
mResolution
.
push_back
(
data
);
mResolution
.
push_back
(
data
);
...
...
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