stream.h
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_api package.
3  *
4  * Copyright (c) 2017 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef RC_GENICAM_API_STREAM
37 #define RC_GENICAM_API_STREAM
38 
39 #include "device.h"
40 #include "buffer.h"
41 
42 #include <mutex>
43 
44 namespace rcg
45 {
46 
47 class Buffer;
48 
55 class Stream : public std::enable_shared_from_this<Stream>
56 {
57  public:
58 
64  Stream(const std::shared_ptr<Device> &parent,
65  const std::shared_ptr<const GenTLWrapper> &gentl, const char *id);
66  ~Stream();
67 
74  std::shared_ptr<Device> getParent() const;
75 
82  const std::string &getID() const;
83 
90  void open();
91 
97  void close();
98 
108  void attachBuffers(bool enable);
109 
117  void startStreaming(int na=-1);
118 
123  void stopStreaming();
124 
134  const Buffer *grab(int64_t timeout=-1);
135 
144  uint64_t getNumDelivered();
145 
154  uint64_t getNumUnderrun();
155 
164  size_t getNumAnnounced();
165 
174  size_t getNumQueued();
175 
184  size_t getNumAwaitDelivery();
185 
194  uint64_t getNumStarted();
195 
204  size_t getPayloadSize();
205 
214  bool getIsGrabbing();
215 
225  bool getDefinesPayloadsize();
226 
235  std::string getTLType();
236 
245  size_t getNumChunksMax();
246 
255  size_t getBufAnnounceMin();
256 
265  size_t getBufAlignment();
266 
276  std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
277 
284  void *getHandle() const;
285 
286  private:
287 
288  Stream(class Stream &); // forbidden
289  Stream &operator=(const Stream &); // forbidden
290 
292 
293  std::shared_ptr<Device> parent;
294  std::shared_ptr<const GenTLWrapper> gentl;
295  std::string id;
296 
297  std::recursive_mutex mtx;
298 
299  int n_open;
300  void *stream;
301  void *event;
302  size_t bn;
303 
304  std::shared_ptr<CPort> cport;
305  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
306 };
307 
308 }
309 
310 #endif
uint64_t getNumDelivered()
Returns some information about the stream.
Definition: stream.cc:415
Stream & operator=(const Stream &)
const Buffer * grab(int64_t timeout=-1)
Wait for the next image or data and return it in a buffer object.
Definition: stream.cc:321
int n_open
Definition: stream.h:299
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: stream.h:305
size_t bn
Definition: stream.h:302
size_t getNumAwaitDelivery()
Returns some information about the stream.
Definition: stream.cc:439
std::recursive_mutex mtx
Definition: stream.h:297
std::string getTLType()
Returns some information about the stream.
Definition: stream.cc:469
__int64 int64_t
Definition: config-win32.h:21
Buffer buffer
Definition: stream.h:291
std::string id
Definition: stream.h:295
size_t getNumAnnounced()
Returns some information about the stream.
Definition: stream.cc:427
std::shared_ptr< Device > getParent() const
Returns the pointer to the parent device object.
Definition: stream.cc:83
void stopStreaming()
Stops streaming.
Definition: stream.cc:278
const std::string & getID() const
Get the internal ID of this stream.
Definition: stream.cc:88
void attachBuffers(bool enable)
Enabling or disabling attaching the grabbed buffer to the remote device nodemap.
Definition: stream.cc:138
uint64_t getNumStarted()
Returns some information about the stream.
Definition: stream.cc:445
std::shared_ptr< const GenTLWrapper > gentl
Definition: stream.h:294
void * stream
Definition: stream.h:300
void startStreaming(int na=-1)
Allocates buffers and registers internal events if necessary and starts streaming.
Definition: stream.cc:154
size_t getNumChunksMax()
Returns some information about the stream.
Definition: stream.cc:493
size_t getNumQueued()
Returns some information about the stream.
Definition: stream.cc:433
bool getDefinesPayloadsize()
Returns some information about the stream.
Definition: stream.cc:463
The buffer class encapsulates a Genicam buffer that is provided by a stream.
Definition: buffer.h:118
size_t getPayloadSize()
Returns some information about the stream.
Definition: stream.cc:451
Stream(const std::shared_ptr< Device > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a stream class.
Definition: stream.cc:54
std::shared_ptr< CPort > cport
Definition: stream.h:304
bool getIsGrabbing()
Returns some information about the stream.
Definition: stream.cc:457
void * getHandle() const
Get internal stream handle.
Definition: stream.cc:523
std::shared_ptr< Device > parent
Definition: stream.h:293
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
Definition: stream.cc:511
void * event
Definition: stream.h:301
Definition: buffer.cc:47
void open()
Opens the stream for working with it.
Definition: stream.cc:93
void close()
Closes the stream.
Definition: stream.cc:116
uint64_t getNumUnderrun()
Returns some information about the stream.
Definition: stream.cc:421
size_t getBufAnnounceMin()
Returns some information about the stream.
Definition: stream.cc:499
The stream class encapsulates a Genicam stream.
Definition: stream.h:55
size_t getBufAlignment()
Returns some information about the stream.
Definition: stream.cc:505


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:41