interface.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_INTERFACE
37 #define RC_GENICAM_API_INTERFACE
38 
39 #include "system.h"
40 
41 #include <mutex>
42 
43 namespace rcg
44 {
45 
46 class Device;
47 
54 class Interface : public std::enable_shared_from_this<Interface>
55 {
56  public:
57 
63  Interface(const std::shared_ptr<System> &parent,
64  const std::shared_ptr<const GenTLWrapper> &gentl, const char *id);
65  ~Interface();
66 
73  std::shared_ptr<System> getParent() const;
74 
81  const std::string &getID() const;
82 
89  void open();
90 
96  void close();
97 
106  std::vector<std::shared_ptr<Device> > getDevices();
107 
116  std::shared_ptr<Device> getDevice(const char *devid);
117 
127  std::string getDisplayName();
128 
138  std::string getTLType();
139 
149  std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
150 
157  void *getHandle() const;
158 
159  private:
160 
161  Interface(class Interface &); // forbidden
162  Interface &operator=(const Interface &); // forbidden
163 
164  std::shared_ptr<System> parent;
165  std::shared_ptr<const GenTLWrapper> gentl;
166  std::string id;
167 
168  std::mutex mtx;
169 
170  int n_open;
171  void *ifh;
172 
173  std::shared_ptr<CPort> cport;
174  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
175 
176  std::vector<std::weak_ptr<Device> > dlist;
177 };
178 
179 }
180 
181 #endif
std::vector< std::weak_ptr< Device > > dlist
Definition: interface.h:176
std::string getDisplayName()
Returns the display name of the interface.
Definition: interface.cc:279
std::vector< std::shared_ptr< Device > > getDevices()
Returns the currently available devices on this interface.
Definition: interface.cc:139
std::shared_ptr< CPort > cport
Definition: interface.h:173
const std::string & getID() const
Get the internal ID of this interface.
Definition: interface.cc:73
void * getHandle() const
Get internal interace handle.
Definition: interface.cc:303
std::mutex mtx
Definition: interface.h:168
Interface(const std::shared_ptr< System > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs an interface class.
Definition: interface.cc:48
std::string getTLType()
Returns the transport layer type of the interface.
Definition: interface.cc:285
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
Definition: interface.cc:291
Interface & operator=(const Interface &)
std::shared_ptr< System > parent
Definition: interface.h:164
std::shared_ptr< Device > getDevice(const char *devid)
Returns a device with the given device id.
Definition: interface.cc:210
void close()
Closes the interface.
Definition: interface.cc:100
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: interface.h:174
void open()
Opens the interface for working with it.
Definition: interface.cc:78
std::shared_ptr< const GenTLWrapper > gentl
Definition: interface.h:165
Definition: buffer.cc:42
std::shared_ptr< System > getParent() const
Returns the pointer to the parent system object.
Definition: interface.cc:68
std::string id
Definition: interface.h:166
The interface class encapsulates a Genicam interface.
Definition: interface.h:54


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