#include <XrdOucBuffer.hh>
◆ XrdOucBuffer() [1/3]
XrdOucBuffer::XrdOucBuffer |
( |
char * |
buff, |
|
|
int |
blen |
|
) |
| |
Public constructor. You can create one-time buffers not associated with a buffer pool via new to associated your own storage area that will be freed when the buffer is recycled. This may be handy to pass along such a buffer to XrdOucErrInfo in a pinch. A one-time buffer is restricted and the Clone(), Highjack() and Resize() methods will always fail. However, all the other methods will work in the expected way.
- Parameters
-
buff | - pointer to a storage area obtained via posix_memalign() and it will be released via free(). |
blen | - the size of the buffer as well as the data length. Use SetLen() to set a new data length if it differs. |
◆ XrdOucBuffer() [2/3]
◆ XrdOucBuffer() [3/3]
XrdOucBuffer::XrdOucBuffer |
( |
| ) |
|
|
inlineprivate |
◆ ~XrdOucBuffer()
XrdOucBuffer::~XrdOucBuffer |
( |
| ) |
|
|
inlineprivate |
◆ Buffer()
char * XrdOucBuffer::Buffer |
( |
| ) |
const |
|
inline |
Get the pointer to the buffer.
- Returns
- pointer to the buffer.
References data.
◆ BuffSize()
int XrdOucBuffer::BuffSize |
( |
| ) |
const |
|
inline |
Get the size of the buffer.
- Returns
- size of the buffer.
References size.
◆ Clone()
Produce a clone of this buffer.
- Parameters
-
trim | - when true the memory buffer is trimmed to be of sufficient size to hold the actual data. Otherwise, the cloned memory buffer is of the same length. |
- Returns
- !0 - pointer to the cloned buffer. =0 - insufficient memory to clone the buffer.
Referenced by XrdOucErrInfo::operator=().
◆ Data() [1/2]
char * XrdOucBuffer::Data |
( |
| ) |
const |
|
inline |
◆ Data() [2/2]
char * XrdOucBuffer::Data |
( |
int & |
dataL | ) |
const |
|
inline |
Get a pointer to the data in the buffer and the length of the data.
- Parameters
-
dataL | - place where the length is to be stored. |
- Returns
- pointer to the data with dataL holding its length.
References data, dlen, and doff.
◆ DataLen()
int XrdOucBuffer::DataLen |
( |
| ) |
|
|
inline |
◆ Highjack()
Highjack the buffer contents and reinitialize the original buffer.
- Parameters
-
bPsz | - the desired size to be given to the highjacked buffer. If zero, the current size is used. Same size resictions apply as for buffer pool Alloc(), above. |
- Returns
- !0 - pointer to a usable buffer object which is identical to the original buffer. The original buffer was reallocated with the specified size.
-
=0 - insufficient memory to allocate a buffer.
◆ Recycle()
void XrdOucBuffer::Recycle |
( |
| ) |
|
|
inline |
◆ Resize()
bool XrdOucBuffer::Resize |
( |
int |
newsz | ) |
|
Resize the buffer.
- Parameters
-
newsz | - the size that the buffer is to have. The same restrictions apply as for buffer pool Alloc(), above. |
- Returns
- true - buffer has been reallocated.
-
false - insufficient memoy to reallocated the buffer.
◆ SetLen()
void XrdOucBuffer::SetLen |
( |
int |
dataL, |
|
|
int |
dataO = 0 |
|
) |
| |
|
inline |
Set the data length of offset.
- Parameters
-
dataL | - the length of the data. |
dataO | - the offset of the data in the buffer. |
References dlen, and doff.
◆ XrdOucBuffPool
◆ [union]
◆ buffNext
◆ buffPool
◆ data
◆ dlen
◆ doff
◆ size
◆ slot
The documentation for this class was generated from the following file: