jp.go.aist.rtm.RTC.buffer
クラス RingBuffer<DataType>

java.lang.Object
  上位を拡張 jp.go.aist.rtm.RTC.buffer.RingBuffer<DataType>
型パラメータ:
DataType - バッファ内のデータ型を指定します。
すべての実装されたインタフェース:
BufferBase<DataType>

public class RingBuffer<DataType>
extends java.lang.Object
implements BufferBase<DataType>

リング状のバッファを持つバッファ実装です。 バッファ全体がデータで埋まった場合、以降のデータは古いデータから順次上書きされていきます。 これにより、直近のバッファ長分のデータのみが残ります。


入れ子のクラスの概要
protected  class RingBuffer.condition
           
 
コンストラクタの概要
RingBuffer()
          コンストラクタです。
RingBuffer(int length)
          コンストラクタです。
 
メソッドの概要
 ReturnCode advanceRptr()
           advanceRptr This function advances the reading pointer.
 ReturnCode advanceRptr(int n)
           advanceRptr This function advances the reading pointer.
 ReturnCode advanceWptr()
           advanceWptr This function advances the writing pointer.
 ReturnCode advanceWptr(int n)
           advanceWptr This function advances the writing pointer.
 boolean empty()
           empty Check on whether the buffer is empty.
 boolean full()
           full Check on whether the buffer is full
 DataType get()
          バッファからデータを読み込みます。
 ReturnCode get(DataRef<DataType> value)
           get
 void init(Properties prop)
           init
 boolean isFull()
          バッファがフルかどうか判定します。
 int length()
          バッファ長を取得します。
 ReturnCode length(int n)
           sets the length of the buffer.
 ReturnCode put(DataType data)
          バッファにデータを書き込みます。
 ReturnCode read(DataRef<DataType> valueRef)
          バッファからデータを読み込みます。
 ReturnCode read(DataRef<DataType> valueRef, int sec)
           
 ReturnCode read(DataRef<DataType> valueRef, int sec, int nsec)
           
 int readable()
           readable This function returns the number of elements that can be read from the buffer.
 ReturnCode reset()
           reset This function resets the state of the buffer.
 DataType rptr()
           rptr This function returns the pointer of a present reading element of the buffer.
 DataType rptr(int n)
           rptr This function returns the pointer of a present reading element of the buffer.
 DataType wptr()
           wptr This function returns the pointer of a present writing element of the buffer.
 DataType wptr(int n)
           wptr This function returns the object of a present writing element of the buffer.
 int writable()
           writable This function returns the number of elements that can be written in the buffer.
 ReturnCode write(DataType value)
          バッファにデータを書き込みます。
 ReturnCode write(DataType value, int sec)
           
 ReturnCode write(DataType value, int sec, int nsec)
           
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

RingBuffer

public RingBuffer()

コンストラクタです。


RingBuffer

public RingBuffer(int length)

コンストラクタです。

パラメータ:
length - バッファ長
メソッドの詳細

length

public int length()

バッファ長を取得します。

定義:
インタフェース BufferBase<DataType> 内の length
戻り値:
バッファ長

length

public ReturnCode length(int n)

sets the length of the buffer.

定義:
インタフェース BufferBase<DataType> 内の length
パラメータ:
n - length
戻り値:
BUFFER_OK

write

public ReturnCode write(DataType value)

バッファにデータを書き込みます。

定義:
インタフェース BufferBase<DataType> 内の write
パラメータ:
value - 書き込むデータ
戻り値:
書き込みに成功した場合はtrueを、さもなくばfalseを返します。

write

public ReturnCode write(DataType value,
                        int sec)

write

public ReturnCode write(DataType value,
                        int sec,
                        int nsec)
定義:
インタフェース BufferBase<DataType> 内の write

read

public ReturnCode read(DataRef<DataType> valueRef)

バッファからデータを読み込みます。

定義:
インタフェース BufferBase<DataType> 内の read
パラメータ:
valueRef - 読み込んだデータを受け取るためのDataRefオブジェクト
戻り値:
読み込みに成功した場合はtrueを、さもなくばfalseを返します。

read

public ReturnCode read(DataRef<DataType> valueRef,
                       int sec)

read

public ReturnCode read(DataRef<DataType> valueRef,
                       int sec,
                       int nsec)
定義:
インタフェース BufferBase<DataType> 内の read

isFull

public boolean isFull()

バッファがフルかどうか判定します。

戻り値:
バッファがフルならばtrue、さもなくばfalseを返します。

put

public ReturnCode put(DataType data)

バッファにデータを書き込みます。

定義:
インタフェース BufferBase<DataType> 内の put
パラメータ:
data - 書き込むデータ
戻り値:
ReturnCode

get

public DataType get()

バッファからデータを読み込みます。

定義:
インタフェース BufferBase<DataType> 内の get
戻り値:
読み込んだデータ

get

public ReturnCode get(DataRef<DataType> value)

get

定義:
インタフェース BufferBase<DataType> 内の get
パラメータ:
value -
戻り値:
ReturnCode

init

public void init(Properties prop)

init

定義:
インタフェース BufferBase<DataType> 内の init
パラメータ:
prop -

reset

public ReturnCode reset()

reset

This function resets the state of the buffer.

定義:
インタフェース BufferBase<DataType> 内の reset
戻り値:
ReturnCode

wptr

public DataType wptr(int n)

wptr

This function returns the object of a present writing element of the buffer.

定義:
インタフェース BufferBase<DataType> 内の wptr
パラメータ:
n -
戻り値:
DataType

wptr

public DataType wptr()

wptr

This function returns the pointer of a present writing element of the buffer.

定義:
インタフェース BufferBase<DataType> 内の wptr
戻り値:
DataType

advanceWptr

public ReturnCode advanceWptr(int n)

advanceWptr

This function advances the writing pointer.

定義:
インタフェース BufferBase<DataType> 内の advanceWptr
パラメータ:
n -
戻り値:
ReturnCode

advanceWptr

public ReturnCode advanceWptr()

advanceWptr

This function advances the writing pointer.

定義:
インタフェース BufferBase<DataType> 内の advanceWptr
戻り値:
ReturnCode

writable

public int writable()

writable

This function returns the number of elements that can be written in the buffer.

定義:
インタフェース BufferBase<DataType> 内の writable
戻り値:
int

full

public boolean full()

full

Check on whether the buffer is full

定義:
インタフェース BufferBase<DataType> 内の full
戻り値:
boolean

rptr

public DataType rptr(int n)

rptr

This function returns the pointer of a present reading element of the buffer.

定義:
インタフェース BufferBase<DataType> 内の rptr
パラメータ:
n -
戻り値:
DataType

rptr

public DataType rptr()

rptr

This function returns the pointer of a present reading element of the buffer.

定義:
インタフェース BufferBase<DataType> 内の rptr
戻り値:
DataType

advanceRptr

public ReturnCode advanceRptr(int n)

advanceRptr

This function advances the reading pointer.

定義:
インタフェース BufferBase<DataType> 内の advanceRptr
パラメータ:
n -
戻り値:
ReturnCode

advanceRptr

public ReturnCode advanceRptr()

advanceRptr

This function advances the reading pointer.

定義:
インタフェース BufferBase<DataType> 内の advanceRptr
戻り値:
ReturnCode

readable

public int readable()

readable

This function returns the number of elements that can be read from the buffer.

定義:
インタフェース BufferBase<DataType> 内の readable
戻り値:
int

empty

public boolean empty()

empty

Check on whether the buffer is empty.

定義:
インタフェース BufferBase<DataType> 内の empty
戻り値:
boolean