B2BITS FIX Antenna HFT  1.0.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Utils::RawBuffer Class Reference

'Quick' buffer for a sequence of bytes . More...

#include <RawBuffer.h>

Public Member Functions

void * alloc (unsigned size)
 
void append (const char v)
 Appends the given character. More...
 
void append (const char *str)
 Appends the given 'C-style' std::string. More...
 
void append (const std::string &str)
 Appends the given std::string. More...
 
void append (const char *str, unsigned size)
 Appends the given sequence of bytes. More...
 
void append (const RawBuffer *rb)
 Append sequence bytes from the given buffer. More...
 
void append (const RawBuffer &rb)
 Append sequence bytes from another buffer. More...
 
void assign (char *storage, unsigned capacity)
 Assigns a buffer to the instance of RawBuffer class. More...
 
char * begin () throw ()
 
char const * begin () const throw ()
 
unsigned capacity () const throw ()
 Returns the storage currently allocated to hold the controlled sequence, a value at least as large as size(). More...
 
void clear ()
 Clears buffer's content. More...
 
void copy (char const *buffer, unsigned size)
 Copies content of the buffer. More...
 
void dispose ()
 
char * end () throw ()
 
char const * end () const throw ()
 
void erase (unsigned n)
 Erases n elements from the start of the buffer. More...
 
char * get () throw ()
 Returns buffer content. More...
 
char const * get () const throw ()
 Returns buffer content. More...
 
const char * getBuffer () const throw ()
 Returns buffer content. More...
 
char * getBuffer () throw ()
 Returns buffer content. More...
 
std::string getString () const
 Returns std::string that contains data in buffer. More...
 
void insert (const char *str, unsigned size)
 Inserts the given sequence of bytes into the start of the buffer. More...
 
void insert (int pos, const char *str, unsigned size)
 Inserts the given sequence of bytes into the position pos. More...
 
bool operator!= (const RawBuffer &right) const throw ()
 
bool operator== (const RawBuffer &right) const
 
char operator[] (unsigned offset) const throw ()
 
char & operator[] (unsigned offset) throw ()
 
 RawBuffer ()
 Constructor. More...
 
 RawBuffer (const char *str, unsigned size)
 Constructor. More...
 
 RawBuffer (const std::string &str)
 Constructor. More...
 
 RawBuffer (const RawBuffer &rh)
 Copy constructor. More...
 
char * release ()
 The member replaces the stored pointer myptr with a null pointer. More...
 
bool reserve (unsigned n, int capacity_multiplier=CAPACITY_MULTIPLIER)
 Ensures that capacity() henceforth returns at least n. More...
 
void resize (unsigned newSize)
 Ensures that size() henceforth returns newSize. More...
 
unsigned size () const
 Returns the length of the controlled sequence. More...
 
void toRaw (RawBuffer *buf) const
 Copies buffer. More...
 
 ~RawBuffer ()
 Destructor. More...
 

Static Public Member Functions

static RawBufferfromRaw (const char *buf, unsigned size)
 Added for compatibility only. More...
 

Static Public Attributes

static const int CAPACITY_MULTIPLIER = 1
 

Friends

std::ostream & operator<< (std::ostream &os, const RawBuffer &aRB)
 

Detailed Description

'Quick' buffer for a sequence of bytes .

Constructor & Destructor Documentation

Utils::RawBuffer::RawBuffer ( )
inline

Constructor.

Utils::RawBuffer::RawBuffer ( const char *  str,
unsigned  size 
)
inlineexplicit

Constructor.

References append().

Utils::RawBuffer::RawBuffer ( const std::string &  str)
inlineexplicit

Constructor.

References append().

Utils::RawBuffer::RawBuffer ( const RawBuffer rh)

Copy constructor.

Note
performs "deep" copy.
Utils::RawBuffer::~RawBuffer ( )
inline

Destructor.

Member Function Documentation

void * Utils::RawBuffer::alloc ( unsigned  size)
inline
void Utils::RawBuffer::append ( const char  v)
inline

Appends the given character.

References reserve().

Referenced by Parser::LiteFixMessage::add(), append(), RawBuffer(), and Parser::LiteFixMessage::updateValueAtIndex().

void Utils::RawBuffer::append ( const char *  str)
inline

Appends the given 'C-style' std::string.

References append().

