view src/fdl/PSXQueue.java @ 71:0352536c33fa

(example: writer) get linda server addr from commandline arg.
author kazz@e065701.local
date Fri, 23 Oct 2009 14:11:07 +0900
parents 64071f8e2e0d
children
line wrap: on
line source


/*
 * @(#)PSXQueue.java       1.1 06/04/01
 *
 * Copyright 2006  Shinji KONO
 * 

   PSX Lidna
     Trasport layer of PSX Linda library

 */

package fdl;

import java.nio.ByteBuffer;

/**
  PSXQueue 

    Iterator
 */

public class PSXQueue {
	public int tspace_id;
	public int id;
	public int mode;
	public ByteBuffer data;
	public int size;
	public ByteBuffer command;
	public int seq;
	public PSXCallback callback;
	public PSXQueue next;
	public PSXLinda linda;

	public PSXQueue( PSXLinda _linda,int _id,int _mode,ByteBuffer _data,PSXCallback _callback) {
		linda = _linda;
		id = _id;
		data = _data;
		if (data!=null)
			size = _data.limit()-_data.position();
		else
			size = 0;
		mode = _mode;
		callback = _callback;
		setCommand();
	}

	private void setCommand() {
		command = PSX.setCommand(mode,id,seq,data);
	}

	public void setSeq(int _seq) {
		seq = _seq;
		command.putInt(PSX.LINDA_SEQ_OFFSET,seq);
		command.rewind();
	}

	public void send() {
		linda.send(command, data);
	}
}

/* end */