aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 19:04:50 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 19:04:50 +0200
commit687910bc052e1430c8132a5eefe63e20ba6937e0 (patch)
tree0ec042a8a5cad0615a82d1e10862a904efe79762 /Software/Visual_Studio/Tango.CodeGeneration
parentf1a77b05c2e56cd073180803947aa991a09f9b40 (diff)
downloadTango-687910bc052e1430c8132a5eefe63e20ba6937e0.tar.gz
Tango-687910bc052e1430c8132a5eefe63e20ba6937e0.zip
Implemented PMR Generator for hardware objects !
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/ProtoEnumFile.cs19
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/ProtoMessageFile.cs19
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj4
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoEnumFile.cshtml23
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoMessageFile.cshtml24
5 files changed, 89 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/ProtoEnumFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/ProtoEnumFile.cs
new file mode 100644
index 000000000..2a4ad5d35
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/ProtoEnumFile.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ public class ProtoEnumFile : EnumerationFile
+ {
+ public String Package { get; set; }
+ public List<String> Imports { get; set; }
+
+ public ProtoEnumFile()
+ {
+ Imports = new List<string>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/ProtoMessageFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/ProtoMessageFile.cs
new file mode 100644
index 000000000..6d771099a
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/ProtoMessageFile.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.CodeGeneration
+{
+ public class ProtoMessageFile : Class
+ {
+ public String Package { get; set; }
+ public List<String> Imports { get; set; }
+
+ public ProtoMessageFile()
+ {
+ Imports = new List<string>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
index ff9072a1a..d622bd6a0 100644
--- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj
@@ -68,6 +68,8 @@
<Compile Include="EntityCodeFile.cs" />
<Compile Include="EnumerationField.cs" />
<Compile Include="ObservablesContextCodeFile.cs" />
+ <Compile Include="ProtoEnumFile.cs" />
+ <Compile Include="ProtoMessageFile.cs" />
<Compile Include="TangoDAOJavaFile.cs" />
<Compile Include="EnumerationFileJava.cs" />
<Compile Include="EnumerationFile.cs" />
@@ -106,6 +108,8 @@
<EmbeddedResource Include="Templates\EnumerationFileJava.cshtml" />
<EmbeddedResource Include="Templates\TangoDAOJavaFile.cshtml" />
<EmbeddedResource Include="Templates\ObservablesContextCodeFile.cshtml" />
+ <EmbeddedResource Include="Templates\ProtoMessageFile.cshtml" />
+ <EmbeddedResource Include="Templates\ProtoEnumFile.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoEnumFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoEnumFile.cshtml
new file mode 100644
index 000000000..790e5dd93
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoEnumFile.cshtml
@@ -0,0 +1,23 @@
+syntax = "proto3";
+
+//This file is auto-generated. Do not modify!
+
+@foreach (var import in Model.Imports)
+{
+ <div>
+ import "@(import)";
+ </div>
+}
+
+package @(Model.Package);
+option java_package = "com.twine.@(Model.Package.ToLower())";
+
+enum @(Model.Name)
+{
+ @foreach (var prop in Model.Fields)
+ {
+ <div>
+ @(prop.Name) = @(prop.Value);
+ </div>
+ }
+}
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoMessageFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoMessageFile.cshtml
new file mode 100644
index 000000000..7452db6e6
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ProtoMessageFile.cshtml
@@ -0,0 +1,24 @@
+syntax = "proto3";
+
+//This file is auto-generated. Do not modify!
+
+@foreach (var import in Model.Imports)
+{
+ <div>
+ import "@(import)";
+ </div>
+}
+
+package @(Model.Package);
+option java_package = "com.twine.@(Model.Package.ToLower())";
+
+message @(Model.Name)
+{
+
+@for (int i = 0; i < Model.Properties.Count; i++)
+{
+<div>
+ @(Model.Properties[i].Type) @(Model.Properties[i].Name) = @(i + 1);
+</div>
+}
+}