00001 00024 #ifndef GALOIS_RUNTIME_USERCONTEXTACCESS_H 00025 #define GALOIS_RUNTIME_USERCONTEXTACCESS_H 00026 00027 #include "Galois/UserContext.h" 00028 00029 namespace Galois { 00030 namespace Runtime { 00031 00033 template<typename T> 00034 class UserContextAccess : public Galois::UserContext<T> { 00035 public: 00036 typedef Galois::UserContext<T> SuperTy; 00037 typedef typename SuperTy::PushBufferTy PushBufferTy; 00038 typedef typename SuperTy::FastPushBack FastPushBack; 00039 00040 void resetAlloc() { SuperTy::__resetAlloc(); } 00041 PushBufferTy& getPushBuffer() { return SuperTy::__getPushBuffer(); } 00042 void resetPushBuffer() { SuperTy::__resetPushBuffer(); } 00043 SuperTy& data() { return *static_cast<SuperTy*>(this); } 00044 void setLocalState(void *p, bool used) { SuperTy::__setLocalState(p, used); } 00045 void setFastPushBack(FastPushBack f) { SuperTy::__setFastPushBack(f); } 00046 void setBreakFlag(bool *b) { SuperTy::didBreak = b; } 00047 00048 // TODO: move to a separate class dedicated for speculative executors 00049 #ifdef GALOIS_USE_EXP 00050 void rollback () { SuperTy::__rollback (); } 00051 00052 void commit () { SuperTy::__commit (); } 00053 00054 void reset () { 00055 SuperTy::__resetPushBuffer (); 00056 SuperTy::__resetUndoLog (); 00057 SuperTy::__resetCommitLog (); 00058 SuperTy::__resetAlloc (); 00059 } 00060 #endif 00061 }; 00062 00063 } 00064 } // end namespace Galois 00065 00066 #endif