Class CppGenerator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.Generator
edu.nps.moves.dis7.source.generator.pdus.CppGenerator
PDU autogeneration supporting class.
-
Field Summary
FieldsFields inherited from class edu.nps.moves.dis7.source.generator.pdus.Generator
classDescriptions, directory, languageProperties
-
Constructor Summary
ConstructorsConstructorDescriptionCppGenerator(Map<String,GeneratedClass> pClassDescriptions, Properties pCppProperties)
Constructor -
Method Summary
Modifier and TypeMethodDescriptioninitialCap(String aString)
returns a string with the first letter capitalized.void
Generates the cpp source code classesvoid
writeCppFile(GeneratedClass aClass)
output file for this classvoid
writeEqualityOperator(PrintWriter pw, GeneratedClass aClass)
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) return (_ivar1==rhs._ivar1 && _var2 == rhs._ivar2 ...)void
writeGetMarshalledSizeMethod(PrintWriter pw, GeneratedClass aClass)
output marshalled sizevoid
writeHeaderFile(GeneratedClass aClass)
Generate a c++ header file for the classesvoid
Microsoft C++ requires a macro file to generate dlls.void
writeMarshalMethod(PrintWriter pw, GeneratedClass aClass)
Write the code for a method that marshals out the object into a DIS format byte array.void
writeSetterMethod(PrintWriter pw, GeneratedClass aClass, ClassAttribute anAttribute)
write out setter methodvoid
writeUnmarshalMethod(PrintWriter pw, GeneratedClass aClass)
write out unmarshal methodMethods inherited from class edu.nps.moves.dis7.source.generator.pdus.Generator
createDirectory, getBitsToShift, getDirectory, initialLower, setDirectory
-
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:
- Constant Field Values
-
-
Constructor Details
-
CppGenerator
Constructor- Parameters:
pClassDescriptions
- String Map of GeneratedClasspCppProperties
- C++ properties
-
-
Method Details
-
writeClasses
public void writeClasses()Generates the cpp source code classes- Specified by:
writeClasses
in classGenerator
-
writeMacroFile
public void writeMacroFile()Microsoft C++ requires a macro file to generate dlls. The preprocessor will import this and resolve it to an empty string in the gcc/unix world. In the Microsoft C++ world, the macro will resolve and do something useful about creating libraries. -
writeHeaderFile
Generate a c++ header file for the classes- Parameters:
aClass
- class of interest
-
writeCppFile
output file for this class- Parameters:
aClass
- GeneratedClass to write file for
-
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) return (_ivar1==rhs._ivar1 && _var2 == rhs._ivar2 ...)- Parameters:
pw
- outputaClass
- class of interest
-
writeMarshalMethod
Write the code for a method that marshals out the object into a DIS format byte array.- Parameters:
pw
- PrintWriteraClass
- class of interest
-
writeUnmarshalMethod
write out unmarshal method- Parameters:
pw
- PrintWriteraClass
- a GeneratedClass
-
writeSetterMethod
write out setter method- Parameters:
pw
- PrintWriteraClass
- GeneratedClassanAttribute
- a ClassAttribute
-
writeGetMarshalledSizeMethod
output marshalled size- Parameters:
pw
- PrintWriter to useaClass
- a GeneratedClass
-
initialCap
returns a string with the first letter capitalized.- Overrides:
initialCap
in classGenerator
- Parameters:
aString
- of interest- Returns:
- same string with first letter capitalized
-