VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtLockedBufferedQueue.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef DtLockedBufferedQueue_H_
11 #define DtLockedBufferedQueue_H_
12 
13 #include <vrvUtil/vrvUtil.h>
14 #include <vlutil/vlMutex.h>
15 #include <vector>
16 
17 namespace makVrv
18 {
23  template <typename T>
25  {
26  public:
28 
33 
34 
38  unsigned int push(T value);
39 
44  unsigned int push( std::vector<T>& valueVector );
45 
65  void getForReading(std::vector<T>*& output);
66 
71  void deleteAllPointers();
72 
78  void nullAllPointers();
79 
83  void clearBuffers();
84 
85  protected:
86 
89  void swapBuffers();
90 
91  std::vector<T> myFirstBuffer;
92  std::vector<T> mySecondBuffer;
93  std::vector<T>* myCurrentBuffer;
94 
95  DtMutex myBufferMutex;
96  };
97 
98 }
99 
100 #define DtLockedBufferedQueue_INL_
101 #include <vrvUtil/DtLockedBufferedQueue.inl>
102 #undef DtLockedBufferedQueue_INL_
103 
104 
105 #endif
106 
void nullAllPointers()
Helper function for setting all member pointers to null in both buffers (for reference pointers...
void getForReading(std::vector< T > *&output)
Get a vector for reading.
~DtLockedBufferedQueue()
DTOR If the type T is a pointer memory must be explicitly deleting by iterating throug both vectors c...
void swapBuffers()
Internal function for swapping buffers and clearing the write buffer.
Contains DLL export macros.
unsigned int push(T value)
Add a value to to the buffer.
std::vector< T > myFirstBuffer
Definition: DtLockedBufferedQueue.h:91
A locked buffered queue which allows multiple writers and a single reader.
Definition: DtLockedBufferedQueue.h:24
void deleteAllPointers()
Helper function for deleting all member pointers in both buffers.
DtMutex myBufferMutex
Definition: DtLockedBufferedQueue.h:95
std::vector< T > mySecondBuffer
Definition: DtLockedBufferedQueue.h:92
void clearBuffers()
Helper function to clear all the buffers, if the buffers contain pointers call deleteAllPointers() fi...
std::vector< T > * myCurrentBuffer
Definition: DtLockedBufferedQueue.h:93

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)