Class CsharpGenerator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
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.AbstractGenerator
classDescriptions, generatedSourceDirectoryName, languageProperties
-
Constructor Summary
ConstructorsConstructorDescriptionCsharpGenerator
(Map<String, GeneratedClass> pClassDescriptions, Properties pCsharpProperties) Create a generator -
Method Summary
Modifier and TypeMethodDescriptioncamelCaseCapIgnoreSpaces
(String aString) String utilityinitialCapital
(String aString) returns a string with the first letter capitalized.void
postProcessData
(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer, GeneratedClass aClass) postprocess data as neededvoid
postProcessSignalPdu
(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer) postprocess SignalPdu as neededvoid
postProcessVariableDatum
(edu.nps.moves.dis7.source.generator.pdus.PrintStringBuffer printStringBuffer) postprocess SignalPdu as neededvoid
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.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.void
Generate the classes and write them to a directoryvoid
writeGetMarshalledSizeMethod
(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.AbstractGenerator
createGeneratedSourceDirectory, getBitsToShift, getGeneratedSourceDirectoryName, initialLower, setGeneratedSourceDirectoryName
-
Field Details
-
useDotNet
protected boolean useDotNetwhether using dot net
-
-
Constructor Details
-
CsharpGenerator
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:
writeClasses
in classAbstractGenerator
-
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
-
initialCapital
returns a string with the first letter capitalized.- Overrides:
initialCapital
in classAbstractGenerator
- 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
-