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
           
 
フィールドの概要
(package private)  int m_wcount
           Counter for writing
 
コンストラクタの概要
RingBuffer()
           Constructor
RingBuffer(int length)
           Constructor
 
メソッドの概要
 ReturnCode advanceRptr()
           advanceRptr
 ReturnCode advanceRptr(int n)
           advanceRptr
 ReturnCode advanceWptr()
           advanceWptr
 ReturnCode advanceWptr(int n)
           Get the buffer length
 boolean empty()
           empty
 boolean full()
           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)
           Readout data from the buffer
 int readable()
           readable
 ReturnCode reset()
           Get the buffer length
 DataType rptr()
           rptr
 DataType rptr(int n)
           rptr
 DataType wptr()
           wptr
 DataType wptr(int n)
           wptr
 int writable()
           writable
 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
 

フィールドの詳細

m_wcount

int m_wcount
Counter for writing

コンストラクタの詳細

RingBuffer

public RingBuffer()
Constructor


RingBuffer

public RingBuffer(int length)
Constructor

Initialize the buffer by specified buffer length. However, if the specified length is less than two, the buffer should be initialized by two in length.

パラメータ:
length - Buffer 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)
Readout data from the buffer

Readout data stored into the buffer.

定義:
インタフェース BufferBase<DataType> 内の read
パラメータ:
valueRef - Readout data
sec - TimeOut sec order
nsec - TimeOut nsec order
戻り値:
BUFFER_OK BUFFER_EMPTY TIMEOUT PRECONDITION_NOT_MET

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()
Get the buffer length

Pure virtual function to get the buffer length.

定義:
インタフェース BufferBase<DataType> 内の reset
戻り値:
BUFFER_OK: Normal termination NOT_SUPPORTED:Reset failure BUFFER_ERROR:Abnormal termination

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)
Get the buffer length

This function advances the writing pointer.

定義:
インタフェース BufferBase<DataType> 内の advanceWptr
パラメータ:
n - write pinter + n pointer
戻り値:
BUFFER_OK:Normal termination PRECONDITION_NOT_MET: n > writable()

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