Package com.grammatech.gtirb
Class IR
- java.lang.Object
-
- com.grammatech.gtirb.Node
-
- com.grammatech.gtirb.AuxDataContainer
-
- com.grammatech.gtirb.IR
-
public class IR extends AuxDataContainer
A complete internal representation. IR describes the internal representation of a software artifact.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.grammatech.gtirb.AuxDataContainer
AuxDataContainer.AuxData
-
-
Field Summary
-
Fields inherited from class com.grammatech.gtirb.AuxDataContainer
auxDataMap
-
-
Constructor Summary
Constructors Constructor Description IR()
Default class constructor for IR.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addModule(Module module)
Add a module to thisIR
.void
addModules(java.util.List<Module> modules)
Add a list of modules to thisIR
.java.util.List<Module>
findModules(java.lang.String name)
Find modules by name.CFG
getCfg()
Get the CFG belonging to thisIR
.java.util.List<Module>
getModules()
Get the list of modules belonging to thisIR
.int
getVersion()
Get the protobuf version of thisIR
.static IR
loadFile(java.io.InputStream fileIn)
Load IR from a protobuf file stream.static IR
loadFile(java.lang.String fileInName)
Load IR from a protobuf file.boolean
removeModule(Module module)
Remove a module from thisIR
.void
saveFile(java.io.OutputStream fileOut)
Save IR to a protobuf file stream.void
saveFile(java.lang.String fileOutName)
Save IR to a protobuf file.void
setCfg(CFG cfg)
Set the CFG belonging to thisIR
.void
setVersion(int version)
Set the protobuf version of thisIR
.com.grammatech.gtirb.proto.IROuterClass.IR.Builder
toProtobuf()
Serialize this IR into a protobuf.-
Methods inherited from class com.grammatech.gtirb.AuxDataContainer
clearAuxData, getAuxData, getAuxDataMap, putAuxData, removeAuxData, removeAuxData
-
-
-
-
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.
-
findModules
public java.util.List<Module> findModules(java.lang.String name)
Find modules by name.
-
addModule
public void addModule(Module module)
Add a module to thisIR
.- Parameters:
module
-Module
to add.
-
addModules
public void addModules(java.util.List<Module> modules)
Add a list of modules to thisIR
.- Parameters:
modules
- Modules to add.
-
removeModule
public boolean removeModule(Module module)
Remove a module from thisIR
.- Parameters:
module
-Module
to remove.- Returns:
- boolean true if the IR contained the module and it was removed.
-
getVersion
public int getVersion()
Get the protobuf version of thisIR
.- Returns:
- Protobuf version.
-
setVersion
public void setVersion(int version)
Set the protobuf version of thisIR
.- 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
-
-