Image Component Library (ICL)
DCFrameQueue.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLIO/src/ICLIO/DCFrameQueue.h **
10 ** Module : ICLIO **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLIO/DC.h>
34 #include <ICLIO/DCDeviceOptions.h>
35 
36 #include <ICLUtils/Mutex.h>
37 #include <queue>
38 
39 namespace icl{
40  namespace io{
41 
42  namespace dc{
43 
45 
55  class DCFrameQueue{
56  public:
58  ICLIO_API DCFrameQueue(dc1394camera_t* c, DCDeviceOptions *options,int nDMABuffers=5, int nQueuedBuffers=1);
59 
62 
64 
69  ICLIO_API void step();
70 
72 
77  inline dc1394video_frame_t *front() { return q.front(); }
78 
80 
83  inline dc1394video_frame_t *back() { return q.back(); }
84 
86  inline void lock() { mutex.lock(); }
87 
89  inline void unlock() { mutex.unlock(); }
90 
92 
93  ICLIO_API void push(dc1394video_frame_t *f);
94 
96 
97  ICLIO_API dc1394video_frame_t *pop();
98 
100  ICLIO_API void showDetails() const;
101 
103  ICLIO_API void resetBus();
104 
105  private:
107  std::queue<dc1394video_frame_t*> q;
108 
111 
113  dc1394camera_t *m_poCam;
114 
117 
120  };
121  }
122  } // namespace io
123 }
124 
utils::Mutex mutex
queue mutex
Definition: DCFrameQueue.h:110
dc1394video_frame_t * back()
returns the newest frame in the queue
Definition: DCFrameQueue.h:83
undocument this line if you encounter any issues!
Definition: Any.h:37
void unlock()
unlocks the mutex
Definition: Mutex.h:111
ICLIO_API ~DCFrameQueue()
releases the internal camera using icl::dc::release_dc_cam()
Utility struct for DC Camera device options.
Definition: DCDeviceOptions.h:39
dc1394camera_t * m_poCam
associated camera
Definition: DCFrameQueue.h:113
ICLIO_API void resetBus()
calls dc1394_reset_bus (not save!)
std::queue< dc1394video_frame_t * > q
wrapped queue structure
Definition: DCFrameQueue.h:107
ICLIO_API DCFrameQueue(dc1394camera_t *c, DCDeviceOptions *options, int nDMABuffers=5, int nQueuedBuffers=1)
Creates a new DCFrameQueue objects with given camera, DMABuffer size and count of queued buffers.
ICLIO_API dc1394video_frame_t * pop()
pops the oldest frame from the front of the internal queue (auto lock()/unlock())
ICLIO_API void push(dc1394video_frame_t *f)
pushes a new frame to the back of the internal queue (auto lock()/unlock())
#define ICLIO_API
Definition: CompatMacros.h:176
void unlock()
unlocks the queue
Definition: DCFrameQueue.h:89
ICLIO_API void step()
performs a new step
Internal used utility class for fast handling of DMA buffers.
Definition: DCFrameQueue.h:55
void lock()
locks the queue
Definition: DCFrameQueue.h:86
ICLIO_API void showDetails() const
shows some debugging information for the wrapped camera
Mutex class of the ICL.
Definition: Mutex.h:54
dc1394video_frame_t * front()
returns the oldest frame in the queue
Definition: DCFrameQueue.h:77
int m_iBuffers
count of internal used DMA buffers
Definition: DCFrameQueue.h:116
void lock()
locks the mutex
Definition: Mutex.h:91
int m_iQueuedBuffers
count of queued buffers
Definition: DCFrameQueue.h:119