'ODTONE - Open Dot Twenty One'

PrevUpHomeNext

Class template buffer

odtone::buffer

Synopsis

// In header: </home/carlos/Projectos/odtone/inc/odtone/buffer.hpp>

template<typename T> 
class buffer {
public:
  // construct/copy/destruct
  buffer();
  buffer(buffer &);
  buffer(buffer &&);
  buffer(size_t);
  buffer& operator=(const buffer &);
  buffer& operator=(buffer &&);
  ~buffer();

  // private member functions
   ODTONE_STATIC_ASSERT(boost::is_pod< T >::value, "T must be POD type");

  // public member functions
  void size(size_t);
  void zero();
  T * get();
  const T * get() const;
  size_t size() const;
};

Description

A container for data of a specific data type with linear and finite sequence of elements.

buffer public construct/copy/destruct

  1. buffer();

    Construct an empty buffer. The created buffer will be empty and with zero length.

  2. buffer(buffer & buff);

    Construct a buffer. The new created buffer will be a copy of another buffer.

    Parameters:

    buff

    Buffer to copy.

  3. buffer(buffer && buff);

    Construct a buffer. The new created buffer will be a copy of another buffer.

    Parameters:

    buff

    Buffer to copy.

  4. buffer(size_t len);

    Construct an empty buffer. Although the created buffer is empty, it has the length defined at its creation.

    Parameters:

    len

    Number of elements the buffer can store.

  5. buffer& operator=(const buffer &);
  6. buffer& operator=(buffer && buff);

    Copy the elements from another buffer. The elements contained in the buffer will be overwrited.

    Parameters:

    buff

    The buffer from which to copy the elements.

    Returns:

    The reference to the buffer.

  7. ~buffer();

    Destruct a buffer.

buffer private member functions

  1.  ODTONE_STATIC_ASSERT(boost::is_pod< T >::value, "T must be POD type");

buffer public member functions

  1. void size(size_t len);

    Set the number of elements the buffer can store.

    Parameters:

    len

    The number of elements the buffer can store.

  2. void zero();

    Remove all stored elements from the buffer.

  3. T * get();

    Get the pointer to the first element of the buffer.

    Returns:

    The pointer to the first element of the buffer.

  4. const T * get() const;

    Get the pointer to the first element of the buffer.

    Returns:

    The pointer to the first element of the buffer.

  5. size_t size() const;

    Get the number of elements the buffer can store.

    Returns:

    The number of elements the buffer can store.


PrevUpHomeNext