VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlLockfreeMpmcQueue.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc
3 ** All rights reserved.
4 *********************************************************************/
9 #pragma once
10 
11 #ifdef WIN32
12 #if _MSC_VER < 1400
13 #define LOCKFREEQUEUE_UNSUPPORTED
14 #endif
15 #endif
16 
17 #ifndef LOCKFREEQUEUE_UNSUPPORTED
18 
19 #include <vlutil/vlMachineTypes.h>
20 
21 #ifdef DtUSE_UTILITIES_NAMESPACE
22 namespace DtUSE_UTILITIES_NAMESPACE
23 {
24 #endif
25 
26 
28 {
29 public:
30  DtLockfreeMpmcQueueImpl(unsigned int size);
31 
32  virtual ~DtLockfreeMpmcQueueImpl();
33 
34  bool _push(void* const & t);
35 
36  size_t _pop(void* & ret);
37 
38  bool _empty();
39 
40 private:
41  void* myQueue;
42 };
43 
44 template<class T>
46 {
47 
48 public:
49 
50  DtLockfreeMpmcQueue(unsigned int size) : DtLockfreeMpmcQueueImpl(size)
51  {
52  }
53 
55  {
56 
57  }
58 
59  inline bool push(T const & t)
60  {
61  return _push(reinterpret_cast<void*>(t));
62  }
63 
64  inline size_t pop(T & ret)
65  {
66  return _pop(reinterpret_cast<void* &>(ret));
67  }
68 
69  inline bool empty(void)
70  {
71  return _empty();
72  }
73 };
74 
75 
76 #ifdef DtUSE_UTILITIES_NAMESPACE
77 } // end of namespace DtUSE_UTILITIES_NAMESPACE
78 #endif
79 
80 #endif
size_t pop(T &ret)
Definition: vlLockfreeMpmcQueue.h:64
Definition: vlLockfreeMpmcQueue.h:27
~DtLockfreeMpmcQueue()
Definition: vlLockfreeMpmcQueue.h:54
bool empty(void)
Definition: vlLockfreeMpmcQueue.h:69
void * myQueue
Definition: vlLockfreeMpmcQueue.h:41
DtLockfreeMpmcQueue(unsigned int size)
Definition: vlLockfreeMpmcQueue.h:50
Definition: vlLockfreeMpmcQueue.h:45
This file contains typedefs for machine dependant types.
bool push(T const &t)
Definition: vlLockfreeMpmcQueue.h:59
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)