GenApi 3.5.1
IPortStacked.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2017 by Teledyne DALSA
3// Author: Eric Bourbonnais
4//
5// License: This file is published under the license of the EMVA GenICam Standard Group.
6// A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7// If for some reason you are missing this file please contact the EMVA or visit the website
8// (http://www.genicam.org) for a full copy.
9//
10// THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20// POSSIBILITY OF SUCH DAMAGE.
21//
22//-----------------------------------------------------------------------------
29#ifndef GENAPI_IPORT_STACKED_H
30#define GENAPI_IPORT_STACKED_H
31
32#include <Base/GCException.h>
33#include <GenApi/GenApiDll.h>
34#include <GenApi/Types.h>
35#include <GenApi/IBase.h>
36#include <GenApi/IPort.h>
37
38#ifdef WIN32
39# pragma warning ( push )
40# pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
41#endif // #ifdef WIN32
42
43namespace GENAPI_NAMESPACE
44{
45 //*************************************************************
46 // IPort interface
47 //*************************************************************
48
49 typedef struct S_PORT_REGISTER_STACK_ENTRY
50 {
51 uint64_t Address; /* Address of the register. */
52 void* pBuffer; /* Pointer to the buffer containing the data. */
53 size_t Size; /* Number of bytes to read write. */
54 } PORT_REGISTER_STACK_ENTRY;
55
60 GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStacked : virtual public IPort
61 {
62 using IPort::Write; // tell the compiler we want both Write functions (the one from the base class and the next one)
64 virtual void Write(PORT_REGISTER_STACK_ENTRY *pEntries, size_t numEntries) = 0;
65 };
66
67 //*************************************************************
68 // CPortRef class
69 //*************************************************************
70
71#ifndef DOXYGEN_IGNORE
72
78 template <class T>
79 class CPortStackedRefT : public CPortRefT<T>
80 {
81 typedef CPortRefT<T> ref;
82
83 public:
84 /*--------------------------------------------------------*/
85 // IPort
86 /*--------------------------------------------------------*/
87
89 virtual void Read(PORT_REGISTER_STACK_ENTRY *pEntries, size_t numEntries)
90 {
91 if(!ref::m_Ptr)
92 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
93 ref::m_Ptr->Read(pEntries, numEntries);
94 }
95
97 virtual void Write(PORT_REGISTER_STACK_ENTRY *pEntries, size_t numEntries)
98 {
99 if(!ref::m_Ptr)
100 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
101 ref::m_Ptr->Write(pEntries, numEntries);
102 }
103
104 };
105
108 typedef CPortStackedRefT<IPortStacked> CPortStackedRef;
109
110#endif
111
112}
113
114#ifdef WIN32
115# pragma warning ( pop )
116#endif // #ifdef WIN32
117
118#endif // ifndef GENAPI_IPORT_STACKED_H
Standard GenICam Exceptions.
declspec's to be used for GenApi Windows dll
Definition of interface IBase.
Definition of interface IPort.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
Common types used in the public GenApi interface.
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition GCException.h:252
CPortStackedRefT< IPortStacked > CPortStackedRef
Definition IPortStacked.h:108
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition IPort.h:55