CPN
Computational Process Networks
CPNThresholdQueue.h
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
25 #ifndef CPN_THRESHOLDQUEUE_H
26 #define CPN_THRESHOLDQUEUE_H
27 #pragma once
28 
29 #include "common_priv.h"
30 #include "ThresholdQueueBase.h"
31 #include "QueueBase.h"
32 
33 namespace CPN {
34 
46  public:
47  ThresholdQueue(KernelBase *k, const SimpleQueueAttr &attr, bool usembs);
48  ThresholdQueue(KernelBase *k, const SimpleQueueAttr &attr, unsigned length, bool usembs);
49  ~ThresholdQueue();
50 
51  protected:
52  virtual void *InternalGetRawEnqueuePtr(unsigned thresh, unsigned chan);
53  virtual void InternalEnqueue(unsigned count);
54 
55 
56  virtual const void *InternalGetRawDequeuePtr(unsigned thresh, unsigned chan);
57  virtual void InternalDequeue(unsigned count);
58 
59  virtual void InternalReset();
60  virtual unsigned UnlockedNumChannels() const;
61  virtual unsigned UnlockedMaxThreshold() const;
62  virtual unsigned UnlockedQueueLength() const;
63  virtual unsigned UnlockedFreespace() const;
64  virtual bool UnlockedFull() const;
65  virtual unsigned UnlockedCount() const;
66  virtual bool UnlockedEmpty() const;
67  virtual unsigned UnlockedEnqueueChannelStride() const;
68  virtual unsigned UnlockedDequeueChannelStride() const;
69 
70  unsigned UnlockedNumEnqueued() const;
71  unsigned UnlockedNumDequeued() const;
72 
73  virtual void UnlockedGrow(unsigned queueLen, unsigned maxThresh);
74 
75  protected:
79  class TQImpl : public ThresholdQueueBase {
80  public:
82  TQImpl(unsigned length, unsigned maxthres, unsigned numchan);
83  TQImpl(const ThresholdQueueAttr &attr);
84 
85  TQImpl *Grow(unsigned queueLen, unsigned maxThresh, bool copy);
86  };
91  };
92 
93 }
94 #endif
Top Representations of generic queues for the CPN library.
ThresholdQueueBase::ulong ulong
The base class for all queues in the CPN library.
Definition: QueueBase.h:39
#define CPN_LOCAL
Definition: common.h:37
A version of the ThresholdQueue that provides the CPN Queue interface This queue implementation creat...
This is a simplified internal representation of the queue attributes needed to create a queue...
Definition: QueueAttr.h:237