00001 /*============================================================================= 00002 Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 00003 00004 Redistribution of this file, in original or modified form, without 00005 prior written consent of Allied Vision Technologies is prohibited. 00006 00007 ------------------------------------------------------------------------------- 00008 00009 File: Frame.h 00010 00011 Description: Definition of class AVT::VmbAPI::Frame. 00012 00013 ------------------------------------------------------------------------------- 00014 00015 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 00016 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 00017 NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00018 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00019 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00021 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00022 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00023 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00024 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 00026 =============================================================================*/ 00027 00028 #ifndef AVT_VMBAPI_FRAME_H 00029 #define AVT_VMBAPI_FRAME_H 00030 00031 #include <VimbaC/Include/VimbaC.h> 00032 #include <VimbaCPP/Include/VimbaCPPCommon.h> 00033 #include <VimbaCPP/Include/SharedPointerDefines.h> 00034 #include <VimbaCPP/Include/IFrameObserver.h> 00035 #include <VimbaCPP/Include/AncillaryData.h> 00036 #include <vector> 00037 00038 namespace AVT { 00039 namespace VmbAPI { 00040 00041 class Frame 00042 { 00043 friend class Camera; 00044 00045 public: 00046 // 00047 // Method: Frame constructor 00048 // 00049 // Purpose: Creates an instance of class Frame 00050 // 00051 // Parameters: [in ] VmbInt64_t bufferSize The size of the underlying buffer 00052 // 00053 IMEXPORT explicit Frame( VmbInt64_t bufferSize ); 00054 00055 // 00056 // Method: Frame constructor 00057 // 00058 // Purpose: Creates an instance of class Frame 00059 // 00060 // Parameters: [in ] VmbUchar_t *pBuffer A pointer to an allocated buffer 00061 // Parameters: [in ] VmbInt64_t bufferSize The size of the underlying buffer 00062 // 00063 IMEXPORT Frame( VmbUchar_t *pBuffer, VmbInt64_t bufferSize ); 00064 00065 // 00066 // Method: Frame destructor 00067 // 00068 // Purpose: Destroys an instance of class Frame 00069 // 00070 IMEXPORT ~Frame(); 00071 00072 // 00073 // Method: RegisterObserver() 00074 // 00075 // Purpose: Registers an observer that will be called whenever a new frame arrives 00076 // 00077 // Parameters: [in ] IFrameObserverPtr &observer An object that implements the IObserver interface 00078 // 00079 // Returns: 00080 // 00081 // - VmbErrorSuccess: If no error 00082 // - VmbErrorResources: The observer was in use 00083 // 00084 // Details: As new frames arrive, the observer's FrameReceived method will be called. 00085 // Only one observer can be registered. 00086 // 00087 IMEXPORT VmbErrorType RegisterObserver( const IFrameObserverPtr &observer ); 00088 00089 // 00090 // Method: UnregisterObserver() 00091 // 00092 // Purpose: Unregisters the observer that was called whenever a new frame arrived 00093 // 00094 // Parameters: none 00095 // 00096 IMEXPORT VmbErrorType UnregisterObserver(); 00097 00098 // 00099 // Method: GetAncillaryData() 00100 // 00101 // Purpose: Returns the part of a frame that describes the chunk data as an object 00102 // 00103 // Returns: 00104 // 00105 // - VmbErrorSuccess: If no error 00106 // - VmbErrorNotFound: No chunk data present 00107 // 00108 // Parameters: [out] AncillaryDataPtr &ancillaryData The wrapped chunk data 00109 // 00110 IMEXPORT VmbErrorType GetAncillaryData( AncillaryDataPtr &ancillaryData ); 00111 00112 // 00113 // Method: GetAncillaryData() 00114 // 00115 // Purpose: Returns the part of a frame that describes the chunk data as an object 00116 // 00117 // Returns: 00118 // 00119 // - VmbErrorSuccess: If no error 00120 // - VmbErrorNotFound: No chunk data present 00121 // 00122 // Parameters: [out] ConstAncillaryDataPtr &ancillaryData The wrapped chunk data 00123 // 00124 IMEXPORT VmbErrorType GetAncillaryData( ConstAncillaryDataPtr &ancillaryData ) const; 00125 00126 // 00127 // Method: GetBuffer() 00128 // 00129 // Purpose: Returns the complete buffer including image and chunk data 00130 // 00131 // Returns: 00132 // 00133 // - VmbErrorSuccess: If no error 00134 // 00135 // Parameters: [out] VmbUchar_t *pBuffer A pointer to the buffer 00136 // 00137 IMEXPORT VmbErrorType GetBuffer( VmbUchar_t* &pBuffer ); 00138 00139 // 00140 // Method: GetBuffer() 00141 // 00142 // Purpose: Returns the complete buffer including image and chunk data 00143 // 00144 // Returns: 00145 // 00146 // - VmbErrorSuccess: If no error 00147 // 00148 // Parameters: [out] const VmbUchar_t *pBuffer A pointer to the buffer 00149 // 00150 IMEXPORT VmbErrorType GetBuffer( const VmbUchar_t* &pBuffer ) const; 00151 00152 // 00153 // Method: GetImage() 00154 // 00155 // Purpose: Returns only the image data 00156 // 00157 // Returns: 00158 // 00159 // - VmbErrorSuccess: If no error 00160 // 00161 // Parameters: [out] VmbUchar_t *pBuffer A pointer to the buffer 00162 // 00163 IMEXPORT VmbErrorType GetImage( VmbUchar_t* &pBuffer ); 00164 00165 // 00166 // Method: GetImage() 00167 // 00168 // Purpose: Returns only the image data 00169 // 00170 // Returns: 00171 // 00172 // - VmbErrorSuccess: If no error 00173 // 00174 // Parameters: [out] const VmbUchar_t *pBuffer A pointer to the buffer 00175 // 00176 IMEXPORT VmbErrorType GetImage( const VmbUchar_t* &pBuffer ) const; 00177 00178 // 00179 // Method: GetReceiveStatus() 00180 // 00181 // Purpose: Returns the receive status of a frame 00182 // 00183 // Returns: 00184 // 00185 // - VmbErrorSuccess: If no error 00186 // 00187 // Parameters: [out] VmbFrameStatusType &status The receive status 00188 // 00189 IMEXPORT VmbErrorType GetReceiveStatus( VmbFrameStatusType &status ) const; 00190 00191 // 00192 // Method: GetImageSize() 00193 // 00194 // Purpose: Returns the memory size of the image 00195 // 00196 // Returns: 00197 // 00198 // - VmbErrorSuccess: If no error 00199 // 00200 // Parameters: [out] VmbUint32_t &imageSize The size in bytes 00201 // 00202 IMEXPORT VmbErrorType GetImageSize( VmbUint32_t &imageSize ) const; 00203 00204 // 00205 // Method: GetAncillarySize() 00206 // 00207 // Purpose: Returns memory size of the chunk data 00208 // 00209 // Returns: 00210 // 00211 // - VmbErrorSuccess: If no error 00212 // 00213 // Parameters: [out] VmbUint32_t &ancillarySize The size in bytes 00214 // 00215 IMEXPORT VmbErrorType GetAncillarySize( VmbUint32_t &ancillarySize ) const; 00216 00217 // 00218 // Method: GetAncillarySize() 00219 // 00220 // Purpose: Returns the memory size of the frame buffer holding 00221 // both the image data and the ancillary data 00222 // 00223 // Returns: 00224 // 00225 // - VmbErrorSuccess: If no error 00226 // 00227 // Parameters: [out] VmbUint32_t &bufferSize The size in bytes 00228 // 00229 IMEXPORT VmbErrorType GetBufferSize( VmbUint32_t &bufferSize ) const; 00230 00231 // 00232 // Method: GetPixelFormat() 00233 // 00234 // Purpose: Returns the GeV compliant pixel format 00235 // 00236 // Returns: 00237 // 00238 // - VmbErrorSuccess: If no error 00239 // 00240 // Parameters: [out] VmbPixelFormatType &pixelFormat The GeV pixel format 00241 // 00242 IMEXPORT VmbErrorType GetPixelFormat( VmbPixelFormatType &pixelFormat ) const; 00243 00244 // 00245 // Method: GetWidth() 00246 // 00247 // Purpose: Returns the width of the image 00248 // 00249 // Returns: 00250 // 00251 // - VmbErrorSuccess: If no error 00252 // 00253 // Parameters: [out] VmbUint32_t &width The width in pixels 00254 // 00255 IMEXPORT VmbErrorType GetWidth( VmbUint32_t &width ) const; 00256 00257 // 00258 // Method: GetHeight() 00259 // 00260 // Purpose: Returns the height of the image 00261 // 00262 // Returns: 00263 // 00264 // - VmbErrorSuccess: If no error 00265 // 00266 // Parameters: [out] VmbUint32_t &height The height in pixels 00267 // 00268 IMEXPORT VmbErrorType GetHeight( VmbUint32_t &height ) const; 00269 00270 // 00271 // Method: GetOffsetX() 00272 // 00273 // Purpose: Returns the x offset of the image 00274 // 00275 // Returns: 00276 // 00277 // - VmbErrorSuccess: If no error 00278 // 00279 // Parameters: [out] VmbUint32_t &offsetX The x offset in pixels 00280 // 00281 IMEXPORT VmbErrorType GetOffsetX( VmbUint32_t &offsetX ) const; 00282 00283 // 00284 // Method: GetOffsetY() 00285 // 00286 // Purpose: Returns the y offset of the image 00287 // 00288 // Returns: 00289 // 00290 // - VmbErrorSuccess: If no error 00291 // 00292 // Parameters: [out] VmbUint32_t &offsetY The y offset in pixels 00293 // 00294 IMEXPORT VmbErrorType GetOffsetY( VmbUint32_t &offsetY ) const; 00295 00296 // 00297 // Method: GetFrameID() 00298 // 00299 // Purpose: Returns the frame ID 00300 // 00301 // Returns: 00302 // 00303 // - VmbErrorSuccess: If no error 00304 // 00305 // Parameters: [out] VmbUint64_t &frameID The frame ID 00306 // 00307 IMEXPORT VmbErrorType GetFrameID( VmbUint64_t &frameID ) const; 00308 00309 // 00310 // Method: GetTimeStamp() 00311 // 00312 // Purpose: Returns the time stamp 00313 // 00314 // Returns: 00315 // 00316 // - VmbErrorSuccess: If no error 00317 // 00318 // Parameters: [out] VmbUint64_t ×tamp The time stamp 00319 // 00320 IMEXPORT VmbErrorType GetTimestamp( VmbUint64_t ×tamp ) const; 00321 00322 bool GetObserver( IFrameObserverPtr &observer ) const; 00323 00324 private: 00325 struct Impl; 00326 Impl *m_pImpl; 00327 00328 // No default ctor 00329 Frame(); 00330 // No copy ctor 00331 Frame( Frame& ); 00332 // No assignment operator 00333 Frame& operator=( const Frame& ); 00334 }; 00335 00336 typedef std::vector<FramePtr> FramePtrVector; 00337 00338 }} // namespace AVT::VmbAPI 00339 00340 #endif