Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
26bf9f7c
Commit
26bf9f7c
authored
Jan 16, 2021
by
Malte Heithoff
Browse files
Support new Matrix Type (Unsigned Char Type) (CV related)
parent
cf4214c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/cpp/converter/MathConverter.java
View file @
26bf9f7c
...
...
@@ -114,6 +114,10 @@ public class MathConverter {
return
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
)
+
"="
+
curBackend
.
getMatrixTypeName
()
+
"("
+
v
.
getDimensionalInformation
().
get
(
0
)
+
","
+
v
.
getDimensionalInformation
().
get
(
1
)
+
");\n"
;
}
private
static
String
getMatrixUnsignedCharInitLine
(
Variable
v
,
EMAMBluePrintCPP
bluePrint
)
{
return
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
)
+
"="
+
curBackend
.
getMatrixTypeUnsignedCharName
()
+
"("
+
v
.
getDimensionalInformation
().
get
(
0
)
+
","
+
v
.
getDimensionalInformation
().
get
(
1
)
+
");\n"
;
}
public
static
String
getRowVectorInitLine
(
Variable
v
,
EMAMBluePrintCPP
bluePrint
)
{
return
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
)
+
"="
+
curBackend
.
getRowVectorTypeName
()
+
"("
+
v
.
getDimensionalInformation
().
get
(
1
)
+
");\n"
;
}
...
...
@@ -137,6 +141,10 @@ public class MathConverter {
return
String
.
format
(
"%s = %s(%s, %s, %s);\n"
,
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
),
curBackend
.
getCubeTypeName
(),
v
.
getDimensionalInformation
().
get
(
0
),
v
.
getDimensionalInformation
().
get
(
1
),
v
.
getDimensionalInformation
().
get
(
2
));
}
private
static
String
getCubeUnsignedCharInitLine
(
Variable
v
,
EMAMBluePrintCPP
bluePrint
)
{
return
String
.
format
(
"%s = %s(%s, %s, %s);\n"
,
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
),
curBackend
.
getCubeUnsignedCharName
(),
v
.
getDimensionalInformation
().
get
(
0
),
v
.
getDimensionalInformation
().
get
(
1
),
v
.
getDimensionalInformation
().
get
(
2
));
}
public
static
String
getWholeNumberMatrixInitLine
(
Variable
v
,
EMAMBluePrintCPP
bluePrint
)
{
return
MathInformationRegister
.
getVariableInitName
(
v
,
bluePrint
)
+
"="
+
curBackend
.
getWholeNumberMatrixTypeName
()
+
"("
+
v
.
getDimensionalInformation
().
get
(
0
)
+
","
+
v
.
getDimensionalInformation
().
get
(
1
)
+
");\n"
;
}
...
...
@@ -157,12 +165,16 @@ public class MathConverter {
String
initLine
=
null
;
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getMatrixTypeName
()))
{
initLine
=
MathConverter
.
getMatrixInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getRowVectorTypeName
()))
{
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getMatrixTypeUnsignedCharName
()))
{
initLine
=
MathConverter
.
getMatrixUnsignedCharInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getRowVectorTypeName
()))
{
initLine
=
MathConverter
.
getRowVectorInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getColumnVectorTypeName
()))
{
initLine
=
MathConverter
.
getColumnVectorInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getCubeTypeName
()))
{
initLine
=
MathConverter
.
getCubeTypeInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getCubeUnsignedCharName
()))
{
initLine
=
MathConverter
.
getCubeUnsignedCharInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getWholeNumberMatrixTypeName
()))
{
initLine
=
MathConverter
.
getWholeNumberMatrixInitLine
(
v
,
bluePrint
);
}
else
if
(
v
.
getVariableType
().
getTypeNameTargetLanguage
().
equals
(
MathConverter
.
curBackend
.
getWholeNumberRowVectorTypeName
()))
{
...
...
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