类 ArrayStructureBB

  • 直接已知子类:
    ArrayStructureBBpos, ArrayStructureBBsection

    public class ArrayStructureBB
    extends ArrayStructureBak
    Concrete implementation of ArrayStructure, data storage is in a ByteBuffer, which is converted to member data on the fly. In order to use this, the records must have the same size, and the member offset must be the same for each record. Use StructureMembers.setStructureSize() to set the record size. Use StructureMembers.Member.setDataParam() to set the offset of the member from the start of each record. The member data will then be located in the BB at offset = recnum * getStructureSize() + member.getDataParam(). This defers object creation for efficiency. Use getArray() and getScalar() data accessors if possible.
         Structure pdata = (Structure) ncfile.findVariable( name);
         StructureMembers members = pdata.makeStructureMembers();
         members.findMember("value").setDataParam(0); // these are the offsets into the record
         members.findMember("x_start").setDataParam(2);
         members.findMember("y_start").setDataParam(4);
         members.findMember("direction").setDataParam(6);
         members.findMember("speed").setDataParam(8);
         int recsize = pos[1] - pos[0]; // each record  must be all the same size
         members.setStructureSize( recsize);
         ArrayStructureBB asbb = new ArrayStructureBB( members, new int[] { size}, bos, pos[0]);
     
    For String members, you must store the Strings in the stringHeap. An integer index into the heap is used in the ByteBuffer.
    作者:
    caron
    另请参阅:
    Array
    • 字段详细资料

      • bb_offset

        protected int bb_offset
    • 构造器详细资料

      • ArrayStructureBB

        public ArrayStructureBB​(StructureMembers members,
                                int[] shape)
        Create a new Array of type StructureData and the given members and shape. Generally, you extract the byte array and fill it:
             byte [] result = (byte []) structureArray.getStorage(); 
        参数:
        members - a description of the structure members
        shape - the shape of the Array.
      • ArrayStructureBB

        public ArrayStructureBB​(StructureMembers members,
                                int[] shape,
                                ByteBuffer bbuffer,
                                int offset)
        Construct an ArrayStructureBB with the given ByteBuffer.
        参数:
        members - the list of structure members.
        shape - the shape of the structure array
        bbuffer - the data is stored in this ByteBuffer. bbuffer.order must already be set.
        offset - offset from the start of the ByteBufffer to the first record.