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 Stringivars 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.voidGenerates the cpp source code classesvoidwriteDeallocMethod(PrintWriter printWriter, GeneratedClass aClass) Produce custom output methodvoidwriteEqualityOperator(PrintWriter printWriter, GeneratedClass aClass) Write the code for an equality operator.voidwriteGetMarshalledSizeMethod(PrintWriter printWriter, GeneratedClass aClass) Produce custom output methodvoidwriteHeaderFile(GeneratedClass aClass) Generate a c++ header file for the classesvoidwriteMarshalMethod(PrintWriter pw, GeneratedClass aClass) Write the code for a method that marshals out the object into a DIS format byte array.voidwriteObjcFile(GeneratedClass aClass) Write custom object filevoidwriteUnmarshalMethod(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:
writeClassesin 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:
initialCapitalin classAbstractGenerator- Parameters:
aString- of interest- Returns:
- same string with first letter capitalized
-