packages/Utils/utils/Packing_Utils.i.hh
//---------------------------------------------------------------------------//
// INLINE AND TEMPLATE MEMBERS FOR PACKER
//---------------------------------------------------------------------------//
/*!
 * \brief Set an allocated buffer to write data into.
 *
 * If compute_buffer_size_mode() is on, this function turns it off.
 *
 * This function accepts an allocated char* buffer.  It assigns begin and end
 * pointers and a mutable position pointer that acts like an iterator.  The
 * Packer will write POD (Plain Old Data) data into this buffer starting at
 * the beginning address of the buffer.  This function must be called before
 * any Packer::pack() calls can be made.
 *
 * Once Packer::set_buffer() is called, all subsequent calls to Packer::pack()
 * will write data incrementally into the buffer set by set_buffer().  To write
 * data into a different buffer, call Packer::set_buffer() again; at this point
 * the Packer no longer has any knowledge about the old buffer.
 *
 * Note, the buffer must be allocated large enough to hold all the data that
 * the client intends to load into it.  There is no memory allocation
 * performed by the Packer class; thus, the buffer cannot be increased in
 * size if a value is written past the end of the buffer.  Optionally, the
 * required buffer size may also be computed using the
 * compute_buffer_size_mode().  See the Packer::pack() function for more
 * details.
 *
 * \param size_in size of the buffer
 * \param buffer  pointer to the char * buffer
 *
 */


If compute_buffer_size_mode() is on, this function turns it off.

This function accepts an allocated char* buffer.  It assigns begin and end
pointers and a mutable position pointer that acts like an iterator.  The
Packer will write POD (Plain Old Data) data into this buffer starting at
the beginning address of the buffer.  This function must be called before
any Packer::pack() calls can be made.

Once Packer::set_buffer() is called, all subsequent calls to Packer::pack()
will write data incrementally into the buffer set by set_buffer().  To write
data into a different buffer, call Packer::set_buffer() again; at this point
the Packer no longer has any knowledge about the old buffer.

Note, the buffer must be allocated large enough to hold all the data that
the client intends to load into it.  There is no memory allocation
performed by the Packer class; thus, the buffer cannot be increased in
size if a value is written past the end of the buffer.  Optionally, the
required buffer size may also be computed using the
compute_buffer_size_mode().  See the Packer::pack() function for more
details.

\param size_in size of the buffer
\param buffer  pointer to the char * buffer
If compute_buffer_size_mode () is on this function turns it off . This function accepts an allocated char * buffer . It assigns begin and end pointers and a mutable position pointer that acts like an iterator . The Packer will write POD ( Plain Old Data ) data into this buffer starting at the beginning address of the buffer . This function must be called before any Packer :: pack () calls can be made . Once Packer :: set_buffer () is called all subsequent calls to Packer :: pack () will write data incrementally into the buffer set by set_buffer () . To write data into a different buffer call Packer :: set_buffer () again ; at this point the Packer no longer has any knowledge about the old buffer . Note the buffer must be allocated large enough to hold all the data that the client intends to load into it . There is no memory allocation performed by the Packer class ; thus the buffer cannot be increased in size if a value is written past the end of the buffer . Optionally the required buffer size may also be computed using the compute_buffer_size_mode () . See the Packer :: pack () function for more details . \ param size_in size of the buffer \ param buffer pointer to the char * buffer
void Packer::set_buffer(unsigned int size_in, pointer buffer)
{
    REQUIRE(buffer);
    size_mode = false;
    stream_size  = size_in;
    ptr          = &buffer[0];
    begin_ptr    = &buffer[0];
    end_ptr      = begin_ptr + stream_size;
}
void Packer :: set_buffer ( unsigned int size_in , pointer buffer ) { REQUIRE ( buffer ) ; size_mode = false ; stream_size = size_in ; ptr = & buffer [ 0 ] ; begin_ptr = & buffer [ 0 ] ; end_ptr = begin_ptr + stream_size ; }
INLINE AND TEMPLATE MEMBERS FOR PACKER
 \brief Set an allocated buffer to write data into.
INLINE AND TEMPLATE MEMBERS FOR PACKER \ brief Set an allocated buffer to write data into .
// set the size, begin and end pointers, and iterator