GenApi 3.5.1
PortImpl.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2006 by Basler Vision Technologies
3// Author: Fritz Dierks
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_PORTIMPL_H
30#define GENAPI_PORTIMPL_H
31
32#include <Base/GCException.h>
33#include <GenApi/GenApiDll.h>
34#include <GenApi/Types.h>
37#include <GenApi/Pointer.h>
38
39#ifdef _MSC_VER
40# pragma warning( push )
41# pragma warning( disable : 4251 ) // enApi::CPortImpl::m_ptrPort' : class 'GenApi::CPointer<T>' needs to have dll-interface
42# pragma warning( disable : 4275 ) // DLL interface (this is a bug)
43# pragma warning( disable : 4068 ) // unknown pragma; refers to BullsEyeCoverage
44#endif
45
46namespace GENAPI_NAMESPACE
47{
48 //*************************************************************
49 // CPortImpl class
50 //*************************************************************
51
55
56 class CPortImpl : public IPortConstruct, public IPortReplay
57 {
58 public:
61 {
62 }
63
65 virtual ~CPortImpl()
66 {
67 }
68
69 /*---------------------------------------------------------------*/
70 // IBase ==> You need to override this method
71 /*---------------------------------------------------------------*/
72
74
75 virtual EAccessMode GetAccessMode() const = 0;
76
77 /*---------------------------------------------------------------*/
78 // IPort ==> You need to override these methods
79 /*---------------------------------------------------------------*/
80
82 virtual void Read(void *pBuffer, int64_t Address, int64_t Length) = 0;
83
85 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0;
86
87 /*---------------------------------------------------------------*/
88 // IPortConstruct implementation (without IPort & IBase)
89 /*---------------------------------------------------------------*/
90
92 virtual void SetPortImpl(IPort* pPort)
93 {
94 m_ptrPort = pPort;
95 assert(m_ptrPort.IsValid());
96 }
97
100 {
101 return No;
102 }
103
104
105 //---------------------------------------------------------------
106 // IPortReplay implementation
107 //---------------------------------------------------------------
108
110
115 virtual void Replay( IPortWriteList *pPortRecorder, bool Invalidate = true )
116 {
117 if(pPortRecorder)
118 pPortRecorder->Replay(this);
119
120 if(Invalidate)
121 InvalidateNode();
122 }
123
124 // Invalidate the node
125 void InvalidateNode()
126 {
127 if(m_ptrPort.IsValid())
128 m_ptrPort->InvalidateNode();
129 }
130
131 private:
133 CNodePtr m_ptrPort;
134
135 };
136}
137
138#ifdef _MSC_VER
139# pragma warning(pop)
140#endif
141#endif // ifndef GENAPI_PORTIMPL_H
Standard GenICam Exceptions.
declspec's to be used for GenApi Windows dll
Definition of interface IPortConstruct.
Definition of interface IPort.
Definition of template CPointer.
Common types used in the public GenApi interface.
bool IsValid() const
true if the pointer is valid
Definition Pointer.h:109
Definition PortImpl.h:57
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition PortImpl.h:99
CPortImpl()
Constructor.
Definition PortImpl.h:60
virtual void Read(void *pBuffer, int64_t Address, int64_t Length)=0
Reads a chunk of bytes from the port.
virtual void SetPortImpl(IPort *pPort)
Sets pointer the real port implementation; this function may called only once.
Definition PortImpl.h:92
virtual ~CPortImpl()
Destructor.
Definition PortImpl.h:65
virtual void Replay(IPortWriteList *pPortRecorder, bool Invalidate=true)
sends the commands to the camera.
Definition PortImpl.h:115
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
virtual EAccessMode GetAccessMode() const =0
Get the access mode of the node.
enum GENAPI_NAMESPACE::_EYesNo EYesNo
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
@ No
no
Definition Types.h:141