CTL.Types
Class Header

java.lang.Object
  extended by CTL.Measure
      extended by CTL.Types.Header
All Implemented Interfaces:
Writable

public class Header
extends Measure
implements Writable

CTL protocol header


Field Summary
private  int logID
          Logical ID
private  boolean needSwap
          Whether or not swapping is required
private  PeerID pid
          Sender PeerID
private  long size
          Payload size
private  int tag
          Message tag
 
Constructor Summary
Header()
           
Header(long size, int tag, GroupInfo grp)
          Constructor which gets the PeerID from a GroupInfo object
Header(long size, int tag, IPaddr host, int port, int logID)
          Constructor with host and port
Header(long size, int tag, PeerID pid, int logID)
          Default constructor
 
Method Summary
 long getSize()
          Retrieve payload size
 boolean needSwap()
          Determine if swapping is required
 PeerID pid()
          Retrieve the PeerID
 void read(SerialIn in)
          Serial read function
 void setSize(long size)
          Set payload size
 int tag()
          Retrieve the message tag
 java.lang.String toString()
          Retrieve a string representation of this object
 void write(SerialOut out)
          Serial write function
 
Methods inherited from class CTL.Measure
size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

private long size
Payload size


tag

private int tag
Message tag


pid

private PeerID pid
Sender PeerID


logID

private int logID
Logical ID


needSwap

private boolean needSwap
Whether or not swapping is required

Constructor Detail

Header

public Header(long size,
              int tag,
              PeerID pid,
              int logID)
Default constructor


Header

public Header(long size,
              int tag,
              IPaddr host,
              int port,
              int logID)
Constructor with host and port


Header

public Header(long size,
              int tag,
              GroupInfo grp)
Constructor which gets the PeerID from a GroupInfo object


Header

public Header()
Method Detail

toString

public java.lang.String toString()
Retrieve a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

setSize

public void setSize(long size)
Set payload size

Parameters:
size - Payload size

getSize

public long getSize()
Retrieve payload size

Returns:
Payload size

pid

public PeerID pid()
Retrieve the PeerID

Returns:
PeerID

tag

public int tag()
Retrieve the message tag

Returns:
Message tag

read

public void read(SerialIn in)
          throws java.io.IOException,
                 java.lang.reflect.InvocationTargetException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException
Serial read function

Specified by:
read in interface Writable
Parameters:
in - Input stream
Throws:
java.io.IOException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

write

public void write(SerialOut out)
           throws java.io.IOException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException,
                  CTLException
Serial write function

Specified by:
write in interface Writable
Parameters:
out - Output stream
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
CTLException

needSwap

public boolean needSwap()
Determine if swapping is required

Returns:
True if it is, false otherwise