Mercurial > hg > FederatedLinda
view src/fdl/PSXQueue.java @ 0:083a0b5e12cc
Apply Debug Interface version start
author | fuchita |
---|---|
date | Thu, 07 Feb 2008 14:21:30 +0900 |
parents | |
children | aced4bfc15af |
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.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; // import java.nio.channels.*; /** PSXQueue Iterator */ public class PSXQueue implements PSXQueueInterface { public int tspace_id; public int id; public int mode; public int size; public ByteBuffer data; 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,int _size,PSXCallback _callback) { linda = _linda; id = _id; data = _data; size = _size; mode = _mode; callback = _callback; setCommand(); } private void setCommand() { command = ByteBuffer.allocate(LINDA_HEADER_SIZE); command.order(ByteOrder.BIG_ENDIAN); command.putInt(LINDA_PACKET_LENGTH_OFFSET, size+LINDA_HEADER_SIZE-INT_SIZE); command.put(LINDA_MODE_OFFSET,(byte)mode); command.putShort(LINDA_ID_OFFSET,(short)id); command.putInt(LINDA_SEQ_OFFSET,seq); command.putInt(LINDA_DATA_LENGTH_OFFSET,size); } public void setSeq(int _seq) { seq = _seq; command.putInt(LINDA_SEQ_OFFSET,seq); } public void Send() throws IOException { if (command!=null) command.rewind(); if (data!=null) data.rewind(); linda.send(command,data); } } /* end */