![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <AsyncBuffer.hpp>
Public Member Functions | |
| CAT_INLINE bool | Call (ThreadPoolLocalStorage *tls, int error, AsyncBuffer *buffer, u32 bytes) |
| template<class T > | |
| CAT_INLINE T * | GetData () |
| template<class T > | |
| CAT_INLINE T * | GetData (T *&ptr) |
| CAT_INLINE u8 * | GetData () |
| CAT_INLINE u32 | GetDataBytes () |
| CAT_INLINE u64 | GetOffset () |
| CAT_INLINE AsyncOv * | GetOv () |
| template<class T > | |
| CAT_INLINE T * | GetTag () |
| template<class T > | |
| CAT_INLINE T * | GetTag (T *&ptr) |
| CAT_INLINE u32 | GetTagBytes () |
| CAT_INLINE u8 * | GetTagData () |
| CAT_INLINE void | Release () |
| CAT_INLINE void | Reset (const AsyncCallback &callback, u64 offset=0) |
| CAT_INLINE AsyncBuffer * | Resize (u32 data_bytes) |
| CAT_INLINE void | Zero () |
Static Public Member Functions | |
| static CAT_INLINE AsyncBuffer * | Acquire (AsyncBuffer *&ptr, u32 data_bytes=0, u32 tag_bytes=0) |
| template<class T > | |
| static CAT_INLINE T * | Acquire (T *&data, u32 tag_bytes=0) |
| static CAT_INLINE u8 * | Acquire (u32 data_bytes=0, u32 tag_bytes=0) |
| static CAT_INLINE u32 | OVERHEAD () |
| static CAT_INLINE AsyncBuffer * | Promote (void *vdata) |
| static CAT_INLINE void | Release (AsyncBuffer *buffer) |
| static CAT_INLINE void | Release (void *vdata) |
| static CAT_INLINE u8 * | Resize (void *vdata, u32 data_bytes) |
| static CAT_INLINE AsyncBuffer * | Wrap (void *vdata, u32 data_bytes, u32 tag_bytes=0) |
Private Attributes | |
| AsyncCallback | _callback |
| u8 * | _data |
| u32 | _data_bytes |
| AsyncOv | _ov |
| u8 | _tag [1] |
| u32 | _tag_bytes |
Definition at line 62 of file AsyncBuffer.hpp.
| static CAT_INLINE AsyncBuffer* cat::AsyncBuffer::Acquire | ( | AsyncBuffer *& | ptr, |
| u32 | data_bytes = 0, |
||
| u32 | tag_bytes = 0 |
||
| ) | [inline, static] |
Definition at line 128 of file AsyncBuffer.hpp.
References _data, _data_bytes, _tag, _tag_bytes, cat::RegionAllocator::Acquire(), and cat::Singleton< RegionAllocator >::ii.
Referenced by Acquire(), and Resize().
{
const u32 OVERHEAD_BYTES = (u32)(offsetof(AsyncBuffer, _tag));
AsyncBuffer *buffer = reinterpret_cast<AsyncBuffer*>(
RegionAllocator::ii->Acquire(OVERHEAD_BYTES + data_bytes + tag_bytes) );
if (!buffer) return 0;
buffer->_data_bytes = data_bytes;
buffer->_tag_bytes = tag_bytes;
buffer->_data = buffer->_tag + tag_bytes;
return (ptr = buffer);
}
| static CAT_INLINE u8* cat::AsyncBuffer::Acquire | ( | u32 | data_bytes = 0, |
| u32 | tag_bytes = 0 |
||
| ) | [inline, static] |
Definition at line 164 of file AsyncBuffer.hpp.
References _data, and Acquire().
{
AsyncBuffer *buffer;
if (!Acquire(buffer, data_bytes, tag_bytes)) return 0;
return buffer->_data;
}
| CAT_INLINE bool cat::AsyncBuffer::Call | ( | ThreadPoolLocalStorage * | tls, |
| int | error, | ||
| AsyncBuffer * | buffer, | ||
| u32 | bytes | ||
| ) | [inline] |
Definition at line 93 of file AsyncBuffer.hpp.
References _callback.
| CAT_INLINE T* cat::AsyncBuffer::GetData | ( | ) | [inline] |
| CAT_INLINE u8* cat::AsyncBuffer::GetData | ( | ) | [inline] |
Definition at line 107 of file AsyncBuffer.hpp.
References _data.
Definition at line 113 of file AsyncBuffer.hpp.
References _data.
{ return (ptr = reinterpret_cast<T*>( _data )); }
| CAT_INLINE u32 cat::AsyncBuffer::GetDataBytes | ( | ) | [inline] |
| CAT_INLINE u64 cat::AsyncBuffer::GetOffset | ( | ) | [inline] |
| CAT_INLINE AsyncOv* cat::AsyncBuffer::GetOv | ( | ) | [inline] |
| CAT_INLINE T* cat::AsyncBuffer::GetTag | ( | ) | [inline] |
Definition at line 124 of file AsyncBuffer.hpp.
References _tag.
{ return (ptr = reinterpret_cast<T*>( _tag )); }
| CAT_INLINE u32 cat::AsyncBuffer::GetTagBytes | ( | ) | [inline] |
| CAT_INLINE u8* cat::AsyncBuffer::GetTagData | ( | ) | [inline] |
| static CAT_INLINE u32 cat::AsyncBuffer::OVERHEAD | ( | ) | [inline, static] |
Definition at line 88 of file AsyncBuffer.hpp.
References _tag.
| static CAT_INLINE AsyncBuffer* cat::AsyncBuffer::Promote | ( | void * | vdata | ) | [inline, static] |
| static CAT_INLINE void cat::AsyncBuffer::Release | ( | AsyncBuffer * | buffer | ) | [inline, static] |
Definition at line 241 of file AsyncBuffer.hpp.
References cat::Singleton< RegionAllocator >::ii, and cat::RegionAllocator::Release().
{
RegionAllocator::ii->Release(buffer);
}
| CAT_INLINE void cat::AsyncBuffer::Release | ( | ) | [inline] |
Definition at line 237 of file AsyncBuffer.hpp.
References cat::Singleton< RegionAllocator >::ii, and cat::RegionAllocator::Release().
{
RegionAllocator::ii->Release(this);
}
| static CAT_INLINE void cat::AsyncBuffer::Release | ( | void * | vdata | ) | [inline, static] |
Definition at line 245 of file AsyncBuffer.hpp.
References _tag, cat::Singleton< RegionAllocator >::ii, and cat::RegionAllocator::Release().
| CAT_INLINE void cat::AsyncBuffer::Reset | ( | const AsyncCallback & | callback, |
| u64 | offset = 0 |
||
| ) | [inline] |
| CAT_INLINE AsyncBuffer* cat::AsyncBuffer::Resize | ( | u32 | data_bytes | ) | [inline] |
Definition at line 146 of file AsyncBuffer.hpp.
References _data, _data_bytes, _tag, _tag_bytes, cat::Singleton< RegionAllocator >::ii, and cat::RegionAllocator::Resize().
{
const u32 OVERHEAD_BYTES = (u32)(offsetof(AsyncBuffer, _tag));
AsyncBuffer *buffer = reinterpret_cast<AsyncBuffer*>(
RegionAllocator::ii->Resize( this,
OVERHEAD_BYTES + _tag_bytes + data_bytes) );
if (!buffer) return 0;
buffer->_data_bytes = data_bytes;
buffer->_data = buffer->_tag + buffer->_tag_bytes;
return buffer;
}
Definition at line 186 of file AsyncBuffer.hpp.
References _data, _data_bytes, _tag, _tag_bytes, Acquire(), cat::Singleton< RegionAllocator >::ii, and cat::RegionAllocator::Resize().
{
u8 *data = reinterpret_cast<u8*>( vdata );
const u32 OVERHEAD_BYTES = (u32)(offsetof(AsyncBuffer, _tag));
if (!data) return Acquire(data_bytes);
AsyncBuffer *buffer = reinterpret_cast<AsyncBuffer*>( data - OVERHEAD_BYTES );
buffer = reinterpret_cast<AsyncBuffer*>(
RegionAllocator::ii->Resize(buffer,
OVERHEAD_BYTES + buffer->_tag_bytes + data_bytes) );
if (!buffer) return 0;
buffer->_data_bytes = data_bytes;
return (buffer->_data = buffer->_tag + buffer->_tag_bytes);
}
| static CAT_INLINE AsyncBuffer* cat::AsyncBuffer::Wrap | ( | void * | vdata, |
| u32 | data_bytes, | ||
| u32 | tag_bytes = 0 |
||
| ) | [inline, static] |
Definition at line 208 of file AsyncBuffer.hpp.
References _data, _data_bytes, _tag, _tag_bytes, cat::RegionAllocator::Acquire(), and cat::Singleton< RegionAllocator >::ii.
{
u8 *data = reinterpret_cast<u8*>( vdata );
const u32 OVERHEAD_BYTES = (u32)(offsetof(AsyncBuffer, _tag));
AsyncBuffer *buffer = reinterpret_cast<AsyncBuffer*>(
RegionAllocator::ii->Acquire(OVERHEAD_BYTES + tag_bytes) );
if (!buffer) return 0;
buffer->_data_bytes = data_bytes;
buffer->_tag_bytes = tag_bytes;
buffer->_data = data;
return buffer;
}
| CAT_INLINE void cat::AsyncBuffer::Zero | ( | ) | [inline] |
Definition at line 99 of file AsyncBuffer.hpp.
References _data, _data_bytes, and CAT_CLR.
{
CAT_CLR(_data, _data_bytes);
}
AsyncCallback cat::AsyncBuffer::_callback [private] |
Definition at line 66 of file AsyncBuffer.hpp.
u8* cat::AsyncBuffer::_data [private] |
u32 cat::AsyncBuffer::_data_bytes [private] |
Definition at line 68 of file AsyncBuffer.hpp.
Referenced by Acquire(), GetDataBytes(), Resize(), Wrap(), and Zero().
AsyncOv cat::AsyncBuffer::_ov [private] |
Definition at line 65 of file AsyncBuffer.hpp.
Referenced by GetOffset(), GetOv(), and Reset().
u8 cat::AsyncBuffer::_tag[1] [private] |
Definition at line 69 of file AsyncBuffer.hpp.
Referenced by Acquire(), GetTag(), GetTagData(), OVERHEAD(), Promote(), Release(), Resize(), and Wrap().
u32 cat::AsyncBuffer::_tag_bytes [private] |
Definition at line 68 of file AsyncBuffer.hpp.
Referenced by Acquire(), GetTagBytes(), Resize(), and Wrap().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.