Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index

Class: CCSDSPacket

Parent class: CCSDSHead

Description:
This class represents a generic CCSDS telemetry packet. Such a packet consists of a 6 byte CCSDS primary header followed by some number of data bytes.

This class may be subclassed to handle secondary, etc. headers. A number of such sub-classes have been written for the Swift mission.

Data Fields
publicstatic const intSEQUENCE_PERIOD
publicstatic const intSEQUENCE_HALF_PERIOD
publicstatic const intMAX_LENGTH
privateunsigned char*_data
privateintarray_size

Constructors / Destructor
protected CCSDSPacket(const CCSDSPacket& orig)
Copy constructor.
public CCSDSPacket()
Constructor - Creates a packet with zero data size. Note that by CCSDS rules a packet must have at least one data byte, so the size(int) method should be called before anything serious is done with the packet.
public CCSDSPacket(int size)
Constructor - Create a packet with a given number of data bytes.
public ~CCSDSPacket()
Destructor - frees storage allocated for the data array.

Methods
public virtual
constant
unsigned char* data()
public virtual
constant
int size()
Return the number of bytes in the data field.
public virtual void size(int size)
Resize the data field to a given number of bytes.
public virtual
constant
unsigned int length()
public virtual void length(unsigned int value)
Override the CCSDSHeader versions of the length method to tie it to the data array size.
public virtual Reader* dataReader()
Return a pointer to a Reader object pointing to the data block of this packet. This is a new object which should be deleted when you are done with it.
public virtual Writer* dataWriter()
Return a pointer to a Reader object pointing to the data block of this packet. This is a new object which should be deleted when you are done with it.
public virtual int minimumLength()
Returns the minimum allowed value of the length field in the primary headewr for this type of packet. .
public virtual void read(const CCSDSHead& head, Reader* r)
Copy the given primary header into the packet and then read the rest of the packet. This method is useful if you want to read the packet in different ways depending on the APID. .
Throws: Interpreter::Exception
public virtual void read(Reader* r)
Read the entire packet.
Throws: Interpreter::Exception
public virtual void write(Writer* w)
Write the entire packet.
Throws: Interpreter::Exception
public virtual const string& toString()
Override the CCSDS head method since we don't need all those values.
public virtual CCSDSPacket* copy()
Return a pointer to an exact copy of this packet stored in completely different memory. Subclasses should override this method to copy secondary header data as well. This is basicly a virtual funtion wrapper around the copy constructor.
public virtual int samePlaceAs(CCSDSPacket* p)
This is the virtual funtion called by unique_comparator it returns true if two packets are not unique.
public friend int comes_before(CCSDSPacket* left, CCSDSPacket* right)
These are methods for comparing pointers for sorting and uniquing Useful if you have a STL container full of pointers to packets.
public friend int unique_comparator(CCSDSPacket* left, CCSDSPacket* right)
This function should be called when uniquing an STL container-full of pointers to packets. It is a wrapper for a virtual method.
public virtual int isAdjacentTo(CCSDSPacket* p)
Returns true if the sequence counters indicate the two packets are consecutive in a time sorted stream. Returns false if p==NULL;.
protected virtual
constant
int extraHeadSize()
This class has no secondary header, but subclasses may add one by overriding these three methods.
protected virtual void readExtraHeaders(Reader* r)
Throws: Interpreter::Exception
protected virtual void writeExtraHeaders(Writer* w)
Throws: Interpreter::Exception
protected virtual
constant
int trailerSize()
This class has no trailer, but subclasses may add one by overriding these three methods.
protected virtual void readTrailer(Reader* r)
Throws: Interpreter::Exception
protected virtual void writeTrailer(Writer* w)
Throws: Interpreter::Exception
protected virtual
constant
int extraSize()
Extra header and trailer size combined.
protected virtual void initDataArray()
Set up the data array as being empty .
protected virtual
constant
int sizeAccordingToHeader()
Return the data field size which is recorded in the primary header.
protected virtual void sizeAccordingToHeader(int size)
Set the data field size in the primary header this method is for internal use only since it does not ensure that the data array is large enough to hold this many bytes.
protected virtual void resizeDataArray(int size)
Resizes the data byte array to a specific size. Note this is for internal use only - it does not set the header length field.
private virtual void readBody(Reader* r)
Read the contents of the packet which follows the primary header. Note the primary header must be set (particularly the "length" field before this method can be called.
Throws: Interpreter: :Exception

Operators
public int CCSDSPacket& < const CCSDSPacket&
Ordering operator. Order packets by increasing sequence counter. Note that the sequence counter is cyclical, so this comparison does not make sense over a range of more than SEQUENCE_PERIOD/2 packets. This method correctly handles rollover.


Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index