|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjp.go.aist.rtm.RTC.buffer.RingBuffer<DataType>
DataType
- バッファ内のデータ型を指定します。public class RingBuffer<DataType>
リング状のバッファを持つバッファ実装です。 バッファ全体がデータで埋まった場合、以降のデータは古いデータから順次上書きされていきます。 これにより、直近のバッファ長分のデータのみが残ります。
入れ子のクラスの概要 | |
---|---|
protected class |
RingBuffer.condition
|
フィールドの概要 | |
---|---|
(package private) int |
m_wcount
書き込みカウント |
コンストラクタの概要 | |
---|---|
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)
書込みポインタを進める {@.ja 現在の書き込み位置のポインタを n 個進める。 |
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)
バッファから読み出す {@.ja バッファに格納されたデータを読み出す。 |
int |
readable()
readable This function returns the number of elements that can be read from the buffer. |
ReturnCode |
reset()
バッファの状態をリセットする {@.ja バッファの読み出しポインタと書き込みポインタの位置をリセットする。 |
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 |
フィールドの詳細 |
---|
int m_wcount
コンストラクタの詳細 |
---|
public RingBuffer()
public RingBuffer(int length)
指定されたバッファ長でバッファを初期化する。
length
- バッファ長
メソッドの詳細 |
---|
public int length()
バッファ長を取得します。
BufferBase<DataType>
内の length
public ReturnCode length(int n)
sets the length of the buffer.
BufferBase<DataType>
内の length
n
- length
public ReturnCode write(DataType value)
バッファにデータを書き込みます。
BufferBase<DataType>
内の write
value
- 書き込むデータ
public ReturnCode write(DataType value, int sec)
public ReturnCode write(DataType value, int sec, int nsec)
BufferBase<DataType>
内の write
public ReturnCode read(DataRef<DataType> valueRef)
バッファからデータを読み込みます。
BufferBase<DataType>
内の read
valueRef
- 読み込んだデータを受け取るためのDataRefオブジェクト
public ReturnCode read(DataRef<DataType> valueRef, int sec)
public ReturnCode read(DataRef<DataType> valueRef, int sec, int nsec)
バッファに格納されたデータを読み出す。 第2引数(sec)、第3引数(nsec)が指定されていない場合、バッファ空状 態での読み出しモード (readback, do_nothing, block) は init() で設 定されたモードに従う。 第2引数(sec) に引数が指定された場合は、init() で設定されたモード に関わらず、block モードとなり、バッファが空状態であれば指定時間 待ち、タイムアウトする。第3引数(nsec)は指定されない場合0として扱 われる。タイムアウト待ち中に、書込みスレッド側でバッファへ書込み があれば、ブロッキングは解除されデータが読みだされる。 読み出し時にバッファが空(empty)状態で、別のスレッドがblockモード で書込み待ちをしている場合、signalを発行して書込み側のブロッキン グが解除される。
BufferBase<DataType>
内の read
valueRef
- 読み出し対象データ
sec
- タイムアウト時間 sec (default -1: 無効)
nsec
- タイムアウト時間 nsec (default 0)
public boolean isFull()
バッファがフルかどうか判定します。
public ReturnCode put(DataType data)
バッファにデータを書き込みます。
BufferBase<DataType>
内の put
data
- 書き込むデータ
public DataType get()
バッファからデータを読み込みます。
BufferBase<DataType>
内の get
public ReturnCode get(DataRef<DataType> value)
get
BufferBase<DataType>
内の get
value
-
public void init(Properties prop)
init
BufferBase<DataType>
内の init
prop
- public ReturnCode reset()
バッファの読み出しポインタと書き込みポインタの位置をリセットする。 この実装では BUFFER_OK しか返さない。
BufferBase<DataType>
内の reset
public DataType wptr(int n)
wptr
This function returns the object of a present writing element of the buffer.
BufferBase<DataType>
内の wptr
n
-
public DataType wptr()
wptr
This function returns the pointer of a present writing element of the buffer.
BufferBase<DataType>
内の wptr
public ReturnCode advanceWptr(int n)
現在の書き込み位置のポインタを n 個進める。 書き込み可能な要素数以上の数値を指定した場合、PRECONDITION_NOT_MET を返す。
BufferBase<DataType>
内の advanceWptr
n
- 書込みポインタ + n の位置のポインタ
public ReturnCode advanceWptr()
advanceWptr
This function advances the writing pointer.
BufferBase<DataType>
内の advanceWptr
public int writable()
writable
This function returns the number of elements that can be written in the buffer.
BufferBase<DataType>
内の writable
public boolean full()
full
Check on whether the buffer is full
BufferBase<DataType>
内の full
public DataType rptr(int n)
rptr
This function returns the pointer of a present reading element of the buffer.
BufferBase<DataType>
内の rptr
n
-
public DataType rptr()
rptr
This function returns the pointer of a present reading element of the buffer.
BufferBase<DataType>
内の rptr
public ReturnCode advanceRptr(int n)
advanceRptr
This function advances the reading pointer.
BufferBase<DataType>
内の advanceRptr
n
-
public ReturnCode advanceRptr()
advanceRptr
This function advances the reading pointer.
BufferBase<DataType>
内の advanceRptr
public int readable()
readable
This function returns the number of elements that can be read from the buffer.
BufferBase<DataType>
内の readable
public boolean empty()
empty
Check on whether the buffer is empty.
BufferBase<DataType>
内の empty
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |