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 
106  void startStreaming(int na=-1);
107 
112  void stopStreaming();
113 
123  const Buffer *grab(int64_t timeout=-1);
124 
133  uint64_t getNumDelivered();
134 
143  uint64_t getNumUnderrun();
144 
153  size_t getNumAnnounced();
154 
163  size_t getNumQueued();
164 
173  size_t getNumAwaitDelivery();
174 
183  uint64_t getNumStarted();
184 
193  size_t getPayloadSize();
194 
203  bool getIsGrabbing();
204 
214  bool getDefinesPayloadsize();
215 
224  std::string getTLType();
225 
234  size_t getNumChunksMax();
235 
244  size_t getBufAnnounceMin();
245 
254  size_t getBufAlignment();
255 
265  std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
266 
273  void *getHandle() const;
274 
275  private:
276 
277  Stream(class Stream &); // forbidden
278  Stream &operator=(const Stream &); // forbidden
279 
281 
282  std::shared_ptr<Device> parent;
283  std::shared_ptr<const GenTLWrapper> gentl;
284  std::string id;
285 
286  std::recursive_mutex mtx;
287 
288  int n_open;
289  void *stream;
290  void *event;
291  size_t bn;
292 
293  std::shared_ptr<CPort> cport;
294  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
295 };
296 
297 }
298 
299 #endif
uint64_t getNumDelivered()
Returns some information about the stream.
Definition: stream.cc:363
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:269
int n_open
Definition: stream.h:288
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: stream.h:294
size_t bn
Definition: stream.h:291
size_t getNumAwaitDelivery()
Returns some information about the stream.
Definition: stream.cc:387
std::recursive_mutex mtx
Definition: stream.h:286
std::string getTLType()
Returns some information about the stream.
Definition: stream.cc:417
__int64 int64_t
Definition: config-win32.h:21
Buffer buffer
Definition: stream.h:280
std::string id
Definition: stream.h:284
size_t getNumAnnounced()
Returns some information about the stream.
Definition: stream.cc:375
std::shared_ptr< Device > getParent() const
Returns the pointer to the parent device object.
Definition: stream.cc:82
void stopStreaming()
Stops streaming.
Definition: stream.cc:239
const std::string & getID() const
Get the internal ID of this stream.
Definition: stream.cc:87
uint64_t getNumStarted()
Returns some information about the stream.
Definition: stream.cc:393
std::shared_ptr< const GenTLWrapper > gentl
Definition: stream.h:283
void * stream
Definition: stream.h:289
void startStreaming(int na=-1)
Allocates buffers and registers internal events if necessary and starts streaming.
Definition: stream.cc:135
size_t getNumChunksMax()
Returns some information about the stream.
Definition: stream.cc:441
size_t getNumQueued()
Returns some information about the stream.
Definition: stream.cc:381
bool getDefinesPayloadsize()
Returns some information about the stream.
Definition: stream.cc:411
The buffer class encapsulates a Genicam buffer that is provided by a stream.
Definition: buffer.h:115
size_t getPayloadSize()
Returns some information about the stream.
Definition: stream.cc:399
Stream(const std::shared_ptr< Device > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a stream class.
Definition: stream.cc:53
std::shared_ptr< CPort > cport
Definition: stream.h:293
bool getIsGrabbing()
Returns some information about the stream.
Definition: stream.cc:405
void * getHandle() const
Get internal stream handle.
Definition: stream.cc:471
std::shared_ptr< Device > parent
Definition: stream.h:282
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
Definition: stream.cc:459
void * event
Definition: stream.h:290
Definition: buffer.cc:42
void open()
Opens the stream for working with it.
Definition: stream.cc:92
void close()
Closes the stream.
Definition: stream.cc:115
uint64_t getNumUnderrun()
Returns some information about the stream.
Definition: stream.cc:369
size_t getBufAnnounceMin()
Returns some information about the stream.
Definition: stream.cc:447
The stream class encapsulates a Genicam stream.
Definition: stream.h:55
size_t getBufAlignment()
Returns some information about the stream.
Definition: stream.cc:453


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54