public abstract class BaseDataBuffer extends Object implements DataBuffer
DataBuffer.AllocationMode, DataBuffer.Type
Modifier and Type | Field and Description |
---|---|
protected DataBuffer.AllocationMode |
allocationMode |
protected boolean |
constant |
protected AtomicBoolean |
dirty |
protected int |
elementSize |
protected DataBuffer.Type |
globalType |
protected org.bytedeco.javacpp.indexer.Indexer |
indexer |
protected boolean |
isPersist |
protected long |
length |
protected long |
offset |
protected DataBuffer |
originalBuffer |
protected long |
originalOffset |
protected org.bytedeco.javacpp.Pointer |
pointer |
protected Collection<String> |
referencing |
protected Long |
trackingPoint |
protected DataBuffer.Type |
type |
protected long |
underlyingLength |
protected ByteBuffer |
wrappedBuffer |
protected DataBuffer |
wrappedDataBuffer |
Modifier | Constructor and Description |
---|---|
|
BaseDataBuffer() |
|
BaseDataBuffer(byte[] data,
long length) |
|
BaseDataBuffer(ByteBuffer buffer,
long length)
Create a data buffer from
the given length
|
|
BaseDataBuffer(ByteBuffer buffer,
long length,
int offset)
Create a data buffer from
the given length
|
protected |
BaseDataBuffer(DataBuffer underlyingBuffer,
long length,
long offset)
Meant for creating another view of a buffer
|
|
BaseDataBuffer(double[] data) |
|
BaseDataBuffer(double[] data,
boolean copy) |
|
BaseDataBuffer(double[] data,
boolean copy,
int offset) |
|
BaseDataBuffer(float[] data) |
|
BaseDataBuffer(float[] data,
boolean copy) |
|
BaseDataBuffer(float[] data,
boolean copy,
int offset) |
|
BaseDataBuffer(int[] data) |
|
BaseDataBuffer(int[] data,
boolean copy) |
|
BaseDataBuffer(int[] data,
boolean copy,
int offset) |
|
BaseDataBuffer(int length,
int elementSize,
int offset) |
protected |
BaseDataBuffer(long length)
Instantiate a buffer with the given length
|
protected |
BaseDataBuffer(long length,
boolean initialize) |
|
BaseDataBuffer(long length,
int elementSize) |
|
BaseDataBuffer(org.bytedeco.javacpp.Pointer pointer,
org.bytedeco.javacpp.indexer.Indexer indexer,
long length)
Meant for creating another view of a buffer
|
Modifier and Type | Method and Description |
---|---|
void |
addReferencing(String id)
Add a referencing element to this buffer
|
long |
address()
Returns the address of the pointer
|
org.bytedeco.javacpp.Pointer |
addressPointer()
Returns the address of the pointer wrapped in a Pointer
|
DataBuffer.AllocationMode |
allocationMode()
Allocation mode for buffers
|
Object |
array()
Returns the backing array
of this buffer (if there is one)
|
byte[] |
asBytes()
Raw byte array storage
|
double[] |
asDouble()
Return the buffer as a double array
Relative to the datatype, this will either be a copy
or a reference.
|
float[] |
asFloat()
Return the buffer as a float array
Relative to the datatype, this will either be a copy
or a reference.
|
int[] |
asInt()
Return the buffer as an int array
Relative to the datatype, this will either be a copy
or a reference.
|
ByteBuffer |
asNio()
Returns a view of this as an
nio byte buffer
|
DoubleBuffer |
asNioDouble()
Returns a view of this as an
nio byte buffer
|
FloatBuffer |
asNioFloat()
Returns a view of this as an
nio byte buffer
|
IntBuffer |
asNioInt()
Returns a view of this as an
nio byte buffer
|
void |
assign(DataBuffer... buffers)
Assign the given data buffers to this buffer
|
void |
assign(DataBuffer data)
Assign the contents of this buffer
to this buffer
|
void |
assign(long[] indices,
double[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
double[] data,
boolean contiguous,
long inc)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
float[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(long[] indices,
float[] data,
boolean contiguous,
long inc)
Assign the given elements to the given indices
|
void |
assign(long[] offsets,
long[] strides,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(long[] offsets,
long[] strides,
long n,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(Number value)
Assign the given value to the buffer
|
void |
assign(Number value,
long offset)
Assign the given value to the buffer
starting at offset
|
void |
copyAtStride(DataBuffer buf,
long n,
long stride,
long yStride,
long offset,
long yOffset)
Copies from
the given buffer
at the specified stride
for up to n elements
|
abstract DataBuffer |
create(double[] data)
Create the data buffer
with respect to the given byte buffer
|
abstract DataBuffer |
create(float[] data)
Create the data buffer
with respect to the given byte buffer
|
abstract DataBuffer |
create(int[] data)
Create the data buffer
with respect to the given byte buffer
|
protected abstract DataBuffer |
create(long length)
Create with length
|
DataBuffer.Type |
dataType()
The data type of the buffer
|
void |
destroy()
release all resources for this buffer
|
boolean |
dirty()
Whether the buffer is dirty:
aka has been updated
|
protected void |
doReadObject(ObjectInputStream s) |
DataBuffer |
dup()
Return a copy of this buffer
|
boolean |
equals(Object o) |
void |
flush()
Flush the data buffer
|
IComplexNumber |
getComplex(long i)
Returns a complex number
|
abstract IComplexDouble |
getComplexDouble(long i)
Get the complex double at the specified index
|
abstract IComplexFloat |
getComplexFloat(long i)
Get the complex float
|
double |
getDouble(long i)
Get element i in the buffer as a double
|
double[] |
getDoublesAt(long offset,
int length)
Get the doubles at a particular offset
|
double[] |
getDoublesAt(long offset,
long inc,
int length)
Get the doubles at a particular offset
|
int |
getElementSize()
The number of bytes for each individual element
|
float |
getFloat(long i)
Get element i in the buffer as a double
|
float[] |
getFloatsAt(long offset,
int length)
Get the doubles at a particular offset
|
float[] |
getFloatsAt(long offset,
long inc,
int length)
Get the doubles at a particular offset
|
int |
getInt(long i)
Get the int at the specified index
|
Number |
getNumber(long i)
Get element i in the buffer as a double
|
Long |
getTrackingPoint()
Returns tracking point for Allocator
PLEASE NOTE: Suitable & meaningful only for specific backends
|
int |
hashCode() |
org.bytedeco.javacpp.indexer.Indexer |
indexer()
Returns the indexer for the buffer
|
protected abstract void |
initTypeAndSize()
Initialize the type of this buffer
|
boolean |
isConstant()
This method returns whether this DataBuffer is constant, or not.
|
boolean |
isPersist()
Whether the buffer should be persistent.
|
long |
length()
Returns the length of the buffer
|
long |
offset()
Returns the offset of the buffer
|
DataBuffer |
originalDataBuffer()
Original DataBuffer.
|
long |
originalOffset()
Returns the offset of the buffer relative to originalDataBuffer
|
void |
persist()
Mark this buffer as persistent
|
org.bytedeco.javacpp.Pointer |
pointer()
Returns an underlying pointer if one exists
|
void |
pointerIndexerByGlobalType(DataBuffer.Type currentType) |
void |
put(long i,
double element)
Assign an element in the buffer to the specified index
|
void |
put(long i,
float element)
Assign an element in the buffer to the specified index
|
void |
put(long i,
IComplexNumber result)
Insert a complex number at the given index
|
void |
put(long i,
int element)
Assign an element in the buffer to the specified index
|
void |
putByGlobalType(long i,
Number element) |
void |
read(DataInputStream s) |
void |
read(InputStream is)
Write this buffer to the input stream.
|
Collection<String> |
references()
The referencers pointing to this buffer
|
void |
removeReferencing(String id)
Remove the referenced id if it exists
|
boolean |
sameUnderlyingData(DataBuffer buffer)
Returns true if the underlying data source
is the same for both buffers (referential equals)
|
void |
setConstant(boolean reallyConstant)
This method allows you to mark databuffer as constant.
|
void |
setData(double[] data)
Set the data for this buffer
|
void |
setData(float[] data)
Set the data for this buffer
|
void |
setData(int[] data)
Set the data for this buffer
|
protected void |
setNioBuffer() |
void |
setTrackingPoint(Long trackingPoint)
Sets tracking point used by Allocator
PLEASE NOTE: Suitable & meaningful only for specific backends
|
String |
toString() |
DataBuffer |
underlyingDataBuffer()
Underlying buffer:
This is meant for a data buffer
to be a view of another data buffer
|
long |
underlyingLength()
Returns the length of the buffer
|
void |
unPersist()
Un persist the buffer
|
void |
write(DataOutputStream out) |
void |
write(OutputStream dos)
Write this buffer to the output stream
|
protected DataBuffer.Type type
protected DataBuffer.Type globalType
protected long length
protected long underlyingLength
protected long offset
protected int elementSize
protected transient ByteBuffer wrappedBuffer
protected transient DataBuffer wrappedDataBuffer
protected Collection<String> referencing
protected boolean isPersist
protected DataBuffer.AllocationMode allocationMode
protected transient org.bytedeco.javacpp.Pointer pointer
protected transient org.bytedeco.javacpp.indexer.Indexer indexer
protected AtomicBoolean dirty
protected transient DataBuffer originalBuffer
protected transient long originalOffset
protected transient Long trackingPoint
protected transient boolean constant
public BaseDataBuffer()
public BaseDataBuffer(org.bytedeco.javacpp.Pointer pointer, org.bytedeco.javacpp.indexer.Indexer indexer, long length)
pointer
- the underlying buffer to create a view fromindexer
- the indexer for the pointerlength
- the length of the viewprotected BaseDataBuffer(DataBuffer underlyingBuffer, long length, long offset)
underlyingBuffer
- the underlying buffer to create a view fromlength
- the length of the viewoffset
- the offset for the viewpublic BaseDataBuffer(float[] data, boolean copy, int offset)
data
- copy
- public BaseDataBuffer(float[] data, boolean copy)
data
- copy
- public BaseDataBuffer(double[] data, boolean copy, int offset)
data
- copy
- public BaseDataBuffer(double[] data, boolean copy)
data
- copy
- public BaseDataBuffer(int[] data, boolean copy, int offset)
data
- copy
- public BaseDataBuffer(int[] data, boolean copy)
data
- copy
- public BaseDataBuffer(double[] data)
data
- public BaseDataBuffer(int[] data)
data
- public BaseDataBuffer(float[] data)
data
- public BaseDataBuffer(int length, int elementSize, int offset)
length
- elementSize
- public BaseDataBuffer(long length, int elementSize)
length
- elementSize
- public BaseDataBuffer(ByteBuffer buffer, long length, int offset)
buffer
- length
- public BaseDataBuffer(ByteBuffer buffer, long length)
buffer
- length
- public BaseDataBuffer(byte[] data, long length)
data
- length
- protected BaseDataBuffer(long length)
length
- the length of the bufferprotected BaseDataBuffer(long length, boolean initialize)
protected abstract void initTypeAndSize()
public int getElementSize()
DataBuffer
getElementSize
in interface DataBuffer
public DataBuffer originalDataBuffer()
originalDataBuffer
in interface DataBuffer
protected void setNioBuffer()
public org.bytedeco.javacpp.indexer.Indexer indexer()
indexer
in interface DataBuffer
public org.bytedeco.javacpp.Pointer pointer()
DataBuffer
pointer
in interface DataBuffer
public DataBuffer underlyingDataBuffer()
DataBuffer
underlyingDataBuffer
in interface DataBuffer
public long offset()
DataBuffer
offset
in interface DataBuffer
public DataBuffer.AllocationMode allocationMode()
DataBuffer
allocationMode
in interface DataBuffer
public void persist()
DataBuffer
persist
in interface DataBuffer
public boolean isPersist()
DataBuffer
isPersist
in interface DataBuffer
public void unPersist()
DataBuffer
unPersist
in interface DataBuffer
public void copyAtStride(DataBuffer buf, long n, long stride, long yStride, long offset, long yOffset)
DataBuffer
copyAtStride
in interface DataBuffer
buf
- the data buffer to copy fromn
- the number of elements to copystride
- the stride to copy atpublic void removeReferencing(String id)
DataBuffer
removeReferencing
in interface DataBuffer
id
- the id to removepublic Collection<String> references()
DataBuffer
references
in interface DataBuffer
public org.bytedeco.javacpp.Pointer addressPointer()
DataBuffer
addressPointer
in interface DataBuffer
public long address()
DataBuffer
address
in interface DataBuffer
public void addReferencing(String id)
DataBuffer
addReferencing
in interface DataBuffer
id
- the id to referencepublic void assign(long[] indices, float[] data, boolean contiguous, long inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notinc
- the number to increment by when assigningpublic void setData(int[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void setData(float[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void setData(double[] data)
DataBuffer
setData
in interface DataBuffer
data
- the data for this bufferpublic void assign(long[] indices, double[] data, boolean contiguous, long inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notinc
- the number to increment by when assigningpublic void assign(DataBuffer data)
DataBuffer
assign
in interface DataBuffer
data
- the data to assignpublic void assign(long[] indices, float[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notpublic void assign(long[] indices, double[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notpublic long underlyingLength()
DataBuffer
underlyingLength
in interface DataBuffer
public long length()
DataBuffer
length
in interface DataBuffer
public void assign(Number value)
DataBuffer
assign
in interface DataBuffer
value
- the value to assignpublic double[] getDoublesAt(long offset, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic float[] getFloatsAt(long offset, long inc, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic DataBuffer dup()
DataBuffer
dup
in interface DataBuffer
protected abstract DataBuffer create(long length)
length
- a databuffer of the same type as
this with the given lengthpublic abstract DataBuffer create(double[] data)
data
- the buffer to createpublic abstract DataBuffer create(float[] data)
data
- the buffer to createpublic abstract DataBuffer create(int[] data)
data
- the buffer to createpublic double[] getDoublesAt(long offset, long inc, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic float[] getFloatsAt(long offset, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic abstract IComplexFloat getComplexFloat(long i)
DataBuffer
getComplexFloat
in interface DataBuffer
i
- the i togetepublic abstract IComplexDouble getComplexDouble(long i)
DataBuffer
getComplexDouble
in interface DataBuffer
i
- the indexpublic IComplexNumber getComplex(long i)
DataBuffer
getComplex
in interface DataBuffer
i
- the complex number cto getpublic void put(long i, IComplexNumber result)
DataBuffer
put
in interface DataBuffer
i
- the index to insertresult
- the element to insertpublic void assign(long[] offsets, long[] strides, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usebuffers
- the buffers to assign data frompublic byte[] asBytes()
DataBuffer
asBytes
in interface DataBuffer
public float[] asFloat()
DataBuffer
asFloat
in interface DataBuffer
public double[] asDouble()
DataBuffer
asDouble
in interface DataBuffer
public int[] asInt()
DataBuffer
asInt
in interface DataBuffer
public double getDouble(long i)
DataBuffer
getDouble
in interface DataBuffer
i
- the element to getFloatpublic float getFloat(long i)
DataBuffer
getFloat
in interface DataBuffer
i
- the element to getFloatpublic int getInt(long i)
DataBuffer
getInt
in interface DataBuffer
i
- the int at the specified indexpublic Number getNumber(long i)
DataBuffer
getNumber
in interface DataBuffer
i
- the element to getFloatpublic void pointerIndexerByGlobalType(DataBuffer.Type currentType)
public void putByGlobalType(long i, Number element)
public void put(long i, float element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignpublic void put(long i, double element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignpublic void put(long i, int element)
DataBuffer
put
in interface DataBuffer
i
- the indexelement
- the element to assignpublic boolean dirty()
DataBuffer
dirty
in interface DataBuffer
public boolean sameUnderlyingData(DataBuffer buffer)
DataBuffer
sameUnderlyingData
in interface DataBuffer
buffer
- whether the buffer is the same underlying data or notpublic IntBuffer asNioInt()
DataBuffer
asNioInt
in interface DataBuffer
public DoubleBuffer asNioDouble()
DataBuffer
asNioDouble
in interface DataBuffer
public FloatBuffer asNioFloat()
DataBuffer
asNioFloat
in interface DataBuffer
public ByteBuffer asNio()
DataBuffer
asNio
in interface DataBuffer
public void assign(Number value, long offset)
DataBuffer
assign
in interface DataBuffer
value
- assign the value to setoffset
- the offset to start atpublic void write(OutputStream dos)
DataBuffer
write
in interface DataBuffer
dos
- the output stream to writepublic void read(InputStream is)
DataBuffer
read
in interface DataBuffer
is
- the inpus tream to write topublic void flush()
DataBuffer
flush
in interface DataBuffer
public void assign(long[] offsets, long[] strides, long n, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usen
- the number of elements to operate onbuffers
- the buffers to assign data frompublic void assign(DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
buffers
- the buffers to assignpublic void destroy()
DataBuffer
destroy
in interface DataBuffer
public DataBuffer.Type dataType()
dataType
in interface DataBuffer
protected void doReadObject(ObjectInputStream s)
public void read(DataInputStream s)
read
in interface DataBuffer
public void write(DataOutputStream out) throws IOException
write
in interface DataBuffer
IOException
public Object array()
DataBuffer
array
in interface DataBuffer
public long originalOffset()
originalOffset
in interface DataBuffer
public Long getTrackingPoint()
getTrackingPoint
in interface DataBuffer
public void setTrackingPoint(Long trackingPoint)
setTrackingPoint
in interface DataBuffer
trackingPoint
- public boolean isConstant()
isConstant
in interface DataBuffer
public void setConstant(boolean reallyConstant)
setConstant
in interface DataBuffer
reallyConstant
- Copyright © 2016. All Rights Reserved.