ChunkPort.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006-8 by Basler Vision Technologies
3 // Section: Vision Components
4 // Project: GenApi
5 // Author: Fritz Dierks
6 // $Header$
7 //
8 // License: This file is published under the license of the EMVA GenICam Standard Group.
9 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
10 // If for some reason you are missing this file please contact the EMVA or visit the website
11 // (http://www.genicam.org) for a full copy.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
17 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 //-----------------------------------------------------------------------------
31 #ifndef GENAPI_CHUNKPORT_H
32 #define GENAPI_CHUNKPORT_H
33 
34 #include <GenApi/Pointer.h>
35 #include <GenApi/IPortConstruct.h>
36 #include <GenApi/INodeMap.h>
37 
38 #ifdef _MSC_VER
39 # pragma warning(push)
40 # pragma warning(disable: 4251) // GenApi::CChunkPort::m_ptrPort' : class 'GenApi::CPointer<T>' needs to have dll-interface
41 #endif
42 
43 namespace GENAPI_NAMESPACE
44 {
45 
51  {
52 
53  public:
54 
56  CChunkPort(IPort* pPort = NULL);
57 
59  virtual ~CChunkPort();
60 
61  //-------------------------------------------------------------
62  // IPortConstruct implementation
63  //-------------------------------------------------------------
64 
66  virtual EAccessMode GetAccessMode() const;
67 
70 
72  virtual void Read(void *pBuffer, int64_t Address, int64_t Length);
73 
75  virtual void Write(const void *pBuffer, int64_t Address, int64_t Length);
76 
78  virtual void SetPortImpl(GENAPI_NAMESPACE::IPort* pPort);
79 
81  virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked* pPort);
82 
85  {
86  return No;
87  }
88 
89  //---------------------------------------------------------------
90  // Implementation
91  //---------------------------------------------------------------
92 
93  // Invalidates the chunk port node
94  void InvalidateNode();
95 
96  //-------------------------------------------------------------
97  // Initializing
98  //-------------------------------------------------------------
99 
101  bool AttachPort(GENAPI_NAMESPACE::IPort* pPort);
102 
104  void DetachPort();
105 
107  void AttachChunk(uint8_t *pBaseAddress, int64_t ChunkOffset, int64_t Length, bool Cache);
108 
110  void DetachChunk();
111 
114  {
115  return m_ChunkIDLength;
116  }
117 
119  bool CheckChunkID(uint8_t* pChunkIDBuffer, int ChunkIDLength);
120 
122  bool CheckChunkID(uint64_t ChunkID);
123 
125  void UpdateBuffer(uint8_t *pBaseAddress);
126 
128  void ClearCache();
129  protected:
130 
131  CLock& GetLock() const
132  {
133  if (!m_ptrPort.IsValid())
134  throw RUNTIME_EXCEPTION("The event port is not attached to a node");
135 
136  return m_ptrPort->GetNodeMap()->GetLock();
137  }
138 
139  //-------------------------------------------------------------
140  // Member variables
141  //-------------------------------------------------------------
142 
144  uint8_t *m_pBaseAddress;
145 
148 
151 
154 
157 
160 
163 
165  uint8_t *m_pChunkData;
166 
169 
171  uint64_t m_ChunkIDNumber;
172 
175  };
176 
177 }
178 
179 #ifdef _MSC_VER
180 # pragma warning(pop)
181 #endif
182 
183 #endif // GENAPI_CHUNKPORT_H
uint8_t * m_pBaseAddress
Pointer to the begin of the buffer.
Definition: ChunkPort.h:144
virtual void InvalidateNode()=0
Indicates that the node&#39;s value may have changed.
int64_t m_Length
Length of the chunk.
Definition: ChunkPort.h:150
uint8_t * m_pChunkData
cache for the chunk data
Definition: ChunkPort.h:165
int GetChunkIDLength()
Gets the ChunkID length.
Definition: ChunkPort.h:113
__int64 int64_t
Definition: config-win32.h:21
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t Address
Definition: IPort.h:57
int64_t m_LengthAlloc
Space allocated for the chunk.
Definition: ChunkPort.h:153
#define GENAPI_DECL
Definition: GenApiDll.h:55
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
Definition: GCException.h:247
CLock & GetLock() const
Definition: ChunkPort.h:131
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition: ChunkPort.h:84
CNodePtr m_ptrPort
Pointer to the node holding a reference to this implementation.
Definition: ChunkPort.h:156
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStacked
Interface for ports.
Definition: IPortStacked.h:63
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t int64_t Length
Definition: IPort.h:57
enum GENAPI_NAMESPACE::_EYesNo EYesNo
Defines the choices of a Yes/No alternatives.
Definition of interface INodeMap.
Definition of interface IPortConstruct.
Definition of template CPointer.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition: IPort.h:57
Port attachable to a chunk in a buffer.
Definition: ChunkPort.h:50
uint8_t * m_pChunkIDBuffer
Binary version of the chunk ID.
Definition: ChunkPort.h:159
virtual EInterfaceType GetPrincipalInterfaceType() const =0
Get the type of the main interface of a node.
uint64_t m_ChunkIDNumber
Chunk ID stored as a number (for more straightforward access)
Definition: ChunkPort.h:171
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
int m_ChunkIDLength
Length of the chunk ID buffer.
Definition: ChunkPort.h:162
int64_t m_ChunkOffset
The chunk&#39;s offset within the buffer.
Definition: ChunkPort.h:147
bool m_ChunkIDNumberValid
indicates if the m_ChunkIDNumber is valid (could be invalid eg. if the ID does not fit in 64-bit rang...
Definition: ChunkPort.h:174
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortConstruct
Interface for ports.
bool m_CacheData
indicates if the data needs to be cached
Definition: ChunkPort.h:168
Lexical analyzer for CIntSwissKnife.
Definition: Autovector.h:48
A lock class.
Definition: Synch.h:63
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
typedef for interface type


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:40