EnumEntry.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:        EnumEntry.hpp
00010 
00011   Description: Inline wrapper functions for class AVT::VmbAPI::EnumEntry.
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_ENUMENTRY_HPP
00029 #define AVT_VMBAPI_ENUMENTRY_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 EnumEntry::GetName( std::string &rStrName ) const
00036 {
00037     VmbErrorType res;
00038     VmbUint32_t nLength;
00039 
00040     res = GetName( NULL, nLength );
00041     if ( VmbErrorSuccess == res )
00042     {
00043         if ( 0 != nLength )
00044         {
00045             try
00046             {
00047                 std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
00048                 res = GetName( &tmpName[0], nLength );
00049                 if ( VmbErrorSuccess == res )
00050                 {
00051                     rStrName = &*tmpName.begin();
00052                 }
00053             }
00054             catch(...)
00055             {
00056                 return VmbErrorResources;
00057             }
00058         }
00059         else
00060         {
00061             rStrName.clear();
00062         }
00063     }
00064 
00065     return res;
00066 }
00067 
00068 inline VmbErrorType EnumEntry::GetDisplayName( std::string &rStrDisplayName ) const
00069 {
00070     VmbErrorType res;
00071     VmbUint32_t nLength;
00072 
00073     res = GetDisplayName( NULL, nLength );
00074     if ( VmbErrorSuccess == res )
00075     {
00076         if ( 0 != nLength )
00077         {
00078             try
00079             {
00080                 std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
00081                 res = GetDisplayName( &tmpName[0], nLength );
00082                 if ( VmbErrorSuccess == res )
00083                 {
00084                     rStrDisplayName = &*tmpName.begin();
00085                 }
00086             }
00087             catch(...)
00088             {
00089                 return VmbErrorResources;
00090             }
00091         }
00092         else
00093         {
00094             rStrDisplayName.clear();
00095         }
00096     }
00097 
00098     return res;
00099 }
00100 
00101 inline VmbErrorType EnumEntry::GetDescription( std::string &rStrDescription ) const
00102 {
00103     VmbErrorType res;
00104     VmbUint32_t nLength;
00105 
00106     res = GetDescription( NULL, nLength );
00107     if ( VmbErrorSuccess == res )
00108     {
00109         if ( 0 != nLength )
00110         {
00111             try
00112             {
00113                 std::vector<std::string::value_type> tmpDescription( nLength + 1, '\0' );
00114                 res = GetDescription( &tmpDescription[0], nLength );
00115                 if ( VmbErrorSuccess == res )
00116                 {
00117                     rStrDescription = &*tmpDescription.begin();
00118                 }
00119             }
00120             catch(...)
00121             {
00122                 return VmbErrorResources;
00123             }
00124         }
00125         else
00126         {
00127             rStrDescription.clear();
00128         }
00129     }
00130 
00131     return res;
00132 }
00133 
00134 inline VmbErrorType EnumEntry::GetTooltip( std::string &rStrTooltip ) const
00135 {
00136     VmbErrorType res;
00137     VmbUint32_t nLength;
00138 
00139     res = GetTooltip( NULL, nLength );
00140     if ( VmbErrorSuccess == res )
00141     {
00142         if ( 0 != nLength )
00143         {
00144             try
00145             {
00146                 std::vector<std::string::value_type> tmpTooltip( nLength + 1, '\0' );
00147                 res = GetTooltip( &tmpTooltip[0], nLength );
00148                 if ( VmbErrorSuccess == res )
00149                 {
00150                     rStrTooltip = &*tmpTooltip.begin();
00151                 }
00152             }
00153             catch(...)
00154             {
00155                 return VmbErrorResources;
00156             }
00157         }
00158         else
00159         {
00160             rStrTooltip.clear();
00161         }
00162     }
00163 
00164     return res;
00165 }
00166 
00167 inline VmbErrorType EnumEntry::GetSFNCNamespace( std::string &rStrNamespace ) const
00168 {
00169     VmbErrorType res;
00170     VmbUint32_t nLength;
00171 
00172     res = GetSFNCNamespace( NULL, nLength );
00173     if ( VmbErrorSuccess == res )
00174     {
00175         if ( 0 != nLength )
00176         {
00177             try
00178             {
00179                 std::vector<std::string::value_type> tmpNamespace( nLength + 1, '\0' );
00180                 res = GetSFNCNamespace( &tmpNamespace[0], nLength );
00181                 if ( VmbErrorSuccess == res )
00182                 {
00183                     rStrNamespace =&*tmpNamespace.begin();
00184                 }
00185             }
00186             catch(...)
00187             {
00188                 return VmbErrorResources;
00189             }
00190         }
00191         else
00192         {
00193             rStrNamespace.clear();
00194         }
00195     }
00196 
00197     return res;
00198 }
00199 
00200 #endif


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