All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 nacquire=-1);
118 
127  void startStreaming(int nacquire, int min_buffers);
128 
133  void stopStreaming();
134 
142 
152  const Buffer *grab(int64_t timeout=-1);
153 
162  uint64_t getNumDelivered();
163 
172  uint64_t getNumUnderrun();
173 
182  size_t getNumAnnounced();
183 
192  size_t getNumQueued();
193 
202  size_t getNumAwaitDelivery();
203 
212  uint64_t getNumStarted();
213 
222  size_t getPayloadSize();
223 
232  bool getIsGrabbing();
233 
243  bool getDefinesPayloadsize();
244 
253  std::string getTLType();
254 
263  size_t getNumChunksMax();
264 
273  size_t getBufAnnounceMin();
274 
283  size_t getBufAlignment();
284 
294  std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
295 
302  void *getHandle() const;
303 
304  private:
305 
306  Stream(class Stream &); // forbidden
307  Stream &operator=(const Stream &); // forbidden
308 
310 
311  std::shared_ptr<Device> parent;
312  std::shared_ptr<const GenTLWrapper> gentl;
313  std::string id;
314 
315  std::recursive_mutex mtx;
316 
317  int n_open;
318  void *stream;
319  void *event;
320  size_t bn;
321 
322  std::shared_ptr<CPort> cport;
323  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
324 };
325 
326 }
327 
328 #endif
rcg::Stream::getNumAnnounced
size_t getNumAnnounced()
Returns some information about the stream.
Definition: stream.cc:461
rcg::Stream::stream
void * stream
Definition: stream.h:318
rcg::Stream::startStreaming
void startStreaming(int nacquire=-1)
Allocates four buffers, registers internal events and starts streaming of nacquire buffers.
Definition: stream.cc:167
rcg::Stream::getNumQueued
size_t getNumQueued()
Returns some information about the stream.
Definition: stream.cc:467
rcg::Stream::event
void * event
Definition: stream.h:319
rcg::Buffer
The buffer class encapsulates a Genicam buffer that is provided by a stream.
Definition: buffer.h:118
rcg::Stream::close
void close()
Closes the stream.
Definition: stream.cc:121
rcg::Stream
The stream class encapsulates a Genicam stream.
Definition: stream.h:55
rcg::Stream::getNumStarted
uint64_t getNumStarted()
Returns some information about the stream.
Definition: stream.cc:479
rcg::Stream::attachBuffers
void attachBuffers(bool enable)
Enabling or disabling attaching the grabbed buffer to the remote device nodemap.
Definition: stream.cc:151
rcg::Stream::getAvailableBufferCount
int getAvailableBufferCount()
Returns the number ob buffers that are currently available for grabbing.
Definition: stream.cc:337
rcg
Definition: buffer.cc:47
rcg::Stream::stopStreaming
void stopStreaming()
Stops streaming.
Definition: stream.cc:294
rcg::Stream::getNumChunksMax
size_t getNumChunksMax()
Returns some information about the stream.
Definition: stream.cc:527
device.h
rcg::Stream::getHandle
void * getHandle() const
Get internal stream handle.
Definition: stream.cc:557
rcg::Stream::mtx
std::recursive_mutex mtx
Definition: stream.h:315
rcg::Stream::operator=
Stream & operator=(const Stream &)
rcg::Stream::bn
size_t bn
Definition: stream.h:320
rcg::Stream::getNodeMap
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
Definition: stream.cc:545
rcg::Stream::getDefinesPayloadsize
bool getDefinesPayloadsize()
Returns some information about the stream.
Definition: stream.cc:497
rcg::Stream::getParent
std::shared_ptr< Device > getParent() const
Returns the pointer to the parent device object.
Definition: stream.cc:88
rcg::Stream::getBufAlignment
size_t getBufAlignment()
Returns some information about the stream.
Definition: stream.cc:539
rcg::Stream::id
std::string id
Definition: stream.h:313
rcg::Stream::getID
const std::string & getID() const
Get the internal ID of this stream.
Definition: stream.cc:93
rcg::Stream::getIsGrabbing
bool getIsGrabbing()
Returns some information about the stream.
Definition: stream.cc:491
buffer.h
rcg::Stream::Stream
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
rcg::Stream::open
void open()
Opens the stream for working with it.
Definition: stream.cc:98
rcg::Stream::getBufAnnounceMin
size_t getBufAnnounceMin()
Returns some information about the stream.
Definition: stream.cc:533
rcg::Stream::grab
const Buffer * grab(int64_t timeout=-1)
Wait for the next image or data and return it in a buffer object.
Definition: stream.cc:355
rcg::Stream::cport
std::shared_ptr< CPort > cport
Definition: stream.h:322
int64_t
__int64 int64_t
Definition: config-win32.h:21
rcg::Stream::buffer
Buffer buffer
Definition: stream.h:309
rcg::Stream::getNumUnderrun
uint64_t getNumUnderrun()
Returns some information about the stream.
Definition: stream.cc:455
rcg::Stream::getTLType
std::string getTLType()
Returns some information about the stream.
Definition: stream.cc:503
rcg::Stream::getNumDelivered
uint64_t getNumDelivered()
Returns some information about the stream.
Definition: stream.cc:449
rcg::Stream::parent
std::shared_ptr< Device > parent
Definition: stream.h:311
rcg::Stream::nodemap
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: stream.h:323
rcg::Stream::getNumAwaitDelivery
size_t getNumAwaitDelivery()
Returns some information about the stream.
Definition: stream.cc:473
rcg::Stream::gentl
std::shared_ptr< const GenTLWrapper > gentl
Definition: stream.h:312
rcg::Stream::n_open
int n_open
Definition: stream.h:317
rcg::Stream::~Stream
~Stream()
Definition: stream.cc:68
rcg::Stream::getPayloadSize
size_t getPayloadSize()
Returns some information about the stream.
Definition: stream.cc:485


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:12