// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. #ifndef INCLUDED_GRAS_WORK_BUFFER_HPP #define INCLUDED_GRAS_WORK_BUFFER_HPP #include #include namespace gras { template struct WorkBuffer { //! get a pointer of the desired type to this buffer template T cast(void) const; //! get a native pointer type to this buffer PtrType get(void) const; //! Get the memory pointer reference PtrType &get(void); //! get the number of items in this buffer size_t size(void) const; //! Get the buffer length reference size_t &size(void); PtrType _mem; size_t _len; }; template template inline T WorkBuffer::cast(void) const { return reinterpret_cast(_mem); } template inline PtrType WorkBuffer::get(void) const { return _mem; } template inline PtrType &WorkBuffer::get(void) { return _mem; } template inline size_t WorkBuffer::size(void) const { return _len; } template inline size_t &WorkBuffer::size(void) { return _len; } } //namespace gras #endif /*INCLUDED_GRAS_WORK_BUFFER_HPP*/