/*************************************************
 * Author: 	Evelyn Lai-Tee Cheok
 *			Department of Electrical Engineering
 *			Center for Telecommunications Research
 *			Schapiro Research Building
 *			Columbia University
 *
 * Email: 	laitee@ctr.columbia.edu
 *
 **************************************************/
import java.lang.*;
import java.io.*;
import SenderMCSocket;
import PacketHandler;

/** ObjBaseClass is the base class for all the graphics object,
	ie, Line, Rectangle, Circle and Oval classes. It invokes 
	the assemble function of the RTP Packet Handler, before sending
	over the network via the sender multicast socket (SenderMCSocket). **/

public class ObjBaseClass {
	SenderMCSocket senderSock;
	PacketHandler pkt_handler;
	byte[] pkt_buf = new byte[1024];

	public static final int TRANSLATE_X = 10;
	public static final int TRANSLATE_Y = 10;

	/** Constructor function **/
	public ObjBaseClass(SenderMCSocket senderSock,
					PacketHandler pkt_handler) {
		this.senderSock = senderSock;
		this.pkt_handler = pkt_handler;
	}


	/** BaseClassAssemble to call on the assemble function of the
		RTP Packet Handler to assemble RTP header with the Line,
		Rectanle, Circle and Oval data, before sending to the network
		using SenderMCSocket. **/
	/** passed in exact data_buf size of graphics object eg: line, etc **/

	public void BaseClassAssemble(byte[] data_buf) {
		if ( (pkt_buf = pkt_handler.assemble(data_buf) ) != null ) {
			senderSock.sendByteData(pkt_buf);
		}
		else
			System.out.println("Error in BaseClassAssemble, pkt_buf returned is NULL !!!\n");
	}

}

