stream.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the rc_genicam_api package.
00003  *
00004  * Copyright (c) 2017 Roboception GmbH
00005  * All rights reserved
00006  *
00007  * Author: Heiko Hirschmueller
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright notice,
00013  * this list of conditions and the following disclaimer.
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  * this list of conditions and the following disclaimer in the documentation
00017  * and/or other materials provided with the distribution.
00018  *
00019  * 3. Neither the name of the copyright holder nor the names of its contributors
00020  * may be used to endorse or promote products derived from this software without
00021  * specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  * POSSIBILITY OF SUCH DAMAGE.
00034  */
00035 
00036 #ifndef RC_GENICAM_API_STREAM
00037 #define RC_GENICAM_API_STREAM
00038 
00039 #include "device.h"
00040 #include "buffer.h"
00041 
00042 #include <mutex>
00043 
00044 namespace rcg
00045 {
00046 
00047 class Buffer;
00048 
00055 class Stream : public std::enable_shared_from_this<Stream>
00056 {
00057   public:
00058 
00064     Stream(const std::shared_ptr<Device> &parent,
00065            const std::shared_ptr<const GenTLWrapper> &gentl, const char *id);
00066     ~Stream();
00067 
00074     std::shared_ptr<Device> getParent() const;
00075 
00082     const std::string &getID() const;
00083 
00090     void open();
00091 
00097     void close();
00098 
00106     void startStreaming(int na=-1);
00107 
00112     void stopStreaming();
00113 
00123     const Buffer *grab(int64_t timeout=-1);
00124 
00133     uint64_t getNumDelivered();
00134 
00143     uint64_t getNumUnderrun();
00144 
00153     size_t getNumAnnounced();
00154 
00163     size_t getNumQueued();
00164 
00173     size_t getNumAwaitDelivery();
00174 
00183     uint64_t getNumStarted();
00184 
00193     size_t getPayloadSize();
00194 
00203     bool getIsGrabbing();
00204 
00214     bool getDefinesPayloadsize();
00215 
00224     std::string getTLType();
00225 
00234     size_t getNumChunksMax();
00235 
00244     size_t getBufAnnounceMin();
00245 
00254     size_t getBufAlignment();
00255 
00265     std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
00266 
00273     void *getHandle() const;
00274 
00275   private:
00276 
00277     Stream(class Stream &); // forbidden
00278     Stream &operator=(const Stream &); // forbidden
00279 
00280     Buffer buffer;
00281 
00282     std::shared_ptr<Device> parent;
00283     std::shared_ptr<const GenTLWrapper> gentl;
00284     std::string id;
00285 
00286     std::recursive_mutex mtx;
00287 
00288     int n_open;
00289     void *stream;
00290     void *event;
00291     size_t bn;
00292 
00293     std::shared_ptr<CPort> cport;
00294     std::shared_ptr<GenApi::CNodeMapRef> nodemap;
00295 };
00296 
00297 }
00298 
00299 #endif


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:47