cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlSampleQueue.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Balazs Vagvolgyi
7  Created on: 2009
8 
9  (C) Copyright 2006-2008 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 
20 */
21 
22 #ifndef _svlSampleQueue_h
23 #define _svlSampleQueue_h
24 
28 
29 // Always include last!
31 
32 
34 {
35 public:
36  svlSampleQueue(svlStreamType type, unsigned int size);
37  ~svlSampleQueue();
38 
39  bool Push(const svlSample* sample);
40  svlSample* Pull(double timeout = 5.0);
41 
42  svlStreamType GetType();
43  unsigned int GetLength();
44  unsigned int GetUsage();
45  double GetUsageRatio();
46  unsigned int GetDroppedSampleCount();
47  svlSample* Peek();
48 
49 private:
50  svlStreamType Type;
51  unsigned int Size;
52  unsigned int DroppedSamples;
53  std::list<svlSample*> UnusedItems;
54  std::list<svlSample*> BufferedItems;
55  svlSample* PullItem;
56 
58  osaThreadSignal NewSampleEvent;
59 };
60 
61 /*
62 class CISST_EXPORT svlSampleQueu2
63 {
64 public:
65  svlSampleQueu2(svlStreamType type, int length);
66  ~svlSampleQueu2();
67 
68  svlStreamType GetType();
69  int GetLength();
70  int GetUsage();
71  double GetUsageRatio();
72  int GetDroppedSampleCount();
73 
74  bool PreAllocate(const svlSample* sample);
75 
76  bool Push(const svlSample* sample);
77  svlSample* Pull(double timeout = 5.0);
78  svlSample* Peek();
79 
80 private:
81  svlSampleQueu2();
82 
83  svlStreamType Type;
84  const int Length;
85  int Tail;
86  int Head;
87  int BufferUsage;
88  int DroppedSamples;
89  svlSample* ReadBuffer;
90  vctDynamicVector<svlSample*> Buffer;
91  osaCriticalSection CS;
92  osaThreadSignal NewSampleEvent;
93 };
94 */
95 
96 #endif // _svlSampleQueue_h
97 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
svlStreamType
Definition: svlDefinitions.h:193
Definition: osaCriticalSection.h:36
Declaration of osaThreadSignal.
Macros to export the symbols of cisstStereoVision (in a Dll).
Definition: svlSampleQueue.h:33
Definition: osaThreadSignal.h:40
Definition: svlSample.h:31