#include <buffer.h>
Public Methods | |
Buffer () | |
Default constructor. | |
Buffer (const Buffer &b) | |
Copy constructor. | |
Buffer (const char *buf, jint size) | |
Constructor. More... | |
~Buffer () | |
Destructor. It frees allocated buffer. | |
const char * | getBuffer () const |
Get pointer to buffer. More... | |
jint | getSize () const |
Get size of data. More... | |
void | clear () |
Clear buffer. More... | |
void | clear (jint newBufSize) |
Clear buffer and resize it. More... | |
void | operator+= (const String &s) |
Addition assignment. More... | |
void | operator+= (const jint c) |
Addition assignment. More... | |
void | operator+= (const jlong c) |
Addition assignment. More... | |
void | operator= (const Buffer &b) |
Assignment. More... | |
Private Types | |
enum | e { RESERVED = 50 } |
constants. More... | |
Private Methods | |
void | reallocate (jint newBufSize) |
Reallocate buffer. More... | |
Private Attributes | |
char * | _buf |
pointer to buffer. | |
jint | _size |
size of data stored in buffer. | |
jint | _bufSize |
buffer size. |
This class implements an input/output buffer needed during communication between profiler dynamic library and Java. This buffer can store anything you want in binary format. This class offers operators += and + for adding strings and jint/jlong values. Strings are stored as C-strings, so text + terminating null character. Jint/jlong types are special types defined by JVMPI, jint is 32-bit and jlong is 64-bit type. They are stored as numbers; jint (32-bit) in network-byte-order (using htonl() function), jlong (64-bit) must be divided to two 32-bit jint numbers (HI,LO parts of jlong), each of them stored in network-byte-order (HI part of jlong goes first, LO part of jlong goes second).
Definition at line 58 of file buffer.h.
|
constants.
|
|
Constructor. This constructor constructs Buffer object using data from another buffer. The data are copied to this newly created Buffer object.
Definition at line 46 of file buffer.cpp. |
|
Clear buffer and resize it. It truncates buffer to zero length and resizes it.
Definition at line 124 of file buffer.cpp. |
|
Clear buffer. It truncates buffer to zero length, everything stored in the buffer will be lost. Definition at line 122 of file buffer.h. Referenced by IProf::_disableGC(), IProf::_enableGC(), IProf::_exitVM(), IProf::_getData(), IProf::_getInfo(), IProf::_isShutdowned(), IProf::_resumeVM(), IProf::_runGC(), IProf::_shutdown(), IProf::_suspendVM(), CommunSocket::operator>>(), CommunShMem::operator>>(), and IProf::run().
|
|
Get pointer to buffer. This method returns pointer to buffer data.
Definition at line 109 of file buffer.h. Referenced by Buffer(), IProf::_getData(), IProf::_getInfo(), CommunSocket::operator<<(), CommunShMem::operator<<(), operator=(), and IProf::run().
|
|
Get size of data. This method returns size of data stored in buffer, so not exactly the buffer size. Buffer size is always greater or equal to data size.
Definition at line 117 of file buffer.h. Referenced by Buffer(), CommunSocket::operator<<(), CommunShMem::operator<<(), and operator=().
|
|
Addition assignment. This operator is used to append a jlong value (jlong = Java long type) to the end of buffer. Number (of 64-bit type) will be divided to two 32-bit numbers (two jint numbers - HI and LO parts), HI part goes first, LO part goes second, each of them is stored in network-byte-order. Buffer is modified.
Definition at line 78 of file buffer.cpp. |
|
Addition assignment. This operator is used to append a jint value (jint = Java int type) to the end of buffer. Number is stored in network-byte-order. Buffer is modified.
Definition at line 65 of file buffer.cpp. |
|
Addition assignment. This operator is used to append a C-string to the end of buffer. Buffer is modified.
Definition at line 55 of file buffer.cpp. |
|
Assignment. This operator is used to assign a "value" of another Buffer object. It means, buffer of right-side operand is copied to the buffer of left-side operand.
Definition at line 99 of file buffer.cpp. |
|
Reallocate buffer. This method reallocates/resizes buffer to appropriate size.
Definition at line 107 of file buffer.cpp. Referenced by operator+=(), and operator=().
|