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>
33 #include <GenApi/IPortConstruct.h>
34 #include <GenApi/INodeMap.h>
35 
36 namespace GENAPI_NAMESPACE
37 {
38 
43  class GENAPI_DECL CEventPort : public IPortConstruct
44  {
45 
46  public:
48  CEventPort(INode* pNode = NULL);
49 
51  ~CEventPort();
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 
79  virtual EYesNo GetSwapEndianess();
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 
99  int GetEventIDLength();
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 
111  void DetachEvent();
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
135  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
GENICAM_INTERFACE INode
Interface common to all nodes.
Definition: ICategory.h:49
enum GENAPI_NAMESPACE::_EYesNo EYesNo
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortConstruct
Interface for ports.
Definition: IPortConstruct.h:50
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition: IPort.h:55
virtual EYesNo GetSwapEndianess()=0
Determines if the port adapter must perform an endianess swap.
Definition of interface INodeMap.
virtual EInterfaceType GetPrincipalInterfaceType() const =0
Get the type of the main interface of a node.
virtual void InvalidateNode()=0
Indicates that the node&#39;s value may have changed.
Definition of interface IPortConstruct.
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortStacked
Interface for ports.
Definition: IPortStacked.h:62
virtual CLock & GetLock() const =0
Returns the lock which guards the node map.
Port attachable to an event.
Definition: EventPort.h:43
Definition of template CPointer.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
Definition: ChunkAdapter.h:37
A lock class.
Definition: Synch.h:61