![]() |
This is Unofficial EPICS BASE Doxygen Site
|
This class implements a Bytebuffer that is like the java.nio.ByteBuffer. More...
#include "byteBuffer.h"
Public Member Functions | |
ByteBuffer (std::size_t size, int byteOrder=EPICS_BYTE_ORDER) | |
ByteBuffer (char *buffer, std::size_t size, int byteOrder=EPICS_BYTE_ORDER) | |
~ByteBuffer () | |
void | setEndianess (int byteOrder) |
const char * | getBuffer () const |
void | clear () |
void | flip () |
void | rewind () |
std::size_t | getPosition () const |
void | setPosition (std::size_t pos) |
std::size_t | getLimit () const |
void | setLimit (std::size_t limit) |
std::size_t | getRemaining () const |
EPICS_ALWAYS_INLINE std::size_t | getSize () const |
template<typename T > | |
void | put (T value) |
template<typename T > | |
void | put (std::size_t index, T value) const |
template<typename T > | |
T | get () |
template<typename T > | |
T | get (std::size_t index) const |
void | put (const char *src, std::size_t src_offset, std::size_t count) |
void | get (char *dest, std::size_t dest_offset, std::size_t count) |
template<typename T > | |
void | putArray (const T *values, std::size_t count) |
template<typename T > | |
void | getArray (T *values, std::size_t count) |
template<typename T > | |
EPICS_ALWAYS_INLINE bool | reverse () const |
void | align (std::size_t size, char fill='\0') |
EPICS_ALWAYS_INLINE void | putBoolean (bool value) |
EPICS_ALWAYS_INLINE void | putByte (int8 value) |
EPICS_ALWAYS_INLINE void | putShort (int16 value) |
EPICS_ALWAYS_INLINE void | putInt (int32 value) |
EPICS_ALWAYS_INLINE void | putLong (int64 value) |
EPICS_ALWAYS_INLINE void | putFloat (float value) |
EPICS_ALWAYS_INLINE void | putDouble (double value) |
EPICS_ALWAYS_INLINE void | putBoolean (std::size_t index, bool value) |
EPICS_ALWAYS_INLINE void | putByte (std::size_t index, int8 value) |
EPICS_ALWAYS_INLINE void | putShort (std::size_t index, int16 value) |
EPICS_ALWAYS_INLINE void | putInt (std::size_t index, int32 value) |
EPICS_ALWAYS_INLINE void | putLong (std::size_t index, int64 value) |
EPICS_ALWAYS_INLINE void | putFloat (std::size_t index, float value) |
EPICS_ALWAYS_INLINE void | putDouble (std::size_t index, double value) |
EPICS_ALWAYS_INLINE bool | getBoolean () |
EPICS_ALWAYS_INLINE int8 | getByte () |
EPICS_ALWAYS_INLINE int16 | getShort () |
EPICS_ALWAYS_INLINE int32 | getInt () |
EPICS_ALWAYS_INLINE int64 | getLong () |
EPICS_ALWAYS_INLINE float | getFloat () |
EPICS_ALWAYS_INLINE double | getDouble () |
EPICS_ALWAYS_INLINE bool | getBoolean (std::size_t index) |
EPICS_ALWAYS_INLINE int8 | getByte (std::size_t index) |
EPICS_ALWAYS_INLINE int16 | getShort (std::size_t index) |
EPICS_ALWAYS_INLINE int32 | getInt (std::size_t index) |
EPICS_ALWAYS_INLINE int64 | getLong (std::size_t index) |
EPICS_ALWAYS_INLINE float | getFloat (std::size_t index) |
EPICS_ALWAYS_INLINE double | getDouble (std::size_t index) |
EPICS_ALWAYS_INLINE const char * | getArray () const EPICS_DEPRECATED |
template<> | |
EPICS_ALWAYS_INLINE bool | reverse () const |
template<> | |
EPICS_ALWAYS_INLINE bool | reverse () const |
template<> | |
EPICS_ALWAYS_INLINE bool | reverse () const |
template<> | |
EPICS_ALWAYS_INLINE bool | reverse () const |
template<> | |
EPICS_ALWAYS_INLINE bool | reverse () const |
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
A BitSet
is not safe for multithreaded use without external synchronization.
Based on Java implementation.
Definition at line 233 of file byteBuffer.h.
|
inline |
Constructor.
size | The number of bytes. |
byteOrder | The byte order. Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG. |
Definition at line 243 of file byteBuffer.h.
|
inline |
Constructor for wrapping an existing buffer. Given buffer will not be released by the ByteBuffer instance.
buffer | Existing buffer. May not be NULL. |
size | The number of bytes. |
byteOrder | The byte order. Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG. |
Definition at line 262 of file byteBuffer.h.
|
inline |
Destructor
Definition at line 275 of file byteBuffer.h.
|
inline |
Adjust position to the next multiple of 'size.
size | The alignment requirement, must be a power of 2. (unchecked) |
fill | value to use for padding bytes (default '\0'). |
Definition at line 504 of file byteBuffer.h.
|
inline |
Makes a buffer ready for a new sequence of channel-read or relative put operations: It sets the limit to the capacity and the position to zero.
Definition at line 302 of file byteBuffer.h.
|
inline |
Makes a buffer ready to read out previously written values.
Typically _limit==_buffer+_size is the initial state, but this is not required.
V _buffer V _position V _limit V _buffer+_size |_______written_______|____uninitialized___|____allocated___|
becomes
V _buffer/_position V _limit V _buffer+size |_______written_______|________________allocated____________|
Definition at line 321 of file byteBuffer.h.
|
inline |
Get the new object from the byte buffer. The item MUST have type T
. The position is adjusted based on the type.
Definition at line 775 of file byteBuffer.h.
|
inline |
Get the new object from the byte buffer at the specified index. The item MUST have type T
. The position is adjusted based on the type.
index | The location in the byte buffer. |
Definition at line 789 of file byteBuffer.h.
|
inline |
Get a sub-array of bytes from the byte buffer. The position is increased by the count.
dest | The destination array. |
dest_offset | The starting position within src. |
count | The number of bytes to put into the byte buffer. Must be less than getRemaining() |
Definition at line 465 of file byteBuffer.h.
|
inline |
Get an array of type T
from the byte buffer. The position is adjusted.
values | The destination array. |
count | The number of elements. |
Definition at line 817 of file byteBuffer.h.
|
inline |
Definition at line 699 of file byteBuffer.h.
|
inline |
Get a boolean value from the byte buffer.
Definition at line 611 of file byteBuffer.h.
|
inline |
Get a boolean value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 654 of file byteBuffer.h.
|
inline |
|
inline |
Get a byte value from the byte buffer.
Definition at line 617 of file byteBuffer.h.
|
inline |
Get a byte value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 661 of file byteBuffer.h.
|
inline |
Get a double value from the byte buffer.
Definition at line 647 of file byteBuffer.h.
|
inline |
Get a boolean value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 696 of file byteBuffer.h.
|
inline |
Get a float value from the byte buffer.
Definition at line 641 of file byteBuffer.h.
|
inline |
Get a float value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 689 of file byteBuffer.h.
|
inline |
Get a int value from the byte buffer.
Definition at line 629 of file byteBuffer.h.
|
inline |
Get an int value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 675 of file byteBuffer.h.
|
inline |
Returns this buffer's limit.
Definition at line 368 of file byteBuffer.h.
|
inline |
Get a long value from the byte buffer.
Definition at line 635 of file byteBuffer.h.
|
inline |
Get a long value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 682 of file byteBuffer.h.
|
inline |
Returns the current position.
Definition at line 346 of file byteBuffer.h.
|
inline |
Returns the number of elements between the current position and the limit.
Definition at line 391 of file byteBuffer.h.
|
inline |
Get a short value from the byte buffer.
Definition at line 623 of file byteBuffer.h.
|
inline |
Get a short value from the byte buffer at the specified index.
index | The offset in the byte buffer. |
Definition at line 668 of file byteBuffer.h.
|
inline |
Returns The size, i.e. capacity of the raw data buffer in bytes.
Definition at line 400 of file byteBuffer.h.
|
inline |
Put the value into the raw buffer as a byte stream in the current byte order.
value | The value to be put into the byte buffer. |
Definition at line 748 of file byteBuffer.h.
|
inline |
Put the value into the raw buffer at the specified index as a byte stream in the current byte order.
index | Offset in the byte buffer. |
value | The value to be put into the byte buffer. |
Definition at line 760 of file byteBuffer.h.
|
inline |
Put a sub-array of bytes into the byte buffer. The position is increased by the count.
src | The source array. |
src_offset | The starting position within src. |
count | The number of bytes to put into the byte buffer. Must be less than getRemaining() |
Definition at line 451 of file byteBuffer.h.
|
inline |
Put an array of type T
into the byte buffer. The position is adjusted.
values | The input array. |
count | The number of elements. |
Definition at line 801 of file byteBuffer.h.
|
inline |
Put a boolean value into the byte buffer.
value | The value. |
Definition at line 519 of file byteBuffer.h.
|
inline |
Put a boolean value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 563 of file byteBuffer.h.
|
inline |
Put a byte value into the byte buffer.
value | The value. |
Definition at line 525 of file byteBuffer.h.
|
inline |
Put a byte value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 570 of file byteBuffer.h.
|
inline |
Put a double value into the byte buffer.
value | The value. |
Definition at line 555 of file byteBuffer.h.
|
inline |
Put a double value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 605 of file byteBuffer.h.
|
inline |
Put a float value into the byte buffer.
value | The value. |
Definition at line 549 of file byteBuffer.h.
|
inline |
Put a float value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 598 of file byteBuffer.h.
|
inline |
Put an int value into the byte buffer.
value | The value. |
Definition at line 537 of file byteBuffer.h.
|
inline |
Put an int value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 584 of file byteBuffer.h.
|
inline |
Put a long value into the byte buffer.
value | The value. |
Definition at line 543 of file byteBuffer.h.
|
inline |
Put a long value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 591 of file byteBuffer.h.
|
inline |
Put a short value into the byte buffer.
value | The value. |
Definition at line 531 of file byteBuffer.h.
|
inline |
Put a short value into the byte buffer at the specified index.
index | The offset in the byte buffer, |
value | The value. |
Definition at line 577 of file byteBuffer.h.
|
inline |
Is the byte order the EPICS_BYTE_ORDER
Definition at line 493 of file byteBuffer.h.
EPICS_ALWAYS_INLINE bool epics::pvData::ByteBuffer::reverse | ( | ) | const |
Definition at line 716 of file byteBuffer.h.
EPICS_ALWAYS_INLINE bool epics::pvData::ByteBuffer::reverse | ( | ) | const |
Definition at line 722 of file byteBuffer.h.
EPICS_ALWAYS_INLINE bool epics::pvData::ByteBuffer::reverse | ( | ) | const |
Definition at line 728 of file byteBuffer.h.
EPICS_ALWAYS_INLINE bool epics::pvData::ByteBuffer::reverse | ( | ) | const |
Definition at line 734 of file byteBuffer.h.
EPICS_ALWAYS_INLINE bool epics::pvData::ByteBuffer::reverse | ( | ) | const |
Definition at line 740 of file byteBuffer.h.
|
inline |
Makes a buffer ready for re-reading the data that it already contains: It leaves the limit unchanged and sets the position to zero.
Note that this may allow reading of uninitialized values. flip() should be considered
V _buffer V _position V _limit V _buffer+_size |_______written_______|____uninitialized___|____allocated___|
becomes
V _buffer/_position V _limit V _buffer+size |_______written_______|____uninitialized___|____allocated___|
Definition at line 339 of file byteBuffer.h.
|
inline |
Set the byte order.
byteOrder | The byte order. Must be one of EPICS_BYTE_ORDER,EPICS_ENDIAN_LITTLE,EPICS_ENDIAN_BIG, |
Definition at line 285 of file byteBuffer.h.
|
inline |
Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit.s If the mark is defined and larger than the new limit then it is discarded.
limit | The new position value; must be no larger than the current limit |
Definition at line 380 of file byteBuffer.h.
|
inline |
Sets the buffer position. If the mark is defined and larger than the new position then it is discarded.
pos | The offset into the raw buffer. The new position value; must be no larger than the current limit |
Definition at line 357 of file byteBuffer.h.