![]() |
XRootD
|
#include <XrdOucBuffer.hh>
Public Member Functions | |
XrdOucBuffer (char *buff, int blen) | |
char * | Buffer () const |
int | BuffSize () const |
XrdOucBuffer * | Clone (bool trim=true) |
char * | Data () const |
char * | Data (int &dataL) const |
int | DataLen () |
XrdOucBuffer * | Highjack (int bPsz=0) |
void | Recycle () |
Recycle the buffer. The buffer may be reused in the future. More... | |
bool | Resize (int newsz) |
void | SetLen (int dataL, int dataO=0) |
Friends | |
class | XrdOucBuffPool |
Definition at line 140 of file XrdOucBuffer.hh.
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.
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. |
Definition at line 187 of file XrdOucBuffer.cc.
References XrdOucBuffer().
Referenced by XrdOucBuffer().
|
inline |
Get the pointer to the buffer.
Definition at line 152 of file XrdOucBuffer.hh.
Referenced by XrdCmsParser::Decode(), and XrdOfsPrepGPIReal::PrepGPI::query().
|
inline |
Get the size of the buffer.
Definition at line 160 of file XrdOucBuffer.hh.
XrdOucBuffer * XrdOucBuffer::Clone | ( | bool | trim = true | ) |
Produce a clone of this buffer.
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. |
Definition at line 205 of file XrdOucBuffer.cc.
References trim().
Referenced by XrdOucErrInfo::operator=().
|
inline |
Get a pointer to the data in the buffer.
Definition at line 181 of file XrdOucBuffer.hh.
Referenced by XrdOucErrInfo::getErrText().
|
inline |
Get a pointer to the data in the buffer and the length of the data.
dataL | - place where the length is to be stored. |
Definition at line 191 of file XrdOucBuffer.hh.
|
inline |
Get the data length.
Definition at line 199 of file XrdOucBuffer.hh.
Referenced by XrdCmsParser::Decode(), and XrdOucErrInfo::getErrTextLen().
XrdOucBuffer * XrdOucBuffer::Highjack | ( | int | bPsz = 0 | ) |
Highjack the buffer contents and reinitialize the original buffer.
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. |
Definition at line 230 of file XrdOucBuffer.cc.
Referenced by XrdCmsParser::Decode(), and Resize().
|
inline |
Recycle the buffer. The buffer may be reused in the future.
Definition at line 220 of file XrdOucBuffer.hh.
Referenced by XrdCmsClientMan::~XrdCmsClientMan(), XrdOfsPrepGPIReal::PrepGPI::query(), XrdOucErrInfo::Reset(), Resize(), and XrdOucErrInfo::setErrInfo().
bool XrdOucBuffer::Resize | ( | int | newsz | ) |
Resize the buffer.
newsz | - the size that the buffer is to have. The same restrictions apply as for buffer pool Alloc(), above. |
Definition at line 255 of file XrdOucBuffer.cc.
References Highjack(), and Recycle().
|
inline |
Set the data length of offset.
dataL | - the length of the data. |
dataO | - the offset of the data in the buffer. |
Definition at line 241 of file XrdOucBuffer.hh.
Referenced by XrdCmsParser::Decode().
|
friend |
Definition at line 142 of file XrdOucBuffer.hh.