Class MmuStruct

  • Direct Known Subclasses:
    MmuAddressInstance, MmuBuffer

    public class MmuStruct
    extends java.lang.Object
    The MmuStruct class describes a variable represented by a structure (a list of Variable objects).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int bitSize  
      protected MmuBuffer buffer  
      protected java.util.List<ru.ispras.fortress.expression.NodeVariable> fields  
      protected java.lang.String name  
    • Constructor Summary

      Constructors 
      Constructor Description
      MmuStruct​(java.lang.String name, ru.ispras.fortress.expression.NodeVariable... variables)
      Constructs an MmuStruct object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addField​(ru.ispras.fortress.expression.NodeVariable field)
      Registers an new field.
      void addField​(MmuStruct struct)
      Registers fields defined in the specified structure.
      java.util.List<MmuBinding> bindings​(MmuStruct other)
      Creates bindings between fields of two structures.
      int getBitSize()
      Returns the total size of all fields in the structure.
      MmuBuffer getBuffer()
      Returns the buffer associated with the structure (for buffer entries) or null if not applicable.
      int getFieldCount()
      Returns the number of fields in the structure.
      java.util.List<ru.ispras.fortress.expression.NodeVariable> getFields()
      Returns structure fields.
      MmuStruct getInstance​(java.lang.String instanceId, MemoryAccessContext context)  
      java.lang.String getName()
      Returns the structure name.
      void setBuffer​(MmuBuffer buffer)
      Sets the buffer associated with the structure (for buffer entries).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        protected final java.lang.String name
      • fields

        protected final java.util.List<ru.ispras.fortress.expression.NodeVariable> fields
      • bitSize

        protected int bitSize
    • Constructor Detail

      • MmuStruct

        public MmuStruct​(java.lang.String name,
                         ru.ispras.fortress.expression.NodeVariable... variables)
        Constructs an MmuStruct object.
        Parameters:
        name - structure name.
        variables - field variables.
        Throws:
        java.lang.IllegalArgumentException - if name equals null or if any of the field variables equals null.
    • Method Detail

      • getName

        public final java.lang.String getName()
        Returns the structure name.
        Returns:
        structure name.
      • setBuffer

        public void setBuffer​(MmuBuffer buffer)
        Sets the buffer associated with the structure (for buffer entries).
        Parameters:
        buffer - the buffer to be associated with the structure.
        Throws:
        java.lang.IllegalArgumentException - if buffer equals null.
      • getBuffer

        public MmuBuffer getBuffer()
        Returns the buffer associated with the structure (for buffer entries) or null if not applicable.
        Returns:
        the buffer associated with the structure or null if not applicable.
      • getFields

        public final java.util.List<ru.ispras.fortress.expression.NodeVariable> getFields()
        Returns structure fields.
        Returns:
        the list of structure fields.
      • addField

        public final void addField​(ru.ispras.fortress.expression.NodeVariable field)
        Registers an new field.
        Parameters:
        field - a field to be registered.
        Throws:
        java.lang.IllegalArgumentException - if field == null.
      • addField

        public final void addField​(MmuStruct struct)
        Registers fields defined in the specified structure.
        Parameters:
        struct - Structure which contains fields to be registered.
        Throws:
        java.lang.IllegalArgumentException - if struct or any field it contains is null.
      • getFieldCount

        public final int getFieldCount()
        Returns the number of fields in the structure.
        Returns:
        number of fields in the structure.
      • getBitSize

        public final int getBitSize()
        Returns the total size of all fields in the structure.
        Returns:
        structure size in bits.
      • bindings

        public java.util.List<MmuBinding> bindings​(MmuStruct other)
        Creates bindings between fields of two structures.
        Parameters:
        other - Structure to be bound with the current one.
        Returns:
        List of bindings between fields of two structures.
        Throws:
        java.lang.IllegalArgumentException - if other equals null; if the structures differ in size or field count; if any of two fields to be bound differ in size.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object