util::stream::Block Class Reference

#include <block.hh>

List of all members.

Public Member Functions

 Block ()
 Block (void *mem, std::size_t size)
void SetValidSize (std::size_t to)
std::size_t ValidSize () const
void * Get ()
const void * Get () const
const void * ValidEnd () const
 operator bool () const
bool operator! () const

Friends

class Link
class RewindableStream


Detailed Description

Encapsulates a block of memory.

Definition at line 13 of file block.hh.


Constructor & Destructor Documentation

util::stream::Block::Block (  )  [inline]

Constructs an empty block.

Definition at line 19 of file block.hh.

util::stream::Block::Block ( void *  mem,
std::size_t  size 
) [inline]

Constructs a block that encapsulates a segment of memory.

Parameters:
[in] mem The segment of memory to encapsulate
[in] size The size of the memory segment in bytes

Definition at line 27 of file block.hh.


Member Function Documentation

const void* util::stream::Block::Get (  )  const [inline]

Gets a const void pointer to the memory underlying this block.

Definition at line 46 of file block.hh.

void* util::stream::Block::Get (  )  [inline]

Gets a void pointer to the memory underlying this block.

Definition at line 43 of file block.hh.

Referenced by util::stream::RewindableStream::operator++().

Here is the caller graph for this function:

util::stream::Block::operator bool (  )  const [inline]

Returns true if this block encapsulates a valid (non-NULL) block of memory.

This method is a user-defined implicit conversion function to boolean; among other things, this method enables bare instances of this class to be used as the condition of an if statement.

Definition at line 64 of file block.hh.

References NULL.

bool util::stream::Block::operator! (  )  const [inline]

Returns true if this block is empty.

In other words, if Get()==NULL, this method will return true.

Definition at line 71 of file block.hh.

References NULL.

void util::stream::Block::SetValidSize ( std::size_t  to  )  [inline]

Set the number of bytes in this block that should be interpreted as valid.

Parameters:
[in] to Number of bytes

Definition at line 34 of file block.hh.

const void* util::stream::Block::ValidEnd (  )  const [inline]

Gets a const void pointer to the end of the valid section of memory encapsulated by this block.

Definition at line 53 of file block.hh.

std::size_t util::stream::Block::ValidSize (  )  const [inline]

Gets the number of bytes in this block that should be interpreted as valid. This is important because read might fill in less than Allocated at EOF.

Definition at line 40 of file block.hh.

Referenced by util::stream::RewindableStream::operator++(), and util::stream::Link::operator++().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class Link [friend]

Definition at line 74 of file block.hh.

friend class RewindableStream [friend]

Definition at line 75 of file block.hh.


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

Generated on Thu Jul 6 00:34:53 2017 for Moses by  doxygen 1.5.9