GenApi  3.5.1
IPortRecorder.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2009 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_IPORTRECORDER_H
30 #define GENAPI_IPORTRECORDER_H
31 
32 #include <GenApi/IPort.h>
33 
34 #ifdef _MSC_VER
35 # pragma warning ( push )
36 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
37 #endif
38 
39 namespace GENAPI_NAMESPACE
40 {
41 
42  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortWriteList
43  {
45  virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0;
46 
48  virtual void Replay(IPort* pPort) = 0;
49 
51  // Default = -1
52  virtual void SetCookie(const int64_t Value) = 0;
53 
55  virtual int64_t GetCookie() = 0;
56  };
57 
62  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortReplay : virtual public IPort
63  {
65 
70  virtual void Replay(IPortWriteList *pPortRecorder, bool Invalidate = true) = 0;
71  };
72 
77  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortRecorder : public IPortReplay
78  {
80  virtual void StartRecording(IPortWriteList *pPortRecorder) = 0;
81 
83  virtual void StopRecording() = 0;
84  };
85 
86  //*************************************************************
87  // CPortRecorderRef class
88  //*************************************************************
89 
95  template <class T>
96  class CPortRecorderRefT : public CPortRefT<T>
97  {
98  typedef CPortRefT<T> ref;
99 
100  public:
101  /*--------------------------------------------------------*/
102  // IPortRecorder
103  /*--------------------------------------------------------*/
104 
106 
111  virtual void Replay(IPortWriteList *pPortRecorder, bool Invalidate = true)
112  {
113  if (ref::m_Ptr)
114  {
115  ref::m_Ptr->Replay(pPortRecorder, Invalidate);
116  }
117  else
118  {
119  throw ACCESS_EXCEPTION( "Feature not present (reference not valid)" );
120  }
121  }
122 
124  virtual void StartRecording(IPortWriteList *pPortRecorder)
125  {
126  if (ref::m_Ptr)
127  {
128  ref::m_Ptr->StartRecording(pPortRecorder);
129  }
130  else
131  {
132  throw ACCESS_EXCEPTION( "Feature not present (reference not valid)" );
133  }
134  }
135 
137  virtual void StopRecording()
138  {
139  if (ref::m_Ptr)
140  {
141  ref::m_Ptr->StopRecording();
142  }
143  else
144  {
145  throw ACCESS_EXCEPTION( "Feature not present (reference not valid)" );
146  }
147  }
148  };
149 
152  typedef CPortRecorderRefT< IPortRecorder > CPortRecorderRef;
153 
154 }
155 
156 #ifdef _MSC_VER
157 # pragma warning ( pop )
158 #endif
159 
160 #endif // ifndef GENAPI_IPORTRECORDER_H
virtual void Replay(IPort *pPort)=0
Replays the write command to the given port interface.
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition: GCException.h:252
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPort
Interface for ports.
Definition: IPort.h:55
virtual void StopRecording()=0
stops recording
Definition of interface IPort.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)=0
Writes a chunk of bytes to the port.
CPortRecorderRefT< IPortRecorder > CPortRecorderRef
Definition: IPortRecorder.h:152
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortReplay
Interface for replaying write commands on a port.
Definition: IPortRecorder.h:56
virtual int64_t GetCookie()=0
Gets the cookie a port implementation may have set for caching a command list.
virtual void SetCookie(const int64_t Value)=0
Sets a cookie in case the port implementation want to cache a command list.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPortRecorder
Interface for recording write commands on a port.
Definition: IPortRecorder.h:71
Definition: ChunkAdapter.h:37