Camera.hpp
Go to the documentation of this file.
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:        Camera.hpp
00010 
00011   Description: Inline wrapper functions for class AVT::VmbAPI::Camera.
00012                (This include file is for internal use only.)
00013 
00014 -------------------------------------------------------------------------------
00015 
00016   THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
00017   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
00018   NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR  PURPOSE ARE
00019   DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
00020   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00021   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
00023   AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
00024   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00025   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 =============================================================================*/
00028 
00029 #ifndef AVT_VMBAPI_CAMERA_HPP
00030 #define AVT_VMBAPI_CAMERA_HPP
00031 
00032 //
00033 // Inline wrapper functions that allocate memory for STL objects in the application's context
00034 // and to pass data across DLL boundaries using arrays
00035 //
00036 
00037 // HINT: This information remains static throughout the object's lifetime
00038 inline VmbErrorType Camera::GetID( std::string &rStrID ) const
00039 {
00040     VmbErrorType res;
00041     VmbUint32_t nLength;
00042 
00043     res = GetID( NULL, nLength );
00044     if ( VmbErrorSuccess == res )
00045     {
00046         if ( 0 < nLength )
00047         {
00048             rStrID.resize( nLength );
00049             res = GetID( &rStrID[0], nLength );
00050         }
00051         else
00052         {
00053             rStrID.clear();
00054         }
00055     }
00056 
00057     return res;
00058 }
00059 
00060 // HINT: This information remains static throughout the object's lifetime
00061 inline VmbErrorType Camera::GetName( std::string &rStrName ) const
00062 {
00063     VmbErrorType res;
00064     VmbUint32_t nLength;
00065 
00066     res = GetName( NULL, nLength );
00067     if ( VmbErrorSuccess == res )
00068     {
00069         if ( 0 < nLength )
00070         {
00071             rStrName.resize( nLength );
00072             res = GetName( &rStrName[0], nLength );
00073         }
00074         else
00075         {
00076             rStrName.clear();
00077         }
00078     }
00079 
00080     return res;
00081 }
00082 
00083 // HINT: This information remains static throughout the object's lifetime
00084 inline VmbErrorType Camera::GetModel( std::string &rStrModel ) const
00085 {
00086     VmbErrorType res;
00087     VmbUint32_t nLength;
00088 
00089     res = GetModel( NULL, nLength );
00090     if ( VmbErrorSuccess == res )
00091     {
00092         if ( 0 < nLength )
00093         {
00094             rStrModel.resize( nLength );
00095             res = GetModel( &rStrModel[0], nLength );
00096         }
00097         else
00098         {
00099             rStrModel.clear();
00100         }
00101     }
00102 
00103     return res;
00104 }
00105 
00106 // HINT: This information remains static throughout the object's lifetime
00107 inline VmbErrorType Camera::GetSerialNumber( std::string &rStrSerial ) const
00108 {
00109     VmbErrorType res;
00110     VmbUint32_t nLength;
00111 
00112     res = GetSerialNumber( NULL, nLength );
00113     if ( VmbErrorSuccess == res )
00114     {
00115         if ( 0 < nLength )
00116         {
00117             rStrSerial.resize( nLength );
00118             res = GetSerialNumber( &rStrSerial[0], nLength );
00119         }
00120         else
00121         {
00122             rStrSerial.clear();
00123         }
00124     }
00125 
00126     return res;
00127 }
00128 
00129 // HINT: This information remains static throughout the object's lifetime
00130 inline VmbErrorType Camera::GetInterfaceID( std::string &rStrInterfaceID ) const
00131 {
00132     VmbErrorType res;
00133     VmbUint32_t nLength;
00134 
00135     res = GetInterfaceID( NULL, nLength );
00136     if ( VmbErrorSuccess == res )
00137     {
00138         if ( 0 < nLength )
00139         {
00140             rStrInterfaceID.resize( nLength );
00141             res = GetInterfaceID( &rStrInterfaceID[0], nLength );
00142         }
00143         else
00144         {
00145             rStrInterfaceID.clear();
00146         }
00147     }
00148 
00149     return res;
00150 }
00151 
00152 inline VmbErrorType Camera::AcquireMultipleImages( FramePtrVector &rFrames, VmbUint32_t nTimeout )
00153 {
00154     VmbErrorType res;
00155     VmbUint32_t i;
00156     res = AcquireMultipleImages( rFrames, nTimeout, i );
00157     if ( rFrames.size() != i )
00158     {
00159         res = VmbErrorInternalFault;
00160     }
00161     
00162     return res;
00163 }
00164 inline VmbErrorType Camera::AcquireMultipleImages( FramePtrVector &rFrames, VmbUint32_t nTimeout, VmbUint32_t &rNumFramesCompleted )
00165 {
00166     if ( true == rFrames.empty() )
00167     {
00168         return VmbErrorBadParameter;
00169     }
00170 
00171     return AcquireMultipleImages( &rFrames[0], (VmbUint32_t)rFrames.size(), nTimeout, &rNumFramesCompleted );
00172 }
00173 
00174 // HINT: Size of address determines how many registers to read. Size of data has to be large enough to hold the requested information
00175 inline VmbErrorType Camera::ReadRegisters( const Uint64Vector &rAddresses, Uint64Vector &rBuffer ) const
00176 {
00177     VmbUint32_t i;
00178     return ReadRegisters( rAddresses, rBuffer, i );
00179 }
00180 inline VmbErrorType Camera::ReadRegisters( const Uint64Vector &rAddresses, Uint64Vector &rBuffer, VmbUint32_t &rCompletedReads ) const
00181 {
00182     if (    true == rAddresses.empty()
00183          || true == rBuffer.empty()
00184          || rAddresses.size() != rBuffer.size() )
00185     {
00186         return VmbErrorBadParameter;
00187     }
00188 
00189     return ReadRegisters( &rAddresses[0], (VmbUint32_t)rAddresses.size(), &rBuffer[0], &rCompletedReads );
00190 }        
00191 
00192 // HINT: Size of address determines how many registers to write.
00193 inline VmbErrorType Camera::WriteRegisters( const Uint64Vector &rAddresses, const Uint64Vector &rBuffer )
00194 {
00195     VmbUint32_t i;
00196     return WriteRegisters( rAddresses, rBuffer, i );
00197 }
00198 inline VmbErrorType Camera::WriteRegisters( const Uint64Vector &rAddresses, const Uint64Vector &rBuffer, VmbUint32_t &rCompletedWrites )
00199 {
00200     if (    true == rAddresses.empty()
00201          || true == rBuffer.empty()
00202          || rAddresses.size() != rBuffer.size() )
00203     {
00204         return VmbErrorBadParameter;
00205     }
00206 
00207     return WriteRegisters( &rAddresses[0], (VmbUint32_t)rAddresses.size(), &rBuffer[0], &rCompletedWrites );
00208 }
00209 
00210 // HINT: Size of buffer determines how many bytes to read.
00211 inline VmbErrorType Camera::ReadMemory( const VmbUint64_t &rAddress, UcharVector &rBuffer ) const
00212 {
00213     VmbUint32_t i;
00214     return ReadMemory( rAddress, rBuffer, i );
00215 }
00216 inline VmbErrorType Camera::ReadMemory( const VmbUint64_t &rAddress, UcharVector &rBuffer, VmbUint32_t &rCompletedReads ) const
00217 {
00218     if ( true == rBuffer.empty() )
00219     {
00220         return VmbErrorBadParameter;
00221     }
00222 
00223     return ReadMemory( rAddress, &rBuffer[0], (VmbUint32_t)rBuffer.size(), &rCompletedReads );
00224 }
00225 
00226 // HINT: Size of buffer determines how many bytes to write.
00227 inline VmbErrorType Camera::WriteMemory( const VmbUint64_t &rAddress, const UcharVector &rBuffer )
00228 {
00229     VmbUint32_t i;
00230     return WriteMemory( rAddress, rBuffer, i );
00231 }
00232 inline VmbErrorType Camera::WriteMemory( const VmbUint64_t &rAddress, const UcharVector &rBuffer, VmbUint32_t &rCompletedWrites )
00233 {
00234     if ( true == rBuffer.empty() )
00235     {
00236         return VmbErrorBadParameter;
00237     }
00238 
00239     return WriteMemory( rAddress, &rBuffer[0], (VmbUint32_t)rBuffer.size(), &rCompletedWrites );
00240 }
00241 
00242 #endif


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Thu Aug 27 2015 12:29:49