|
Public Types | |
typedef void(AtlasTOC::*) | CallbackPtr (U32 key, AtlasDeferredIO *adio) |
UnknownAction | |
Make it easier to catch uninitialized fields. | |
DeferredRead | |
DeferredWrite | |
ImmediateRead | |
ImmediateWrite | |
DeleteStructOnComplete = BIT(0) | |
Can we delete this ADIO when we're done with it? | |
DeleteDataOnComplete = BIT(1) | |
Can we delete the referenced data when we're done? | |
DataIsArray = BIT(2) | |
If this is set, use delete[] to delete the data; otherwise delete is used. | |
IsCompleted = BIT(3) | |
Is this ADIO completed? | |
DoCallback = BIT(4) | |
Should we do a callback when we're done with this operation? | |
WriteToEndOfStream = BIT(5) | |
Should we write to the end of the file/stream, wherever that is, or use a specific offset? | |
CompleteOnSync = BIT(6) | |
If set, we complete the IO operation (ie, do callbacks and deletions) on AtlasDeferredFile::sync(). | |
enum | ActionTypes { UnknownAction, DeferredRead, DeferredWrite, ImmediateRead, ImmediateWrite } |
enum | ADIOFlags { DeleteStructOnComplete = BIT(0), DeleteDataOnComplete = BIT(1), DataIsArray = BIT(2), IsCompleted = BIT(3), DoCallback = BIT(4), WriteToEndOfStream = BIT(5), CompleteOnSync = BIT(6) } |
Various flags to control the behavior of the deferred IO system. More... | |
Public Member Functions | |
AtlasDeferredIO (ActionTypes action) | |
Constructor; pass it the action you want to perform. | |
~AtlasDeferredIO () | |
void | setWriteBuffer (U32 _offset, U32 _length, void *_data) |
Helper function to set things up for a write operation. | |
void | setReadBuffer (U32 _offset, U32 _length, void *_data=NULL) |
Helper function to set things up for a read operation. | |
void | setCallback (AtlasTOC *toc, CallbackPtr cb, U32 key) |
Specify a callback on a TOC. | |
const bool | isImmediate () const |
True if this ADIO is actually an immediate operation. | |
const bool | isWrite () const |
Returns true if this is a write operation. | |
void | complete () |
Perform callback, deletion activities to complete this deferred IO operation. | |
void | doAction (Stream *s) |
Perform the operation described by this ADIO. | |
Public Attributes | |
enum AtlasDeferredIO::ActionTypes | action |
U32 | offset |
U32 | length |
void * | data |
BitSet32 | flags |
One or more flags from ADIOFlags. | |
U32 | callbackKeyA |
You may specify a value to pass to the callback (besides a pointer to this ADIO). | |
AtlasTOC * | cbObj |
What TOC to do this callback on. | |
CallbackPtr | callback |
And a pointer to the member to callback to. |
typedef void(AtlasTOC::*) AtlasDeferredIO::CallbackPtr(U32 key, AtlasDeferredIO *adio) |
Various flags to control the behavior of the deferred IO system.
DeleteStructOnComplete | Can we delete this ADIO when we're done with it? |
DeleteDataOnComplete | Can we delete the referenced data when we're done? |
DataIsArray | If this is set, use delete[] to delete the data; otherwise delete is used. |
IsCompleted | Is this ADIO completed? |
DoCallback | Should we do a callback when we're done with this operation? |
WriteToEndOfStream | Should we write to the end of the file/stream, wherever that is, or use a specific offset? |
CompleteOnSync |
If set, we complete the IO operation (ie, do callbacks and deletions) on AtlasDeferredFile::sync().
Otherwise, we do it as soon as the IO operation completes. Make sure you're not touching threads the wrong way with this! |
AtlasDeferredIO::AtlasDeferredIO | ( | ActionTypes | action | ) |
Constructor; pass it the action you want to perform.
AtlasDeferredIO::~AtlasDeferredIO | ( | ) |
void AtlasDeferredIO::complete | ( | ) |
Perform callback, deletion activities to complete this deferred IO operation.
Perform the operation described by this ADIO.
Best called from a worker thread.
Helper function to set things up for a write operation.
Helper function to set things up for a read operation.
If you don't pass a buffer to read to, a new one will be allocated right before we read.
void AtlasDeferredIO::setCallback | ( | AtlasTOC * | toc, | |
CallbackPtr | cb, | |||
U32 | key | |||
) | [inline] |
Specify a callback on a TOC.
Automatically sets the appropriate flags and members.
const bool AtlasDeferredIO::isImmediate | ( | ) | const [inline] |
True if this ADIO is actually an immediate operation.
const bool AtlasDeferredIO::isWrite | ( | ) | const [inline] |
Returns true if this is a write operation.
One or more flags from ADIOFlags.
You may specify a value to pass to the callback (besides a pointer to this ADIO).
What TOC to do this callback on.
And a pointer to the member to callback to.