![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtLockedBufferedQueue.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtLockedBufferedQueue_H_ 00014 #define DtLockedBufferedQueue_H_ 00015 00016 #include <vrvUtil/vrvUtil.h> 00017 #include <vlutil/vlMutex.h> 00018 #include <vector> 00019 00020 namespace makVrv 00021 { 00026 template <typename T> 00027 class DtLockedBufferedQueue 00028 { 00029 public: 00030 DtLockedBufferedQueue(); 00031 00035 ~DtLockedBufferedQueue(); 00036 00037 00041 unsigned int push(T value); 00042 00047 unsigned int push( std::vector<T>& valueVector ); 00048 00068 void getForReading(std::vector<T>*& output); 00069 00074 void deleteAllPointers(); 00075 00079 void clearBuffers(); 00080 00081 protected: 00082 00085 void swapBuffers(); 00086 00087 std::vector<T> myFirstBuffer; 00088 std::vector<T> mySecondBuffer; 00089 std::vector<T>* myCurrentBuffer; 00090 00091 DtMutex myBufferMutex; 00092 }; 00093 00094 } 00095 00096 #define DtLockedBufferedQueue_INL_ 00097 #include <vrvUtil/DtLockedBufferedQueue.inl> 00098 #undef DtLockedBufferedQueue_INL_ 00099 00100 00101 #endif 00102