Interface.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:        Interface.hpp
00010 
00011   Description: Inline wrapper functions for class AVT::VmbAPI::Interface.
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_INTERFACE_HPP
00030 #define AVT_VMBAPI_INTERFACE_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 Interface::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             try
00049             {
00050                 std::vector<std::string::value_type> tmpID( nLength + 1, '\0' );
00051                 res     = GetID( &tmpID[0], nLength );
00052                 if( VmbErrorSuccess == res )
00053                 {
00054                     rStrID  = &*tmpID.begin();
00055                 }
00056             }
00057             catch(...)
00058             {
00059                 return VmbErrorResources;
00060             }
00061         }
00062         else
00063         {
00064             rStrID.clear();
00065         }
00066     }
00067 
00068     return res;
00069 }
00070 
00071 // HINT: This information remains static throughout the object's lifetime
00072 inline VmbErrorType Interface::GetName( std::string &rStrName ) const
00073 {
00074     VmbErrorType    res;
00075     VmbUint32_t     nLength;
00076 
00077     res = GetName( NULL, nLength );
00078     if ( VmbErrorSuccess == res )
00079     {
00080         if( 0 != nLength )
00081         {
00082             try
00083             {
00084                 std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
00085                 res         = GetName( &tmpName[0], nLength );
00086                 if( VmbErrorSuccess == res )
00087                 {
00088                     rStrName    = &*tmpName.begin();
00089                 }
00090             }
00091             catch(...)
00092             {
00093                 return VmbErrorResources;
00094             }
00095         }
00096         else
00097         {
00098             rStrName.clear();
00099         }
00100     }
00101 
00102     return res;
00103 }
00104 
00105 // HINT: This information remains static throughout the object's lifetime
00106 inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
00107 {
00108     VmbErrorType    res;
00109     VmbUint32_t     nLength;
00110 
00111     res = GetSerialNumber( NULL, nLength );
00112     if ( VmbErrorSuccess == res )
00113     {
00114         if( 0 != nLength)
00115         {
00116             try
00117             {
00118                 std::vector<std::string::value_type> tmpSerial( nLength + 1, '\0');
00119                 res         = GetSerialNumber( &tmpSerial[0], nLength );
00120                 if( VmbErrorSuccess == res )
00121                 {
00122                     rStrSerial  = &*tmpSerial.begin();
00123                 }
00124             }
00125             catch(...)
00126             {
00127                 return VmbErrorResources;
00128             }
00129         }
00130         else
00131         {
00132             rStrSerial.clear();
00133         }
00134     }
00135 
00136     return res;
00137 }
00138 
00139 #endif


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Thu Jun 6 2019 18:23:39