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: FeatureContainer.hpp 00010 00011 Description: Inline wrapper functions for class 00012 AVT::VmbAPI::FeatureContainer. 00013 (This include file is for internal use only.) 00014 00015 ------------------------------------------------------------------------------- 00016 00017 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 00018 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 00019 NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00020 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00021 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00024 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00025 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00026 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 00028 =============================================================================*/ 00029 00030 #ifndef AVT_VMBAPI_FEATURECONTAINER_HPP 00031 #define AVT_VMBAPI_FEATURECONTAINER_HPP 00032 00033 // 00034 // Inline wrapper functions that allocate memory for STL objects in the application's context 00035 // and to pass data across DLL boundaries using arrays 00036 // 00037 00038 // HINT: Once queried this information remains static throughout the object's lifetime 00039 inline VmbErrorType FeatureContainer::GetFeatures( FeaturePtrVector &features ) 00040 { 00041 VmbErrorType res; 00042 VmbUint32_t nSize; 00043 00044 res = GetFeatures( NULL, nSize ); 00045 if ( VmbErrorSuccess == res ) 00046 { 00047 if( 0 != nSize) 00048 { 00049 try 00050 { 00051 FeaturePtrVector tmpFeatures( nSize ); 00052 res = GetFeatures( &tmpFeatures[0], nSize ); 00053 if( VmbErrorSuccess == res) 00054 { 00055 features.swap( tmpFeatures ); 00056 } 00057 } 00058 catch(...) 00059 { 00060 return VmbErrorResources; 00061 } 00062 } 00063 else 00064 { 00065 features.clear(); 00066 } 00067 } 00068 00069 return res; 00070 } 00071 00072 #endif