GenApi  3.5.1
PortStackedImpl.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_PORTSTACKEDIMPL_H
30 #define GENAPI_PORTSTACKEDIMPL_H
31 
32 #include <Base/GCException.h>
33 #include <GenApi/GenApiDll.h>
34 #include <GenApi/Types.h>
35 #include <GenApi/IPortConstruct.h>
36 #include <GenApi/IPortRecorder.h>
37 #include <GenApi/Pointer.h>
38 
39 #pragma warning( push )
40 #pragma warning( disable: 4251 ) // enApi::CPortImpl::m_ptrPort' : class 'GenApi::CPointer<T>' needs to have dll-interface
41 #pragma warning ( disable : 4068 ) // unknown pragma; refers to BullsEyeCoverage
42 
43 namespace GENAPI_NAMESPACE
44 {
45 # pragma warning ( push )
46 # pragma warning ( disable : 4251 ) // DLL interface (this is a bug)
47 # pragma warning ( disable : 4275 ) // DLL interface (this is a bug)
48 
49  //*************************************************************
50  // CPortImpl class
51  //*************************************************************
52 
56 
58  {
59  public:
62  {
63  }
64 
67  {
68  }
69 
70  /*---------------------------------------------------------------*/
71  // IBase ==> You need to override this method
72  /*---------------------------------------------------------------*/
73 
75 
76  virtual EAccessMode GetAccessMode() const = 0;
77 
78  /*---------------------------------------------------------------*/
79  // IPort ==> You need to override these methods
80  /*---------------------------------------------------------------*/
81 
83  virtual void Read(void *pBuffer, int64_t Address, int64_t Length) = 0;
84 
86  virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0;
87 
88  /*---------------------------------------------------------------*/
89  // IPortStacked ==> You need to override these methods
90  /*---------------------------------------------------------------*/
91 
93  virtual void Write(PORT_REGISTER_STACK_ENTRY *pEntries, size_t numEntries) = 0;
94 
95  /*---------------------------------------------------------------*/
96  // IPortStackedConstruct implementation (without IPort & IBase)
97  /*---------------------------------------------------------------*/
98 
100  virtual void SetPortImpl(IPortStacked* pPort)
101  {
102  m_ptrPort = pPort;
103  assert(m_ptrPort.IsValid());
104  }
105 
108  {
109  return No;
110  }
111 
112 
113  //---------------------------------------------------------------
114  // IPortReplay implementation
115  //---------------------------------------------------------------
116 
118 
123  virtual void Replay( IPortWriteList *pPortRecorder, bool Invalidate = true )
124  {
125  if(pPortRecorder)
126  pPortRecorder->Replay(this);
127 
128  if(Invalidate)
129  InvalidateNode();
130  }
131 
132  // Invalidate the node
133  void InvalidateNode()
134  {
135  if(m_ptrPort.IsValid())
136  m_ptrPort->InvalidateNode();
137  }
138 
139  private:
141  CNodePtr m_ptrPort;
142 
143  };
144 
145 # pragma warning ( pop )
146 }
147 
148 #pragma warning(pop)
149 #endif // ifndef GENAPI_PORTSTACKEDIMPL_H
CPortStackedImpl()
Constructor.
Definition: PortStackedImpl.h:61
virtual void SetPortImpl(IPortStacked *pPort)
Sets pointer the real port implementation; this function may called only once.
Definition: PortStackedImpl.h:100
Common types used in the public GenApi interface.
bool IsValid() const
true if the pointer is valid
Definition: Pointer.h:109
enum GENAPI_NAMESPACE::_EYesNo EYesNo
virtual void Replay(IPortWriteList *pPortRecorder, bool Invalidate=true)
sends the commands to the camera.
Definition: PortStackedImpl.h:123
no
Definition: Types.h:141
virtual ~CPortStackedImpl()
Destructor.
Definition: PortStackedImpl.h:66
virtual void Read(void *pBuffer, int64_t Address, int64_t Length)=0
Reads a chunk of bytes from the port.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStackedConstruct
Interface for ports.
Definition: IPortConstruct.h:61
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
Standard implementation for a port !
Definition: PortStackedImpl.h:57
Definition of interface IPort.
virtual EAccessMode GetAccessMode() const =0
Get the access mode of the node.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
Definition of interface IPortConstruct.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStacked
Interface for ports.
Definition: IPortStacked.h:62
Standard GenICam Exceptions.
Definition of template CPointer.
declspec&#39;s to be used for GenApi Windows dll
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortReplay
Interface for replaying write commands on a port.
Definition: IPortRecorder.h:56
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition: PortStackedImpl.h:107
Definition: ChunkAdapter.h:37