xrootd
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
XrdCl::Buffer Class Reference

Binary blob representation. More...

#include <XrdClBuffer.hh>

Inheritance diagram for XrdCl::Buffer:
Inheritance graph
[legend]

Public Member Functions

 Buffer (uint32_t size=0)
 Constructor.
 
 Buffer (Buffer &&buffer)
 Move Constructor.
 
Bufferoperator= (Buffer &&buffer)
 Move assignment operator.
 
virtual ~Buffer ()
 Destructor.
 
const char * GetBuffer (uint32_t offset=0) const
 Get the message buffer.
 
char * GetBuffer (uint32_t offset=0)
 Get the message buffer.
 
void ReAllocate (uint32_t size)
 Reallocate the buffer to a new location of a given size.
 
void Free ()
 Free the buffer.
 
void Allocate (uint32_t size)
 Allocate the buffer.
 
void Zero ()
 Zero.
 
uint32_t GetSize () const
 Get the size of the message.
 
uint32_t GetCursor () const
 Get append cursor.
 
void SetCursor (uint32_t cursor)
 Set the cursor.
 
void AdvanceCursor (uint32_t delta)
 Advance the cursor.
 
void Append (const char *buffer, uint32_t size)
 Append data at the position pointed to by the append cursor.
 
void Append (const char *buffer, uint32_t size, uint32_t offset)
 Append data at the given offset.
 
char * GetBufferAtCursor ()
 Get the buffer pointer at the append cursor.
 
const char * GetBufferAtCursor () const
 Get the buffer pointer at the append cursor.
 
void FromString (const std::string str)
 Fill the buffer from a string.
 
std::string ToString () const
 Convert the buffer to a string.
 
void Grab (char *buffer, uint32_t size)
 Grab a buffer allocated outside.
 
char * Release ()
 Release the buffer.
 

Protected Member Functions

void Steal (Buffer &&buffer)
 

Private Member Functions

 Buffer (const Buffer &)
 
Bufferoperator= (const Buffer &)
 

Private Attributes

char * pBuffer
 
uint32_t pSize
 
uint32_t pCursor
 

Detailed Description

Binary blob representation.

Constructor & Destructor Documentation

◆ Buffer() [1/3]

XrdCl::Buffer::Buffer ( uint32_t  size = 0)
inline

Constructor.

References Allocate().

◆ Buffer() [2/3]

XrdCl::Buffer::Buffer ( Buffer &&  buffer)
inline

Move Constructor.

References Steal().

◆ ~Buffer()

virtual XrdCl::Buffer::~Buffer ( )
inlinevirtual

Destructor.

References Free().

◆ Buffer() [3/3]

XrdCl::Buffer::Buffer ( const Buffer )
private

Member Function Documentation

◆ AdvanceCursor()

void XrdCl::Buffer::AdvanceCursor ( uint32_t  delta)
inline

Advance the cursor.

References pCursor.

Referenced by XrdEc::WrtBuff::Pad(), and XrdEc::WrtBuff::Write().

◆ Allocate()

void XrdCl::Buffer::Allocate ( uint32_t  size)
inline

Allocate the buffer.

References pBuffer, and pSize.

Referenced by Buffer(), and XrdEc::WrtBuff::Pad().

◆ Append() [1/2]

void XrdCl::Buffer::Append ( const char *  buffer,
uint32_t  size 
)
inline

Append data at the position pointed to by the append cursor.

References pBuffer, pCursor, pSize, and ReAllocate().

Referenced by XrdCl::MessageUtils::CreateXAttrBody().

◆ Append() [2/2]

void XrdCl::Buffer::Append ( const char *  buffer,
uint32_t  size,
uint32_t  offset 
)
inline

Append data at the given offset.

References pBuffer, pSize, and ReAllocate().

◆ Free()

void XrdCl::Buffer::Free ( )
inline

Free the buffer.

References pBuffer, pCursor, and pSize.

Referenced by Grab(), and ~Buffer().

◆ FromString()

void XrdCl::Buffer::FromString ( const std::string  str)
inline

Fill the buffer from a string.

References pBuffer, and ReAllocate().

◆ GetBuffer() [1/2]

char * XrdCl::Buffer::GetBuffer ( uint32_t  offset = 0)
inline

Get the message buffer.

References pBuffer.

◆ GetBuffer() [2/2]

const char * XrdCl::Buffer::GetBuffer ( uint32_t  offset = 0) const
inline

◆ GetBufferAtCursor() [1/2]

char * XrdCl::Buffer::GetBufferAtCursor ( )
inline

Get the buffer pointer at the append cursor.

References GetBuffer(), and pCursor.

Referenced by XrdEc::WrtBuff::Write().

◆ GetBufferAtCursor() [2/2]

const char * XrdCl::Buffer::GetBufferAtCursor ( ) const
inline

Get the buffer pointer at the append cursor.

References GetBuffer(), and pCursor.

◆ GetCursor()

uint32_t XrdCl::Buffer::GetCursor ( ) const
inline

◆ GetSize()

uint32_t XrdCl::Buffer::GetSize ( ) const
inline

◆ Grab()

void XrdCl::Buffer::Grab ( char *  buffer,
uint32_t  size 
)
inline

Grab a buffer allocated outside.

References Free(), pBuffer, and pSize.

◆ operator=() [1/2]

Buffer & XrdCl::Buffer::operator= ( Buffer &&  buffer)
inline

Move assignment operator.

References Steal().

◆ operator=() [2/2]

Buffer & XrdCl::Buffer::operator= ( const Buffer )
private

◆ ReAllocate()

void XrdCl::Buffer::ReAllocate ( uint32_t  size)
inline

Reallocate the buffer to a new location of a given size.

References pBuffer, and pSize.

Referenced by Append(), Append(), and FromString().

◆ Release()

char * XrdCl::Buffer::Release ( )
inline

Release the buffer.

References pBuffer, pCursor, and pSize.

◆ SetCursor()

void XrdCl::Buffer::SetCursor ( uint32_t  cursor)
inline

Set the cursor.

References pCursor.

Referenced by XrdEc::WrtBuff::Pad(), and XrdCl::AsyncMsgWriter::Write().

◆ Steal()

void XrdCl::Buffer::Steal ( Buffer &&  buffer)
inlineprotected

References pBuffer, pCursor, and pSize.

Referenced by Buffer(), operator=(), and XrdCl::Message::operator=().

◆ ToString()

std::string XrdCl::Buffer::ToString ( ) const
inline

Convert the buffer to a string.

References pBuffer, and pSize.

◆ Zero()

void XrdCl::Buffer::Zero ( )
inline

Member Data Documentation

◆ pBuffer

char* XrdCl::Buffer::pBuffer
private

◆ pCursor

uint32_t XrdCl::Buffer::pCursor
private

◆ pSize

uint32_t XrdCl::Buffer::pSize
private

The documentation for this class was generated from the following file: