GenApi 3.5.1
EventPort.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_EVENTPORT_H
30#define GENAPI_EVENTPORT_H
31
32#include <GenApi/Pointer.h>
34#include <GenApi/INodeMap.h>
35
36namespace GENAPI_NAMESPACE
37{
38
43 class GENAPI_DECL CEventPort : public IPortConstruct
44 {
45
46 public:
48 CEventPort(INode* pNode = NULL);
49
52 private:
53 CEventPort(const CEventPort&); // copy constructor not implemented
54 CEventPort& operator =(const CEventPort&); // assignment operator is not implemented
55 public:
56 //-------------------------------------------------------------
57 // IPortConstruct implementation
58 //-------------------------------------------------------------
59
61 virtual EAccessMode GetAccessMode() const;
62
65
67 virtual void Read(void *pBuffer, int64_t Address, int64_t Length);
68
70 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length);
71
73 virtual void SetPortImpl(GENAPI_NAMESPACE::IPort* pPort);
74
76 virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked* pPort);
77
80
81 //---------------------------------------------------------------
82 // Implementation
83 //---------------------------------------------------------------
84
85 // Invalidates the chunk port node
86 void InvalidateNode();
87
88 //-------------------------------------------------------------
89 // Initializing
90 //-------------------------------------------------------------
91
93 bool AttachNode(GENAPI_NAMESPACE::INode* pNode);
94
96 void DetachNode();
97
100
102 bool CheckEventID(uint8_t* pEventIDBuffer, int EventIDLength) const;
103
105 bool CheckEventID(uint64_t EventID) const;
106
108 void AttachEvent(uint8_t *pBaseAddress, int64_t Length);
109
112
113 protected:
114
115 CLock& GetLock() const;
116 private:
117 void ResetEventDataBuffer();
118
119 //-------------------------------------------------------------
120 // Member variables
121 //-------------------------------------------------------------
122
124 uint8_t *m_pEventData;
125
127 int64_t m_EventDataLength;
128
130 int64_t m_EventDataAlloc;
131#ifdef _MSC_VER
132# pragma warning( push )
133# pragma warning( disable: 4251 )
134#endif
136 CNodePtr m_ptrNode;
137#ifdef _MSC_VER
138# pragma warning( pop )
139#endif
140
142 uint8_t *m_pEventIDBuffer;
143
145 int m_EventIDLength;
146
148 bool m_IsAttachedToPortNode;
149
151 uint64_t m_EventIDNumber;
152
154 bool m_EventIDNumberValid;
155 };
156
157}
158#endif // GENAPI_EVENTPORT_H
Definition of interface INodeMap.
virtual CLock & GetLock() const =0
Returns the lock which guards the node map.
virtual void InvalidateNode()=0
Indicates that the node's value may have changed.
Definition of interface IPortConstruct.
Definition of template CPointer.
Port attachable to an event.
Definition EventPort.h:44
CEventPort(INode *pNode=NULL)
Constructor; can attach to a node.
virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked *pPort)
Called from the port node to give the chunk port a pointer to itself.
bool AttachNode(GENAPI_NAMESPACE::INode *pNode)
Attaches to the Node.
bool CheckEventID(uint8_t *pEventIDBuffer, int EventIDLength) const
Checks if a EventID matches.
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
void DetachNode()
Detaches from the Node.
virtual void SetPortImpl(GENAPI_NAMESPACE::IPort *pPort)
Called from the port node to give the chunk port a pointer to itself.
void DetachEvent()
Detaches the Event from the EventPort.
int GetEventIDLength()
Gets the EventID length.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)
Writes a chunk of bytes to the port.
~CEventPort()
Destructor; detaches from the port.
virtual void Read(void *pBuffer, int64_t Address, int64_t Length)
Reads a chunk of bytes from the port.
virtual EAccessMode GetAccessMode() const
Get the access mode of the node.
virtual EInterfaceType GetPrincipalInterfaceType() const
Get the type of the main interface of a node.
bool CheckEventID(uint64_t EventID) const
Checks if a EventID matches, version using uint64_t ID representation.
void AttachEvent(uint8_t *pBaseAddress, int64_t Length)
Attaches the an Event to the EventPort.
A lock class.
Definition Synch.h:62
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
enum GENAPI_NAMESPACE::_EYesNo EYesNo
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode