Class CsharpGenerator

java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
edu.nps.moves.dis7.source.generator.pdus.CsharpGenerator

public class CsharpGenerator extends AbstractGenerator
Given the input object, something of an abstract syntax tree, this generates a source code file in the C# language. It has ivars, getters, setters, and serialization/deserialization methods. Warning: only partially implemented.
Author:
DMcG modified by Peter Smith (Naval Air Warfare Center - Training Systems Division modified by Zvonko Bostjancic (Blubit d.o.o.)
  • Field Details

    • useDotNet

      protected boolean useDotNet
      whether using dot net
  • Constructor Details

    • CsharpGenerator

      public CsharpGenerator(Map<String,GeneratedClass> pClassDescriptions, Properties pCsharpProperties)
      Create a generator
      Parameters:
      pClassDescriptions - String map of GeneratedClass
      pCsharpProperties - C# properties
  • Method Details

    • writeClasses

      public void writeClasses()
      Generate the classes and write them to a directory
      Specified by:
      writeClasses in class AbstractGenerator
    • writeClass

      public void writeClass(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer pw, GeneratedClass aClass)
      Generate a source code file with getters, setters, ivars, and marshal/unmarshal methods for one class.
      Parameters:
      pw - PrintWriter
      aClass - of interest
    • writeGetMarshalledSizeMethod

      public void writeGetMarshalledSizeMethod(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer pw, GeneratedClass aClass, int indent)
      Write out method to get marshalled size
      Parameters:
      pw - output
      aClass - input
      indent - indentation
    • writeBitflagMethods

      public void writeBitflagMethods(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer pw, GeneratedClass aClass, int indent)
      Some fields have integers with bit fields defined, eg an integer where bits 0-2 represent some value, while bits 3-4 represent another value, and so on.This writes accessor and mutator methods for those fields.
      Parameters:
      pw - PrintWriter
      aClass - of interest
      indent - number of 4-character whitespace indents
    • initialCapital

      public String initialCapital(String aString)
      returns a string with the first letter capitalized.
      Overrides:
      initialCapital in class AbstractGenerator
      Parameters:
      aString - of interest
      Returns:
      same string with first letter capitalized
    • camelCaseCapIgnoreSpaces

      public String camelCaseCapIgnoreSpaces(String aString)
      String utility
      Parameters:
      aString - input
      Returns:
      modified string
    • postProcessData

      public void postProcessData(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer, GeneratedClass aClass)
      postprocess data as needed
      Parameters:
      printStringBuffer - output
      aClass - GeneratedClass of interest
    • postProcessSignalPdu

      public void postProcessSignalPdu(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer)
      postprocess SignalPdu as needed
      Parameters:
      printStringBuffer - output
    • postProcessVariableDatum

      public void postProcessVariableDatum(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer)
      postprocess SignalPdu as needed
      Parameters:
      printStringBuffer - output