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 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 Interface::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 Interface::GetSerialNumber( std::string &rStrSerial ) const 00085 { 00086 VmbErrorType res; 00087 VmbUint32_t nLength; 00088 00089 res = GetSerialNumber( NULL, nLength ); 00090 if ( VmbErrorSuccess == res ) 00091 { 00092 if ( 0 < nLength ) 00093 { 00094 rStrSerial.resize( nLength ); 00095 res = GetSerialNumber( &rStrSerial[0], nLength ); 00096 } 00097 else 00098 { 00099 rStrSerial.clear(); 00100 } 00101 } 00102 00103 return res; 00104 } 00105 00106 #endif