AtlasDeferredIO Struct Reference [Atlas Core]

#include <atlasDeferredIO.h>

List of all members.


Detailed Description

Basic structure for describing an IO operation on an AtlasDeferredFile.

Fill one of these out, and pass it to AtlasDeferredFile::queue to perform the operation. You can optionally specify a callback to receive when the IO is completed.

Operations are either deferred or immediate. If they are immediate, then they occur as soon as the ADIO is passed to the queue() method. Otherwise it happens when the worker thread gets to it.


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
voiddata
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).
AtlasTOCcbObj
 What TOC to do this callback on.
CallbackPtr callback
 And a pointer to the member to callback to.


Member Typedef Documentation

typedef void(AtlasTOC::*) AtlasDeferredIO::CallbackPtr(U32 key, AtlasDeferredIO *adio)


Member Enumeration Documentation

Enumerator:
UnknownAction  Make it easier to catch uninitialized fields.
DeferredRead 
DeferredWrite 
ImmediateRead 
ImmediateWrite 

Various flags to control the behavior of the deferred IO system.

Enumerator:
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!


Constructor & Destructor Documentation

AtlasDeferredIO::AtlasDeferredIO ( ActionTypes  action  ) 

Constructor; pass it the action you want to perform.

AtlasDeferredIO::~AtlasDeferredIO (  ) 


Member Function Documentation

void AtlasDeferredIO::complete (  ) 

Perform callback, deletion activities to complete this deferred IO operation.

void AtlasDeferredIO::doAction ( Stream s  ) 

Perform the operation described by this ADIO.

Best called from a worker thread.

void AtlasDeferredIO::setWriteBuffer ( U32  _offset,
U32  _length,
void _data 
) [inline]

Helper function to set things up for a write operation.

void AtlasDeferredIO::setReadBuffer ( U32  _offset,
U32  _length,
void _data = NULL 
) [inline]

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.


Member Data Documentation

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.