jAER project on SourceForge

net.sf.jaer.aemonitor
Class AEPacketRaw

java.lang.Object
  extended by net.sf.jaer.aemonitor.AEPacket
      extended by net.sf.jaer.aemonitor.AEPacketRaw

public class AEPacketRaw
extends AEPacket

A structure containing a packer of AEs: addresses, timestamps. The AE packet efficiently packages a set of events: rather than using an object per event, it packs a lot of events into an object that references arrays of primitives. These arrays can be newly allocated or statically allocated to the capacity of the maximum buffer that is transferred from a device. Callers must use AEPacket.getNumEvents() to find out the capacity of the packet in the case that the arrays contain less events than their capacity, which is usually the case when the packet is reused in a device acquisition.

These AEPacketRaw are used only for device events (raw events). For processed events, see the net.sf.jaer.event package.

Author:
tobi

Field Summary
 int[] addresses
          The raw AER addresses
 int lastCaptureIndex
          the index of the start of the last packet captured from a device, used for processing data on acquisition.
 int lastCaptureLength
          the number of events last captured.
 boolean overrunOccuredFlag
          Signals that an overrun occured on this packet
 
Fields inherited from class net.sf.jaer.aemonitor.AEPacket
capacity, events, numEvents, timestamps
 
Constructor Summary
AEPacketRaw()
          Creates a new instance of AEPacketRaw with 0 capacity
AEPacketRaw(int size)
          Creates a new instance of AEPacketRaw with an initial capacity
AEPacketRaw(int[] addresses, int[] timestamps)
          Creates a new instance of AEPacketRaw from addresses and timestamps
 
Method Summary
 void addEvent(EventRaw e)
           
protected  void allocateArrays(int size)
           
 void clear()
          sets number of events to zero
 void ensureCapacity(int c)
          ensure the capacity given.
 int[] getAddresses()
           
 int getCapacity()
           
 EventRaw getEvent(int k)
          uses local EventRaw to return packaged event.
 AEPacketRaw getPrunedCopy()
          Allocates a new AEPacketRaw and copies the events from this packet into the new one, returning it.
 void setAddresses(int[] addresses)
           
 
Methods inherited from class net.sf.jaer.aemonitor.AEPacket
addEvent, getDt, getFirstTimestamp, getLastTimestamp, getNumEvents, getTimestamp, getTimestamps, setNumEvents, setTimestamps, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastCaptureIndex

public int lastCaptureIndex
the index of the start of the last packet captured from a device, used for processing data on acquisition. The hardware interface class is responsible for setting this value.


lastCaptureLength

public int lastCaptureLength
the number of events last captured. The hardware interface class is responsible for setting this value.


addresses

public int[] addresses
The raw AER addresses


overrunOccuredFlag

public boolean overrunOccuredFlag
Signals that an overrun occured on this packet

Constructor Detail

AEPacketRaw

public AEPacketRaw()
Creates a new instance of AEPacketRaw with 0 capacity


AEPacketRaw

public AEPacketRaw(int[] addresses,
                   int[] timestamps)
Creates a new instance of AEPacketRaw from addresses and timestamps

Parameters:
addresses -
timestamps -

AEPacketRaw

public AEPacketRaw(int size)
Creates a new instance of AEPacketRaw with an initial capacity

Parameters:
size - capacity in events
Method Detail

allocateArrays

protected void allocateArrays(int size)

getAddresses

public int[] getAddresses()

setAddresses

public void setAddresses(int[] addresses)

getEvent

public EventRaw getEvent(int k)
uses local EventRaw to return packaged event. (Does not create a new object instance.)


getCapacity

public int getCapacity()
Overrides:
getCapacity in class AEPacket
Returns:
the maximum capacity for holding events in the packet. Not the number of events present now.

ensureCapacity

public void ensureCapacity(int c)
ensure the capacity given. If present capacity is less than capacity, then arrays are newly allocated.

Overrides:
ensureCapacity in class AEPacket
Parameters:
c - the desired capacity

addEvent

public void addEvent(EventRaw e)
Parameters:
e - an Event to add to the ones already present. Capacity is enlarged if necessary.

clear

public void clear()
sets number of events to zero

Overrides:
clear in class AEPacket

getPrunedCopy

public AEPacketRaw getPrunedCopy()
Allocates a new AEPacketRaw and copies the events from this packet into the new one, returning it. The size of the new packet that is returned is exactly the number of events stored in the this packet. This method can be used to more efficiently use matlab memory, which handles java garbage collection poorly.

Returns:
a new packet sized to the src packet number of events

jAER project on SourceForge