PConcurrentQueue.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
26 class PAPILLON_API_CORE PConcurrentQueue : public PObject
27 {
28 public:
34  explicit PConcurrentQueue(papillon::int32 capacity);
35 
39  PConcurrentQueue(const PConcurrentQueue& other);
40 
44  virtual ~PConcurrentQueue();
45 
50 
55  void Enqueue(const PObject& object);
56 
69  PResult TryEnqueue(const PObject& object, int32 timeOutMs = -1);
70 
82  PResult TryDequeue(PObject& destObject, int32 timeOutMs = -1);
83 
90  void Clear();
91 
96  bool IsEmpty() const;
97 
104  bool IsFull() const;
105 
110  void DropOldest();
111 
115  papillon::int32 Size() const;
116 
120  papillon::int32 GetCapacity() const;
121 
127  void SetCapacity(papillon::int32 capacity);
128 };
129 
130 PAPILLON_END_NAMESPACE
131 
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
The PConcurrentQueue class represents a concurrent bounded queue of PObject, thread-safe.
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45