gov.nasa.gsfc.drl.rtstps.core.output.hdf5
Class PacketTrackerItem

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.output.hdf5.PacketTrackerItem

public class PacketTrackerItem
extends java.lang.Object

The packet tracker item is part of the header in the RawApplicationPackets area. This class manages ne of these items, it can be either to create a PacketTrackerItem or it can be used to read one from a pre-existing file.


Field Summary
private  int appId
           
private  int count
           
private  byte[] data
           
private  int fillPercent
           
private  int hdfOffset
           
private  long obsTime
           
private  int offset
           
private  int pktTrkr_size
           
private  int sequenceNumber
           
private static int size
           
 
Constructor Summary
PacketTrackerItem()
          Constructor.
PacketTrackerItem(byte[] data, int offset)
          Given an already filled memory buffer, retrieve values at the given offset to build the packet tracker items.
PacketTrackerItem(long obsTime, int sequenceNumber, int size, int hdfOffset, int fillPercent)
          Construct a new packet tracker item with the input values.
 
Method Summary
 void addCount(int count)
          Add to the count
 void addSize(int size)
          Add to the packet tracker size
 int getAppId()
          Get the packet application ID
 int getCount()
          Get the count
 int getFillPercent()
          Get the fill percentage
static int getHDFSize()
          The size is fixed, retrieve it for other reasons
 long getObsTime()
          Get the observation time
 int getOffset()
          Get the header offset
 int getSequenceNumber()
          Get the sequence number
 int getSize()
          Get the size of the pkt tracker
private  void readFillPercent()
          Read the fill percentage from a data buffer passed in the in "read" constructor
private  void readObsTime()
          Read the observation time from a data buffer passed in the in "read" constructor
private  void readOffset()
          Read the offset from a data buffer passed in the in "read" constructor
private  void readSequenceNumber()
          Read the sequence number from a data buffer passed in the in "read" constructor
private  void readSize()
          Read the size from a data buffer passed in the in "read" constructor
 void setAppId(int appId)
          Set the application id of the packet tracker
 void setCount(int count)
          Set the count
 void setFillPercent(int fillPercent)
          Set the fill percentage
 void setObsTime(long obsTime)
          Set the observation time
 void setOffset(int hdfOffset)
          Set the offset in the header
 void setSequenceNumber(int sequenceNumber)
          Set the sequence number
 void setSize(int size)
          Set the packet tracker size
 int write(byte[] data, int offset)
          Write the newly constructed PacketTrackerItem information to the data array given
private  void writeFillPercent()
          Serialize the fill percent into the data array
private  void writeObsTime()
          Serialize the observation time into the data array
private  void writeOffset()
          Serialize the offset into the data array
private  void writeSequenceNumber()
          Serialize the sequence number into the data array
private  void writeSize()
          Serialize the size into the data array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obsTime

private long obsTime

sequenceNumber

private int sequenceNumber

pktTrkr_size

private int pktTrkr_size

hdfOffset

private int hdfOffset

fillPercent

private int fillPercent

size

private static final int size
See Also:
Constant Field Values

count

private int count

appId

private int appId

data

private byte[] data

offset

private int offset
Constructor Detail

PacketTrackerItem

public PacketTrackerItem(long obsTime,
                         int sequenceNumber,
                         int size,
                         int hdfOffset,
                         int fillPercent)
Construct a new packet tracker item with the input values. Once constructed the values may be written to a memory buffer using the write method. This is intended to be used to write an HDF structure, so this is the "write" side of the class.

Parameters:
obsTime - the observation time
sequenceNumber - the sequence number
size - the size of the packet tracker
hdfOffset - the offset in the header
fillPercent - the fill percentage which is fixed for DRL/field terminal at this time

PacketTrackerItem

public PacketTrackerItem()
Constructor. Variation on a theme, each of the fields is set using a setter method...


PacketTrackerItem

public PacketTrackerItem(byte[] data,
                         int offset)
Given an already filled memory buffer, retrieve values at the given offset to build the packet tracker items. The items can then be retrieved using the "read" methods below. Hence this is the read side of the class. Note, the two sides are not synchronized in anyway, nor would changes in the data buffer passed in here be reflected in the objects values if it were to change.

Parameters:
data -
offset -
Method Detail

setObsTime

public void setObsTime(long obsTime)
Set the observation time

Parameters:
obsTime - the observation time in 64-bits

setSequenceNumber

public void setSequenceNumber(int sequenceNumber)
Set the sequence number

Parameters:
sequenceNumber - the sequence number

setSize

public void setSize(int size)
Set the packet tracker size

Parameters:
size - the size

addSize

public void addSize(int size)
Add to the packet tracker size

Parameters:
size - this is used when...

setOffset

public void setOffset(int hdfOffset)
Set the offset in the header

Parameters:
hdfOffset - the offset in bytes

setFillPercent

public void setFillPercent(int fillPercent)
Set the fill percentage

Parameters:
fillPercent - the fill percentage

setCount

public void setCount(int count)
Set the count

Parameters:
count -

addCount

public void addCount(int count)
Add to the count

Parameters:
count -

setAppId

public void setAppId(int appId)
Set the application id of the packet tracker

Parameters:
appId -

getObsTime

public long getObsTime()
Get the observation time

Returns:
the observation time in 64 bits

getSequenceNumber

public int getSequenceNumber()
Get the sequence number

Returns:
the sequence number in an int

getSize

public int getSize()
Get the size of the pkt tracker

Returns:
the size

getOffset

public int getOffset()
Get the header offset

Returns:
the offset in bytes

getFillPercent

public int getFillPercent()
Get the fill percentage

Returns:
the fill percentage

getAppId

public int getAppId()
Get the packet application ID

Returns:
the application ID in an int

getCount

public int getCount()
Get the count

Returns:
the count

getHDFSize

public static int getHDFSize()
The size is fixed, retrieve it for other reasons

Returns:
the size in bytes

write

public int write(byte[] data,
                 int offset)
Write the newly constructed PacketTrackerItem information to the data array given

Parameters:
data - the byte array the packet tracker information should be packed into
offset - the offset in bytes into the array
Returns:
the size of the item which is fixed

writeObsTime

private void writeObsTime()
Serialize the observation time into the data array


writeSequenceNumber

private void writeSequenceNumber()
Serialize the sequence number into the data array


writeSize

private void writeSize()
Serialize the size into the data array


writeOffset

private void writeOffset()
Serialize the offset into the data array


writeFillPercent

private void writeFillPercent()
Serialize the fill percent into the data array


readObsTime

private void readObsTime()
Read the observation time from a data buffer passed in the in "read" constructor


readSequenceNumber

private void readSequenceNumber()
Read the sequence number from a data buffer passed in the in "read" constructor


readSize

private void readSize()
Read the size from a data buffer passed in the in "read" constructor


readOffset

private void readOffset()
Read the offset from a data buffer passed in the in "read" constructor


readFillPercent

private void readFillPercent()
Read the fill percentage from a data buffer passed in the in "read" constructor