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  private:
61  CChunkPort(const CChunkPort&); // copy constructor is not implemented
62  CChunkPort& operator =(const CChunkPort&); // assignment operator is not implemented
63  public:
64  //-------------------------------------------------------------
65  // IPortConstruct implementation
66  //-------------------------------------------------------------
67 
69  virtual EAccessMode GetAccessMode() const;
70 
73 
75  virtual void Read(void *pBuffer, int64_t Address, int64_t Length);
76 
78  virtual void Write(const void *pBuffer, int64_t Address, int64_t Length);
79 
81  virtual void SetPortImpl(GENAPI_NAMESPACE::IPort* pPort);
82 
84  virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked* pPort);
85 
88  {
89  return No;
90  }
91 
92  //---------------------------------------------------------------
93  // Implementation
94  //---------------------------------------------------------------
95 
96  // Invalidates the chunk port node
97  void InvalidateNode();
98 
99  //-------------------------------------------------------------
100  // Initializing
101  //-------------------------------------------------------------
102 
104  bool AttachPort(GENAPI_NAMESPACE::IPort* pPort);
105 
107  void DetachPort();
108 
110  void AttachChunk(uint8_t *pBaseAddress, int64_t ChunkOffset, int64_t Length, bool Cache);
111 
113  void DetachChunk();
114 
117  {
118  return m_ChunkIDLength;
119  }
120 
122  bool CheckChunkID(uint8_t* pChunkIDBuffer, int ChunkIDLength);
123 
125  bool CheckChunkID(uint64_t ChunkID);
126 
128  void UpdateBuffer(uint8_t *pBaseAddress);
129 
131  void ClearCache();
132  protected:
133 
134  CLock& GetLock() const
135  {
136  if (!m_ptrPort.IsValid())
137  throw RUNTIME_EXCEPTION("The event port is not attached to a node");
138 
139  return m_ptrPort->GetNodeMap()->GetLock();
140  }
141 
142  //-------------------------------------------------------------
143  // Member variables
144  //-------------------------------------------------------------
145 
147  uint8_t *m_pBaseAddress;
148 
151 
154 
157 
160 
163 
166 
168  uint8_t *m_pChunkData;
169 
172 
174  uint64_t m_ChunkIDNumber;
175 
178  };
179 
180 }
181 
182 #ifdef _MSC_VER
183 # pragma warning(pop)
184 #endif
185 
186 #endif // GENAPI_CHUNKPORT_H
GENAPI_NAMESPACE
Lexical analyzer for CIntSwissKnife.
Definition: Destructible.h:30
GENAPI_NAMESPACE::EAccessMode
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
GENAPI_NAMESPACE::CChunkPort::m_ChunkIDLength
int m_ChunkIDLength
Length of the chunk ID buffer.
Definition: ChunkPort.h:165
Pointer.h
Definition of template CPointer.
GENAPI_NAMESPACE::CChunkPort::m_pChunkData
uint8_t * m_pChunkData
cache for the chunk data
Definition: ChunkPort.h:168
GENAPI_NAMESPACE::CChunkPort::m_CacheData
bool m_CacheData
indicates if the data needs to be cached
Definition: ChunkPort.h:171
GENAPI_NAMESPACE::CChunkPort::m_ChunkOffset
int64_t m_ChunkOffset
The chunk's offset within the buffer.
Definition: ChunkPort.h:150
GENAPI_NAMESPACE::CChunkPort::GetLock
CLock & GetLock() const
Definition: ChunkPort.h:134
GENAPI_NAMESPACE::CChunkPort::m_ChunkIDNumberValid
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:177
GENAPI_NAMESPACE::GetPrincipalInterfaceType
virtual EInterfaceType GetPrincipalInterfaceType() const =0
Get the type of the main interface of a node.
GENAPI_NAMESPACE::CChunkPort::GetChunkIDLength
int GetChunkIDLength()
Gets the ChunkID length.
Definition: ChunkPort.h:116
GENAPI_NAMESPACE::CChunkPort::m_Length
int64_t m_Length
Length of the chunk.
Definition: ChunkPort.h:153
GENAPI_DECL
#define GENAPI_DECL
Definition: GenApiDll.h:55
GENAPI_NAMESPACE::Write
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
INodeMap.h
Definition of interface INodeMap.
GENAPI_NAMESPACE::EInterfaceType
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
typedef for interface type
GENAPI_NAMESPACE::IPortStacked
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStacked
Interface for ports.
Definition: IPortStacked.h:63
GENAPI_NAMESPACE::Address
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t Address
Definition: IPort.h:57
GENAPI_NAMESPACE::CChunkPort::m_ChunkIDNumber
uint64_t m_ChunkIDNumber
Chunk ID stored as a number (for more straightforward access)
Definition: ChunkPort.h:174
GENAPI_NAMESPACE::CChunkPort::m_pBaseAddress
uint8_t * m_pBaseAddress
Pointer to the begin of the buffer.
Definition: ChunkPort.h:147
GENAPI_NAMESPACE::CChunkPort::m_LengthAlloc
int64_t m_LengthAlloc
Space allocated for the chunk.
Definition: ChunkPort.h:156
GENAPI_NAMESPACE::Length
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT int64_t int64_t Length
Definition: IPort.h:57
GENAPI_NAMESPACE::CLock
A lock class.
Definition: Synch.h:63
GENAPI_NAMESPACE::EYesNo
enum GENAPI_NAMESPACE::_EYesNo EYesNo
Defines the choices of a Yes/No alternatives.
GENAPI_NAMESPACE::CPointer< INode >
GENAPI_NAMESPACE::InvalidateNode
virtual void InvalidateNode()=0
Indicates that the node's value may have changed.
GENAPI_NAMESPACE::CChunkPort
Port attachable to a chunk in a buffer.
Definition: ChunkPort.h:50
IPortConstruct.h
Definition of interface IPortConstruct.
int64_t
__int64 int64_t
Definition: config-win32.h:21
GENAPI_NAMESPACE::No
@ No
no
Definition: Types.h:143
GENAPI_NAMESPACE::IPort
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition: IPort.h:57
RUNTIME_EXCEPTION
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
Definition: GCException.h:247
GENAPI_NAMESPACE::CChunkPort::GetSwapEndianess
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition: ChunkPort.h:87
GENAPI_NAMESPACE::CChunkPort::m_ptrPort
CNodePtr m_ptrPort
Pointer to the node holding a reference to this implementation.
Definition: ChunkPort.h:159
GENAPI_NAMESPACE::operator=
virtual IBoolean & operator=(bool Value)
Set node value.
Definition: IBoolean.h:64
GENAPI_NAMESPACE::IPortConstruct
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortConstruct
Interface for ports.
Definition: IPortConstruct.h:52
GENAPI_NAMESPACE::CChunkPort::m_pChunkIDBuffer
uint8_t * m_pChunkIDBuffer
Binary version of the chunk ID.
Definition: ChunkPort.h:162


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11