Class ObjcGenerator

java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
edu.nps.moves.dis7.source.generator.pdus.ObjcGenerator

public class ObjcGenerator extends AbstractGenerator
PDU autogeneration supporting class.
  • Field Details

    • IVAR_PREFIX

      public static final String 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

      public ObjcGenerator(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. It has ivars, getters, setters, and serialization/deserialization methods. Warning: only partially implemented.
      Parameters:
      pClassDescriptions - String Map of classes
      pObjcProperties - special language properties
  • Method Details

    • writeClasses

      public void writeClasses()
      Generates the cpp source code classes
      Specified by:
      writeClasses in class AbstractGenerator
    • writeHeaderFile

      public void writeHeaderFile(GeneratedClass aClass)
      Generate a c++ header file for the classes
      Parameters:
      aClass - class of interest
    • writeObjcFile

      public void writeObjcFile(GeneratedClass aClass)
      Write custom object file
      Parameters:
      aClass - class of interest
    • writeEqualityOperator

      public void writeEqualityOperator(PrintWriter printWriter, 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)
      Parameters:
      printWriter - output
      aClass - GeneratedClass of interest return (_ivar1==rhs._ivar1 && _var2 == rhs._ivar2 ...)
    • writeMarshalMethod

      public void writeMarshalMethod(PrintWriter pw, GeneratedClass aClass)
      Write the code for a method that marshals out the object into a DIS format byte array.
      Parameters:
      pw - PrintWriter
      aClass - of interest
    • writeUnmarshalMethod

      public void writeUnmarshalMethod(PrintWriter printWriter, GeneratedClass aClass)
      Produce custom output method
      Parameters:
      printWriter - output
      aClass - GeneratedClass of interest
    • writeGetMarshalledSizeMethod

      public void writeGetMarshalledSizeMethod(PrintWriter printWriter, GeneratedClass aClass)
      Produce custom output method
      Parameters:
      printWriter - output
      aClass - GeneratedClass of interest
    • writeDeallocMethod

      public void writeDeallocMethod(PrintWriter printWriter, GeneratedClass aClass)
      Produce custom output method
      Parameters:
      printWriter - output
      aClass - GeneratedClass of interest
    • initialCapital

      public String initialCapital(String aString)
      returns a string with the first letter capitalized.
      Overrides:
      initialCapital in class AbstractGenerator
      Parameters:
      aString - of interest
      Returns:
      same string with first letter capitalized