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 
82  {
83  return No;
84  }
85 
86  //---------------------------------------------------------------
87  // Implementation
88  //---------------------------------------------------------------
89 
90  // Invalidates the chunk port node
91  void InvalidateNode();
92 
93  //-------------------------------------------------------------
94  // Initializing
95  //-------------------------------------------------------------
96 
98  bool AttachPort(GENAPI_NAMESPACE::IPort* pPort);
99 
101  void DetachPort();
102 
104  void AttachChunk(uint8_t *pBaseAddress, int64_t ChunkOffset, int64_t Length, bool Cache);
105 
107  void DetachChunk();
108 
111  {
112  return m_ChunkIDLength;
113  }
114 
116  bool CheckChunkID(uint8_t* pChunkIDBuffer, int ChunkIDLength);
117 
119  bool CheckChunkID(uint64_t ChunkID);
120 
122  void UpdateBuffer(uint8_t *pBaseAddress);
123 
125  void ClearCache();
126  protected:
127 
128  CLock& GetLock() const
129  {
130  if (!m_ptrPort.IsValid())
131  throw RUNTIME_EXCEPTION("The event port is not attached to a node");
132 
133  return m_ptrPort->GetNodeMap()->GetLock();
134  }
135 
136  //-------------------------------------------------------------
137  // Member variables
138  //-------------------------------------------------------------
139 
141  uint8_t *m_pBaseAddress;
142 
145 
148 
151 
154 
157 
160 
162  uint8_t *m_pChunkData;
163 
166 
168  uint64_t m_ChunkIDNumber;
169 
172  };
173 
174 }
175 
176 #ifdef _MSC_VER
177 # pragma warning(pop)
178 #endif
179 
180 #endif // GENAPI_CHUNKPORT_H
uint8_t * m_pBaseAddress
Pointer to the begin of the buffer.
Definition: ChunkPort.h:141
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:147
uint8_t * m_pChunkData
cache for the chunk data
Definition: ChunkPort.h:162
interface GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition: IPort.h:57
int GetChunkIDLength()
Gets the ChunkID length.
Definition: ChunkPort.h:110
__int64 int64_t
Definition: config-win32.h:21
int64_t m_LengthAlloc
Space allocated for the chunk.
Definition: ChunkPort.h:150
#define GENAPI_DECL
Definition: GenApiDll.h:55
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
Definition: GCException.h:246
CLock & GetLock() const
Definition: ChunkPort.h:128
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition: ChunkPort.h:81
CNodePtr m_ptrPort
Pointer to the node holding a reference to this implementation.
Definition: ChunkPort.h:153
interface GENAPI_DECL_ABSTRACT int64_t Address
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.
interface GENAPI_DECL_ABSTRACT int64_t int64_t Length
Definition: IPort.h:57
Definition of template CPointer.
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:156
interface GENAPI_DECL_ABSTRACT IPortConstruct
Interface for ports.
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:168
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
int m_ChunkIDLength
Length of the chunk ID buffer.
Definition: ChunkPort.h:159
int64_t m_ChunkOffset
The chunk&#39;s offset within the buffer.
Definition: ChunkPort.h:144
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:171
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
bool m_CacheData
indicates if the data needs to be cached
Definition: ChunkPort.h:165
Part of the generic device API.
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 Thu Jun 6 2019 19:10:53