Example #1
0
 public void GenerateCSharpSignature(DataTypes types, LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut)
     {
         stream.Write("ref ");
     }
     else if (this.Direction == ParameterDirection.Out)
     {
         stream.Write("out ");
     }
     stream.Write("{0} {1}", types.ToCSharpFullName(this.Type), this.Name);
 }
Example #2
0
 public void GenerateCSharpAgrgumentById(LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut)
     {
         stream.Write("ref ");
     }
     else if (this.Direction == ParameterDirection.Out)
     {
         stream.Write("out ");
     }
     stream.Write("arg{0}", this.Id);
 }
Example #3
0
File: Protocol.cs Project: ifzz/FDK
 public void GenerateCSharpReader(string namespaceName, string path)
 {
     using (var stream = new LrpStream(path))
     {
         stream.WriteLine("using System;");
         stream.WriteLine("using SoftFX.Lrp;");
         stream.WriteLine("using System.Collections.Generic;");
         stream.WriteLine();
         this.types.GenerateCSharpReader(namespaceName, stream);
         this.Components.GenerateCSharpReader(namespaceName, stream);
     }
 }
Example #4
0
File: Protocol.cs Project: ifzz/FDK
 public void GenerateCppWriter(string outputPath)
 {
     this.Components.GenerateCppHeaderWriter(outputPath + ".h");
     using (var stream = new LrpStream(outputPath + ".hpp"))
     {
         this.types.GenerateCppWriter(stream);
         this.Components.GenerateCppSourceWriter(stream);
     }
 }
Example #5
0
 public void GenerateCppSignature(DataTypes types, LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut || this.Direction == ParameterDirection.Out)
     {
         stream.Write("{0}& {1}", types.ToCppFullName(this.Type), this.Name);
     }
     else if (this.Type == EmbeddedDataTypes.LocalPointer || this.Type == EmbeddedDataTypes.RemotePointer)
     {
         stream.Write("{0} {1}", types.ToCppFullName(this.Type), this.Name);
     }
     else
     {
         stream.Write("const {0}& {1}", types.ToCppFullName(this.Type), this.Name);
     }
     
 }
Example #6
0
 public void GenerateCppHeaderWriter(DataTypes types, LrpStream stream)
 {
     var cppType = types.ToCppFullName(this.Type);
     stream.Write("const {0}& {1}", cppType, this.Name);
 }
Example #7
0
 public void GenerateCppSourceWriter(DataTypes types, LrpStream stream)
 {
     stream.WriteLine("LrpWrite{0}(\"{1}\", {1}, _stream);", this.Type.Suffix, this.Name);
 }
Example #8
0
 public void GenerateCppServerRequest(DataTypes types, LrpStream stream)
 {
     var type = this.Type;
     stream.BeginLine();
     if (type == EmbeddedDataTypes.Raw)
         stream.Write("auto& arg{0} = ", this.Id);
     else
         stream.Write("auto arg{0} = ", this.Id);
     
     if (this.Direction == ParameterDirection.In || this.Direction == ParameterDirection.InOut)
     {
         stream.Write("Read{0}(buffer);", this.Type.Suffix);
     }
     else if (this.Direction == ParameterDirection.Out)
     {
         if (type != EmbeddedDataTypes.LocalPointer && type != EmbeddedDataTypes.RemotePointer)
         {
             stream.Write("{0}();", types.ToCppFullName(this.Type));
         }
         else
         {
             stream.Write("(void*)nullptr;");
         }
     }
     stream.EndLine();
 }
Example #9
0
 public void GenerateCppLocalServerResponse(LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut || this.Direction == ParameterDirection.Out)
         stream.WriteLine("Write{0}(arg{1}, buffer);", this.Type.Suffix, this.Id);
 }
Example #10
0
 public void GenerateCppResponse(LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut || this.Direction == ParameterDirection.Out)
     {
         stream.WriteLine("{0} = Read{1}(buffer);", this.Name, this.Type.Suffix);
     }
 }
Example #11
0
 public void GenerateCppRequest(LrpStream stream)
 {
     if (this.Direction == ParameterDirection.In || this.Direction == ParameterDirection.InOut)
         stream.WriteLine("Write{0}({1}, buffer);", this.Type.Suffix, this.Name);
 }
Example #12
0
 public void GenerateCSharpMemberReader(LrpStream stream)
 {
     var defaultValue = this.Default;
     if (defaultValue == null)
         stream.WriteLine("var {0} = stream.Read{1}(\"{0}\");", this.Name, this.Type.Suffix);
     else
         stream.WriteLine("var {0} = stream.Read{1}(\"{0}\", {2});", this.Name, this.Type.Suffix, defaultValue);
 }
Example #13
0
 public void GenerateCSharpSignatureReader(LrpStream stream, DataTypes types)
 {
     var typeFullname = types.ToCSharpFullName(this.Type);
     stream.Write("{0} {1}", typeFullname, this.Name);
 }
Example #14
0
 public void GenerateCSharpServerRequest(DataTypes types, LrpStream stream)
 {
     var type = this.Type;
     stream.BeginLine();
     stream.Write("var arg{0} = ", this.Id);
     if (this.Direction == ParameterDirection.In || this.Direction == ParameterDirection.InOut)
     {
         stream.Write("buffer.Read{0}();", this.Type.Suffix);
     }
     else if (this.Direction == ParameterDirection.Out)
     {
         if (type == EmbeddedDataTypes.LocalPointer)
         {
             stream.Write("Lptr.Zero;");
         }
         else if (type == EmbeddedDataTypes.RemotePointer)
         {
             stream.Write("Rptr.Zero;");
         }
         else
         {
             stream.Write("default({0});", types.ToCSharpFullName(this.Type));
         }
     }
     stream.EndLine();
 }