Class IR


  • public class IR
    extends AuxDataContainer
    A complete internal representation. IR describes the internal representation of a software artifact.
    • Constructor Detail

      • IR

        public IR()
        Default class constructor for IR.
    • Method Detail

      • loadFile

        public static IR loadFile​(java.io.InputStream fileIn)
        Load IR from a protobuf file stream.
        Returns:
        IR if load is successful, null otherwise.
      • loadFile

        public static IR loadFile​(java.lang.String fileInName)
        Load IR from a protobuf file.
        Returns:
        IR if load is successful, null otherwise.
      • getModules

        public java.util.List<Module> getModules()
        Get the list of modules belonging to this IR.
        Returns:
        An unmodifiable Module list of all the modules in this IR. Any attempt to remove an element of this list will throw an UnsupportedOperationException.
      • findModules

        public java.util.List<Module> findModules​(java.lang.String name)
        Find modules by name.
        Returns:
        A list of all Module in this IR that have a matching name.
      • addModule

        public void addModule​(Module module)
        Add a module to this IR.
        Parameters:
        module - Module to add.
      • addModules

        public void addModules​(java.util.List<Module> modules)
        Add a list of modules to this IR.
        Parameters:
        modules - Modules to add.
      • removeModule

        public boolean removeModule​(Module module)
        Remove a module from this IR.
        Parameters:
        module - Module to remove.
        Returns:
        boolean true if the IR contained the module and it was removed.
      • getCfg

        public CFG getCfg()
        Get the CFG belonging to this IR.
        Returns:
        A CFG.
      • setCfg

        public void setCfg​(CFG cfg)
        Set the CFG belonging to this IR.
        Parameters:
        cfg - A CFG.
      • getVersion

        public int getVersion()
        Get the protobuf version of this IR.
        Returns:
        Protobuf version.
      • setVersion

        public void setVersion​(int version)
        Set the protobuf version of this IR.
        Parameters:
        version - Protobuf version.
      • toProtobuf

        public com.grammatech.gtirb.proto.IROuterClass.IR.Builder toProtobuf()
        Serialize this IR into a protobuf.
        Returns:
        IR protocol buffer.
      • saveFile

        public void saveFile​(java.io.OutputStream fileOut)
                      throws java.io.IOException
        Save IR to a protobuf file stream.
        Throws:
        java.io.IOException
      • saveFile

        public void saveFile​(java.lang.String fileOutName)
                      throws java.io.IOException
        Save IR to a protobuf file.
        Throws:
        java.io.IOException