Class ObjcGenerator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
edu.nps.moves.dis7.source.generator.pdus.ObjcGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
ivars are often preceded by a special character.Fields inherited from class edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
classDescriptions, generatedSourceDirectoryName, languageProperties
-
Constructor Summary
ConstructorsConstructorDescriptionObjcGenerator
(Map<String, GeneratedClass> pClassDescriptions, Properties pObjcProperties) Given the input object, something of an abstract syntax tree, this generates a source code file in the ObjectiveC language. -
Method Summary
Modifier and TypeMethodDescriptioninitialCapital
(String aString) returns a string with the first letter capitalized.void
Generates the cpp source code classesvoid
writeDeallocMethod
(PrintWriter printWriter, GeneratedClass aClass) Produce custom output methodvoid
writeEqualityOperator
(PrintWriter printWriter, GeneratedClass aClass) Write the code for an equality operator.void
writeGetMarshalledSizeMethod
(PrintWriter printWriter, GeneratedClass aClass) Produce custom output methodvoid
writeHeaderFile
(GeneratedClass aClass) Generate a c++ header file for the classesvoid
writeMarshalMethod
(PrintWriter pw, GeneratedClass aClass) Write the code for a method that marshals out the object into a DIS format byte array.void
writeObjcFile
(GeneratedClass aClass) Write custom object filevoid
writeUnmarshalMethod
(PrintWriter printWriter, GeneratedClass aClass) Produce custom output methodMethods inherited from class edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
createGeneratedSourceDirectory, getBitsToShift, getGeneratedSourceDirectoryName, initialLower, setGeneratedSourceDirectoryName
-
Field Details
-
IVAR_PREFIX
ivars are often preceded by a special character. This sets what that character is, so that instance variable names will be preceded by a "_".- See Also:
-
-
Constructor Details
-
ObjcGenerator
Given the input object, something of an abstract syntax tree, this generates a source code file in the ObjectiveC language. It has ivars, getters, setters, and serialization/deserialization methods. Warning: only partially implemented.- Parameters:
pClassDescriptions
- String Map of classespObjcProperties
- special language properties
-
-
Method Details
-
writeClasses
public void writeClasses()Generates the cpp source code classes- Specified by:
writeClasses
in classAbstractGenerator
-
writeHeaderFile
Generate a c++ header file for the classes- Parameters:
aClass
- class of interest
-
writeObjcFile
Write custom object file- Parameters:
aClass
- class of interest
-
writeEqualityOperator
Write the code for an equality operator. This allows you to compare two objects for equality. The code should look like bool operator ==(const ClassName& rhs)- Parameters:
printWriter
- outputaClass
- GeneratedClass of interest return (_ivar1==rhs._ivar1 && _var2 == rhs._ivar2 ...)
-
writeMarshalMethod
Write the code for a method that marshals out the object into a DIS format byte array.- Parameters:
pw
- PrintWriteraClass
- of interest
-
writeUnmarshalMethod
Produce custom output method- Parameters:
printWriter
- outputaClass
- GeneratedClass of interest
-
writeGetMarshalledSizeMethod
Produce custom output method- Parameters:
printWriter
- outputaClass
- GeneratedClass of interest
-
writeDeallocMethod
Produce custom output method- Parameters:
printWriter
- outputaClass
- GeneratedClass of interest
-
initialCapital
returns a string with the first letter capitalized.- Overrides:
initialCapital
in classAbstractGenerator
- Parameters:
aString
- of interest- Returns:
- same string with first letter capitalized
-