GenApi 3.5.1
IPort.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2006 by Basler Vision Technologies
3// Author: Margret Albrecht
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_H
30#define GENAPI_IPORT_H
31
32#include <Base/GCException.h>
33#include <GenApi/GenApiDll.h>
34#include <GenApi/Types.h>
35#include <GenApi/IBase.h>
36
37#ifdef _MSC_VER
38# pragma warning ( push )
39# pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
40#endif
41
42namespace GENAPI_NAMESPACE
43{
44 //*************************************************************
45 // IPort interface
46 //*************************************************************
47
52 GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort : virtual public IBase
53 {
55 virtual void Read(void *pBuffer, int64_t Address, int64_t Length) = 0;
56
58 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0;
59 };
60
61 //*************************************************************
62 // CPortRef class
63 //*************************************************************
64
65#ifndef DOXYGEN_IGNORE
66
72 template <class T>
73 class CPortRefT : public CBaseRefT<T>
74 {
75 typedef CBaseRefT<T> ref;
76
77 public:
78 /*--------------------------------------------------------*/
79 // IPort
80 /*--------------------------------------------------------*/
81
83 virtual void Read(void *pBuffer, int64_t Address, int64_t Length)
84 {
85 if (ref::m_Ptr)
86 {
87 ref::m_Ptr->Read(pBuffer, Address, Length);
88 }
89 else
90 {
91 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
92 }
93 }
94
96 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)
97 {
98 if (ref::m_Ptr)
99 {
100 ref::m_Ptr->Write(pBuffer, Address, Length);
101 }
102 else
103 {
104 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
105 }
106 }
107 };
108
111 typedef CPortRefT<IPort> CPortRef;
112
113#endif
114
115}
116
117#ifdef _MSC_VER
118# pragma warning ( pop )
119#endif
120
121#endif // ifndef GENAPI_IPORT_H
Standard GenICam Exceptions.
declspec's to be used for GenApi Windows dll
Definition of interface IBase.
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
CPortRefT< IPort > CPortRef
Definition IPort.h:111
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition IPort.h:55
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBase
Base interface common to all nodes.
Definition IBase.h:53