void Utils::RawBuffer::append ( const std::string &  str)
inline

Appends the given std::string.

References append().

void Utils::RawBuffer::append ( const char *  str,
unsigned  size 
)
inline

Appends the given sequence of bytes.

References reserve(), and size().

void Utils::RawBuffer::append ( const RawBuffer rb)
inline

Append sequence bytes from the given buffer.

References append(), getBuffer(), and size().

void Utils::RawBuffer::append ( const RawBuffer rb)
inline

Append sequence bytes from another buffer.

References append(), getBuffer(), and size().

void Utils::RawBuffer::assign ( char *  storage,
unsigned  capacity 
)
inline

Assigns a buffer to the instance of RawBuffer class.

References capacity().

char* Utils::RawBuffer::begin ( )
throw (
)
inline
char const* Utils::RawBuffer::begin ( ) const
throw (
)
inline
unsigned Utils::RawBuffer::capacity ( ) const
throw (
)
inline

Returns the storage currently allocated to hold the controlled sequence, a value at least as large as size().

Referenced by assign().

void Utils::RawBuffer::clear ( )
inline

Clears buffer's content.

Referenced by Parser::LiteFixMessage::toRaw().

void Utils::RawBuffer::copy ( char const *  buffer,
unsigned  size 
)
inline

Copies content of the buffer.

References resize().

void Utils::RawBuffer::dispose ( )
inline
char* Utils::RawBuffer::end ( )
throw (
)
inline
char const* Utils::RawBuffer::end ( ) const
throw (
)
inline
void Utils::RawBuffer::erase ( unsigned  n)

Erases n elements from the start of the buffer.

static RawBuffer* Utils::RawBuffer::fromRaw ( const char *  buf,
unsigned  size 
)
static

Added for compatibility only.

char* Utils::RawBuffer::get ( )
throw (
)
inline
char const* Utils::RawBuffer::get ( ) const
throw (
)
inline

Returns buffer content.

Returns
a pointer to the internal buffer.
const char* Utils::RawBuffer::getBuffer ( ) const
throw (
)
inline

Returns buffer content.

Note
return NULL if the buffer is empty.
Returns
a pointer to the internal buffer.

Referenced by append().

char* Utils::RawBuffer::getBuffer ( )
throw (
)
inline

Returns buffer content.

Returns
a pointer to the internal buffer.
std::string Utils::RawBuffer::getString ( ) const
inline

Returns std::string that contains data in buffer.

Returns
a std::string object.
void Utils::RawBuffer::insert ( const char *  str,
unsigned  size 
)
inline

Inserts the given sequence of bytes into the start of the buffer.

References reserve(), and size().

void Utils::RawBuffer::insert ( int  pos,
const char *  str,
unsigned  size 
)
inline

Inserts the given sequence of bytes into the position pos.

References reserve(), and size().

bool Utils::RawBuffer::operator!= ( const RawBuffer right) const
throw (
)
inline
bool Utils::RawBuffer::operator== ( const RawBuffer right) const
inline
char Utils::RawBuffer::operator[] ( unsigned  offset) const
throw (
)
inline
char& Utils::RawBuffer::operator[] ( unsigned  offset)
throw (
)
inline
char * Utils::RawBuffer::release ( )
inline

The member replaces the stored pointer myptr with a null pointer.

Used for aquiring full access to the stored buffer. Use free method to release memory allocated.

bool Utils::RawBuffer::reserve ( unsigned  n,
int  capacity_multiplier = CAPACITY_MULTIPLIER 
)
inline

Ensures that capacity() henceforth returns at least n.

Referenced by alloc(), append(), insert(), and resize().

void Utils::RawBuffer::resize ( unsigned  newSize)
inline

Ensures that size() henceforth returns newSize.

References reserve().

Referenced by copy(), Parser::LiteFixMessage::updateValueAtIndex(), and Parser::LiteFixMessage::updateValueAtIndexNoPadding().

unsigned Utils::RawBuffer::size ( ) const
inline
void Utils::RawBuffer::toRaw ( RawBuffer buf) const

Copies buffer.

Added for compatibility only.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const RawBuffer aRB 
)
friend
Note
: For debug usage only! Wraps stream output with quots.

Member Data Documentation

const int Utils::RawBuffer::CAPACITY_MULTIPLIER = 1
static