Class DefaultDataType

All Implemented Interfaces:
DataType

public class DefaultDataType extends DataTypeImpl
Provides an implementation of a byte that has not been defined yet as a particular type of data in the program.
  • Field Details

    • dataType

      public static DefaultDataType dataType
      A statically defined DefaultDataType used when an Undefined byte is needed.
  • Method Details

    • getMnemonic

      public String getMnemonic(Settings settings)
      Description copied from interface: DataType
      Get the mnemonic for this DataType.
      Specified by:
      getMnemonic in interface DataType
      Overrides:
      getMnemonic in class AbstractDataType
      Parameters:
      settings - settings which may influence the result or null
      Returns:
      the mnemonic for this DataType.
    • getLength

      public int getLength()
      Description copied from interface: DataType
      Get the length of this DataType as a number of 8-bit bytes.

      For primitive datatypes this reflects the smallest varnode which can be used to contain its value (i.e., raw data length).

      Example: For x86 32-bit gcc an 80-bit long double raw data length of 10-bytes will fit within a floating point register while its aligned-length of 12-bytes is used by the gcc compiler for data/array/component allocations to maintain alignment (i.e., sizeof(long double) ).

      NOTE: Other than the VoidDataType, no datatype should ever return 0, even if DataType.isZeroLength(), and only Dynamic/FactoryDataType datatypes should return -1. If DataType.isZeroLength() is true a length of 1 should be returned. Where a zero-length datatype can be handled (e.g., Composite) the DataType.isZeroLength() method should be used.

      Returns:
      the length of this DataType
    • getDescription

      public String getDescription()
      Description copied from interface: DataType
      Get a String briefly describing this DataType.
      Returns:
      a one-liner describing this DataType.
    • getRepresentation

      public String getRepresentation(MemBuffer buf, Settings settings, int length)
      Description copied from interface: DataType
      Get bytes from memory in a printable format for this type.
      Parameters:
      buf - the data.
      settings - the settings to use for the representation.
      length - the number of bytes to represent.
      Returns:
      the representation of the data in this format, never null.
    • getValue

      public Object getValue(MemBuffer buf, Settings settings, int length)
      Get the Undefined byte as a Scalar.
      Parameters:
      buf - the data buffer.
      settings - the display settings to use.
      length - the number of bytes to get the value from.
      Returns:
      the data Object.
    • getValueClass

      public Class<?> getValueClass(Settings settings)
      Description copied from interface: DataType
      Get the Class of the value Object to be returned by this datatype (see DataType.getValue(MemBuffer, Settings, int)).
      Specified by:
      getValueClass in interface DataType
      Overrides:
      getValueClass in class DataTypeImpl
      Parameters:
      settings - the relevant settings to use or null for default.
      Returns:
      Class of the value to be returned by this datatype or null if it can vary or is unspecified. Types which correspond to a string or char array will return the String class.
    • clone

      public DataType clone(DataTypeManager dtm)
      Description copied from interface: DataType
      Returns an instance of this DataType using the specified DataTypeManager to allow its use of the corresponding DataOrganization while retaining its unique identity (see DataType.getUniversalID() and archive association (see DataType.getSourceArchive()) if applicable.

      This instance will be returned if this datatype's DataTypeManager matches the specified dtm. The recursion depth of a clone will stop on any datatype whose DataTypeManager matches the specified dtm and simply use the existing datatype instance.

      NOTE: In general, this method should not be used to obtain an instance to be modified. In most cases changes may be made directly to this instance if supported or to a DataType.copy(DataTypeManager) of this type.

      Parameters:
      dtm - the data-type manager instance whose data-organization should apply.
      Returns:
      cloned instance which may be the same as this instance
    • copy

      public DataType copy(DataTypeManager dtm)
      Description copied from interface: DataType
      Returns a new instance (shallow copy) of this DataType with a new identity and no source archive association.

      Any reference to other datatypes will use DataType.clone(DataTypeManager).

      Parameters:
      dtm - the data-type manager instance whose data-organization should apply.
      Returns:
      new instanceof of this datatype
    • isEquivalent

      public boolean isEquivalent(DataType dt)
      Description copied from interface: DataType
      Check if the given datatype is equivalent to this datatype.

      The precise meaning of "equivalent" is datatype dependent.
      NOTE: if invoked by a DB object or manager it should be invoked on the DataTypeDB object passing the other datatype as the argument.

      Parameters:
      dt - the datatype being tested for equivalence.
      Returns:
      true if the if the given datatype is equivalent to this datatype.
    • addParent

      public void addParent(DataType dt)
      Description copied from interface: DataType
      Inform this data type that it has the given parent
      TODO: This method is reserved for internal DB use.
      Specified by:
      addParent in interface DataType
      Overrides:
      addParent in class DataTypeImpl
      Parameters:
      dt - parent data type
    • removeParent

      public void removeParent(DataType dt)
      Description copied from interface: DataType
      Remove a parent datatype

      TODO: This method is reserved for internal DB use.

      Specified by:
      removeParent in interface DataType
      Overrides:
      removeParent in class DataTypeImpl
      Parameters:
      dt - parent datatype
    • getLastChangeTime

      public long getLastChangeTime()
      Description copied from interface: DataType
      Get the timestamp corresponding to the last time this type was changed within its datatype manager
      Specified by:
      getLastChangeTime in interface DataType
      Overrides:
      getLastChangeTime in class DataTypeImpl
      Returns:
      timestamp of last change within datatype manager