Feature.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:        Feature.hpp
00010 
00011   Description: Inline wrapper functions for class AVT::VmbAPI::Feature.
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_FEATURE_HPP
00029 #define AVT_VMBAPI_FEATURE_HPP
00030 
00031 //
00032 // Inline wrapper functions that allocate memory for STL objects in the application's context
00033 // and to pass data across DLL boundaries using arrays
00034 //
00035 inline VmbErrorType Feature::GetValues( StringVector &rValues )
00036 {
00037     VmbErrorType res;
00038     VmbUint32_t nSize;
00039     std::vector<const char*> data;
00040 
00041     res = GetValues( (const char **)NULL, nSize );
00042     if (    VmbErrorSuccess == res
00043         &&  0 < nSize )
00044     {
00045         data.resize( nSize );
00046 
00047         res = GetValues( &data[0], nSize );
00048     }
00049 
00050     if ( VmbErrorSuccess == res )
00051     {
00052         rValues.clear();
00053 
00054         for (   std::vector<const char*>::iterator iter = data.begin();
00055                 data.end() != iter;
00056                 ++iter )
00057         {
00058             rValues.push_back( std::string( *iter ));
00059         }
00060     }
00061 
00062     return res;
00063 }
00064 
00065 inline VmbErrorType Feature::GetEntries( EnumEntryVector &rEntries )
00066 {
00067     VmbErrorType res;
00068     VmbUint32_t nSize;
00069 
00070     res = GetEntries( (EnumEntry*)NULL, nSize );
00071     if (    VmbErrorSuccess == res
00072          && 0 < nSize )
00073     {
00074         rEntries.resize( nSize );
00075 
00076         res = GetEntries( &rEntries[0], nSize );
00077     }
00078 
00079     return res;
00080 }
00081 
00082 inline VmbErrorType Feature::GetValues( Int64Vector &rValues )
00083 {
00084     VmbErrorType res;
00085     VmbUint32_t nSize;
00086 
00087     res = GetValues( (VmbInt64_t*)NULL, nSize );
00088     if (    VmbErrorSuccess == res
00089          && 0 < nSize )
00090     {
00091         rValues.resize( nSize );
00092 
00093         res = GetValues( &rValues[0], nSize );
00094     }
00095 
00096     return res;
00097 }
00098 
00099 inline VmbErrorType Feature::GetValue( std::string &rStrValue ) const
00100 {
00101     VmbErrorType res;
00102     VmbUint32_t nLength;
00103 
00104     res = GetValue( (char * const)NULL, nLength );
00105     if ( VmbErrorSuccess == res )
00106     {
00107         if ( 0 < nLength )
00108         {
00109             rStrValue.resize( nLength );
00110             res = GetValue( &rStrValue[0], nLength );
00111             if ( VmbErrorSuccess == res )
00112             {
00113                 size_t nPos = rStrValue.find( '\0' );
00114                 if ( nLength-1 > nPos )
00115                 {
00116                     rStrValue.resize( nPos );
00117                 }
00118             }
00119         }
00120         else
00121         {
00122             rStrValue.clear();
00123         }
00124     }
00125 
00126     return res;
00127 }
00128 
00129 inline VmbErrorType Feature::GetValue( UcharVector &rValue ) const
00130 {
00131     VmbUint32_t i;
00132     return GetValue( rValue, i );
00133 }
00134 inline VmbErrorType Feature::GetValue( UcharVector &rValue, VmbUint32_t &rnSizeFilled ) const
00135 {
00136     VmbErrorType res;
00137     VmbUint32_t nSize;
00138 
00139     res = GetValue( NULL, nSize, rnSizeFilled );
00140     if ( VmbErrorSuccess == res )
00141     {
00142         rValue.resize( nSize );
00143         res = GetValue( &rValue[0], nSize, rnSizeFilled );
00144     }
00145 
00146     return res;
00147 }
00148 
00149 inline VmbErrorType Feature::SetValue( const UcharVector &rValue )
00150 {
00151     if ( rValue.empty() )
00152     {
00153         return VmbErrorBadParameter;
00154     }
00155     return SetValue( &rValue[0], (VmbUint32_t)rValue.size() );
00156 }
00157 
00158 inline VmbErrorType Feature::GetName( std::string &rStrName ) const
00159 {
00160     VmbErrorType res;
00161     VmbUint32_t nLength;
00162 
00163     res = GetName( NULL, nLength );
00164     if ( VmbErrorSuccess == res )
00165     {
00166         if ( 0 < nLength )
00167         {
00168             rStrName.resize( nLength );
00169             res = GetName( &rStrName[0], nLength );
00170         }
00171         else
00172         {
00173             rStrName.clear();
00174         }
00175     }
00176 
00177     return res;
00178 }
00179 
00180 inline VmbErrorType Feature::GetDisplayName( std::string &rStrDisplayName ) const
00181 {
00182     VmbErrorType res;
00183     VmbUint32_t nLength;
00184 
00185     res = GetDisplayName( NULL, nLength );
00186     if ( VmbErrorSuccess == res )
00187     {
00188         if ( 0 < nLength )
00189         {
00190             rStrDisplayName.resize( nLength );
00191             res = GetDisplayName( &rStrDisplayName[0], nLength );
00192         }
00193         else
00194         {
00195             rStrDisplayName.clear();
00196         }
00197     }
00198 
00199     return res;
00200 }
00201 
00202 inline VmbErrorType Feature::GetCategory( std::string &rStrCategory ) const
00203 {
00204     VmbErrorType res;
00205     VmbUint32_t nLength;
00206 
00207     res = GetCategory( NULL, nLength );
00208     if ( VmbErrorSuccess == res )
00209     {
00210         if ( 0 < nLength )
00211         {
00212             rStrCategory.resize( nLength );
00213             res = GetCategory( &rStrCategory[0], nLength );
00214         }
00215         else
00216         {
00217             rStrCategory.clear();
00218         }
00219     }
00220 
00221     return res;
00222 }
00223 
00224 inline VmbErrorType Feature::GetUnit( std::string &rStrUnit ) const
00225 {
00226     VmbErrorType res;
00227     VmbUint32_t nLength;
00228 
00229     res = GetUnit( NULL, nLength );
00230     if ( VmbErrorSuccess == res )
00231     {
00232         if ( 0 < nLength )
00233         {
00234             rStrUnit.resize( nLength );
00235             res = GetUnit( &rStrUnit[0], nLength );
00236         }
00237         else
00238         {
00239             rStrUnit.clear();
00240         }
00241     }
00242 
00243     return res;
00244 }
00245 
00246 inline VmbErrorType Feature::GetRepresentation( std::string &rStrRepresentation ) const
00247 {
00248     VmbErrorType res;
00249     VmbUint32_t nLength;
00250 
00251     res = GetRepresentation( NULL, nLength );
00252     if ( VmbErrorSuccess == res )
00253     {
00254         if ( 0 < nLength )
00255         {
00256             rStrRepresentation.resize( nLength );
00257             res = GetRepresentation( &rStrRepresentation[0], nLength );
00258         }
00259         else
00260         {
00261             rStrRepresentation.clear();
00262         }
00263     }
00264 
00265     return res;
00266 }
00267 
00268 inline VmbErrorType Feature::GetToolTip( std::string &rStrToolTip ) const
00269 {
00270     VmbErrorType res;
00271     VmbUint32_t nLength;
00272 
00273     res = GetToolTip( NULL, nLength );
00274     if ( VmbErrorSuccess == res )
00275     {
00276         if ( 0 < nLength )
00277         {
00278             rStrToolTip.resize( nLength );
00279             res = GetToolTip( &rStrToolTip[0], nLength );
00280         }
00281         else
00282         {
00283             rStrToolTip.clear();
00284         }
00285     }
00286 
00287     return res;
00288 }
00289 
00290 inline VmbErrorType Feature::GetDescription( std::string &rStrDescription ) const
00291 {
00292     VmbErrorType res;
00293     VmbUint32_t nLength;
00294 
00295     res = GetDescription( NULL, nLength );
00296     if ( VmbErrorSuccess == res )
00297     {
00298         if ( 0 < nLength )
00299         {
00300             rStrDescription.resize( nLength );
00301             res = GetDescription( &rStrDescription[0], nLength );
00302         }
00303         else
00304         {
00305             rStrDescription.clear();
00306         }
00307     }
00308 
00309     return res;
00310 }
00311 
00312 inline VmbErrorType Feature::GetSFNCNamespace( std::string &rStrSFNCNamespace ) const
00313 {
00314     VmbErrorType res;
00315     VmbUint32_t nLength;
00316 
00317     res = GetSFNCNamespace( NULL, nLength );
00318     if ( VmbErrorSuccess == res )        
00319     {
00320         if ( 0 < nLength )
00321         {
00322             rStrSFNCNamespace.resize( nLength );
00323             res = GetSFNCNamespace( &rStrSFNCNamespace[0], nLength );
00324         }
00325         else
00326         {
00327             rStrSFNCNamespace.clear();
00328         }
00329     }
00330 
00331     return res;
00332 }
00333 
00334 inline VmbErrorType Feature::GetAffectedFeatures( FeaturePtrVector &rAffectedFeatures )
00335 {
00336     VmbErrorType res;
00337     VmbUint32_t nSize;
00338 
00339     res = GetAffectedFeatures( NULL, nSize );
00340     if (    VmbErrorSuccess == res
00341         && 0 < nSize )
00342     {
00343         rAffectedFeatures.resize( nSize );
00344         res = GetAffectedFeatures( &rAffectedFeatures[0], nSize );
00345     }
00346 
00347     return res;
00348 }
00349 
00350 inline VmbErrorType Feature::GetSelectedFeatures( FeaturePtrVector &rselectedFeatures )
00351 {
00352     VmbErrorType res;
00353     VmbUint32_t nSize;
00354 
00355     res = GetSelectedFeatures( NULL, nSize );
00356     if (    VmbErrorSuccess == res
00357          && 0 < nSize )
00358     {
00359         rselectedFeatures.resize( nSize );
00360         res = GetSelectedFeatures( &rselectedFeatures[0], nSize );
00361     }
00362 
00363     return res;
00364 }
00365 
00366 #endif


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