Class CsharpGenerator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.Generator
edu.nps.moves.dis7.source.generator.pdus.CsharpGenerator
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 Summary
FieldsFields inherited from class edu.nps.moves.dis7.source.generator.pdus.Generator
classDescriptions, directory, languageProperties -
Constructor Summary
ConstructorsConstructorDescriptionCsharpGenerator(Map<String,GeneratedClass> pClassDescriptions, Properties pCsharpProperties)Create a generator -
Method Summary
Modifier and TypeMethodDescriptioncamelCaseCapIgnoreSpaces(String aString)String utilityinitialCap(String aString)returns a string with the first letter capitalized.voidpostProcessData(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer, GeneratedClass aClass)postprocess data as neededvoidpostProcessSignalPdu(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer)postprocess SignalPdu as neededvoidpostProcessVariableDatum(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer)postprocess SignalPdu as neededvoidwriteBitflagMethods(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.voidwriteClass(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.voidGenerate the classes and write them to a directoryvoidwriteGetMarshalledSizeMethod(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer pw, GeneratedClass aClass, int indent)Write out method to get marshalled sizeMethods inherited from class edu.nps.moves.dis7.source.generator.pdus.Generator
createDirectory, getBitsToShift, getDirectory, initialLower, setDirectory
-
Field Details
-
useDotNet
protected boolean useDotNetwhether using dot net
-
-
Constructor Details
-
CsharpGenerator
public CsharpGenerator(Map<String,GeneratedClass> pClassDescriptions, Properties pCsharpProperties)Create a generator- Parameters:
pClassDescriptions- String map of GeneratedClasspCsharpProperties- C# properties
-
-
Method Details
-
writeClasses
public void writeClasses()Generate the classes and write them to a directory- Specified by:
writeClassesin classGenerator
-
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- PrintWriteraClass- 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- outputaClass- inputindent- 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- PrintWriteraClass- of interestindent- number of 4-character whitespace indents
-
initialCap
returns a string with the first letter capitalized.- Overrides:
initialCapin classGenerator- Parameters:
aString- of interest- Returns:
- same string with first letter capitalized
-
camelCaseCapIgnoreSpaces
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- outputaClass- 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
-