EnumEntry.cpp
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.cpp
00010 
00011   Description: Implementation of 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 #include <VimbaCPP/Include/EnumEntry.h>
00029 
00030 namespace AVT {
00031 namespace VmbAPI {
00032 
00033 struct EnumEntry::PrivateImpl
00034 {
00035     std::string                 m_strName;
00036     std::string                 m_strDisplayName;
00037     std::string                 m_strDescription;
00038     std::string                 m_strTooltip;
00039     std::string                 m_strNamespace;
00040     VmbFeatureVisibilityType    m_Visibility;
00041     VmbInt64_t                  m_nValue;
00042     PrivateImpl(    const char              *pStrName,
00043                     const char              *pStrDisplayName,
00044                     const char              *pStrDescription,
00045                     const char              *pStrTooltip,
00046                     const char              *pStrSNFCNamespace,
00047                     VmbFeatureVisibility_t  visibility,
00048                     VmbInt64_t              nValue)
00049         : m_nValue( nValue )
00050         , m_Visibility ( (VmbFeatureVisibilityType)visibility )
00051     {
00052         m_strName           = pStrName          != NULL ? std::string( pStrName ) : "";
00053         m_strDisplayName    = pStrDisplayName   != NULL ? std::string( pStrDisplayName ) : "";
00054         m_strDescription    = pStrDescription   != NULL ? std::string( pStrDescription ) : "";
00055         m_strTooltip        = pStrTooltip       != NULL ? std::string( pStrTooltip ) : "";
00056         m_strNamespace      = pStrSNFCNamespace != NULL ? std::string( pStrSNFCNamespace ) : "";
00057     }
00058     VmbErrorType GetName( char * const pStrName, VmbUint32_t &rnSize ) const
00059     {
00060         VmbErrorType res;
00061 
00062         if ( NULL == pStrName )
00063         {
00064             rnSize = static_cast<VmbUint32_t>( m_strName.size() );
00065             res = VmbErrorSuccess;
00066         }
00067         else if ( m_strName.size() <= rnSize )
00068         {
00069             std::copy( m_strName.begin(), m_strName.end(), pStrName );
00070             rnSize = static_cast<VmbUint32_t>( m_strName.size() );
00071             res = VmbErrorSuccess;
00072         }
00073         else
00074         {
00075             res = VmbErrorMoreData;
00076         }
00077 
00078         return res;
00079     }
00080 
00081     VmbErrorType GetDisplayName( char * const pStrDisplayName, VmbUint32_t &rnSize ) const
00082     {
00083         VmbErrorType res;
00084 
00085         if ( NULL == pStrDisplayName )
00086         {
00087             rnSize = static_cast<VmbUint32_t>( m_strDisplayName.size() );
00088             res = VmbErrorSuccess;
00089         }
00090         else if ( m_strDisplayName.size() <= rnSize )
00091         {
00092             std::copy( m_strDisplayName.begin(), m_strDisplayName.end(), pStrDisplayName );
00093             rnSize = static_cast<VmbUint32_t>( m_strDisplayName.size() );
00094             res = VmbErrorSuccess;
00095         }
00096         else
00097         {
00098             res = VmbErrorMoreData;
00099         }
00100 
00101         return res;
00102     }
00103 
00104     VmbErrorType GetDescription( char * const pStrDescription, VmbUint32_t &rnSize ) const
00105     {
00106         VmbErrorType res;
00107 
00108         if ( NULL == pStrDescription )
00109         {
00110             rnSize = static_cast<VmbUint32_t>( m_strDescription.size() );
00111             res = VmbErrorSuccess;
00112         }
00113         else if ( m_strDescription.size() <= rnSize )
00114         {
00115             std::copy( m_strDescription.begin(), m_strDescription.end(), pStrDescription );
00116             rnSize = static_cast<VmbUint32_t>( m_strDescription.size() );
00117             res = VmbErrorSuccess;
00118         }
00119         else
00120         {
00121             res = VmbErrorMoreData;
00122         }
00123 
00124         return res;
00125     }
00126 
00127     VmbErrorType GetTooltip( char * const pStrTooltip, VmbUint32_t &rnSize ) const
00128     {
00129         VmbErrorType res;
00130 
00131         if ( NULL == pStrTooltip )
00132         {
00133             rnSize = static_cast<VmbUint32_t>( m_strTooltip.size() );
00134             res = VmbErrorSuccess;
00135         }
00136         else if ( m_strTooltip.size() <= rnSize )
00137         {
00138             std::copy( m_strTooltip.begin(), m_strTooltip.end(), pStrTooltip );
00139             rnSize = static_cast<VmbUint32_t>( m_strTooltip.size() );
00140             res = VmbErrorSuccess;
00141         }
00142         else
00143         {
00144             res = VmbErrorMoreData;
00145         }
00146 
00147         return res;
00148     }
00149 
00150     VmbErrorType GetSFNCNamespace( char * const pStrNamespace, VmbUint32_t &rnSize ) const
00151     {
00152         VmbErrorType res;
00153 
00154         if ( NULL == pStrNamespace )
00155         {
00156             rnSize = static_cast<VmbUint32_t>( m_strNamespace.size() );
00157             res = VmbErrorSuccess;
00158         }
00159         else if ( m_strNamespace.size() <= rnSize )
00160         {
00161             std::copy( m_strNamespace.begin(), m_strNamespace.end(), pStrNamespace );
00162             rnSize = static_cast<VmbUint32_t>( m_strNamespace.size() );
00163             res = VmbErrorSuccess;
00164         }
00165         else
00166         {
00167             res = VmbErrorMoreData;
00168         }
00169 
00170         return res;
00171     }
00172 
00173     VmbErrorType GetValue( VmbInt64_t &rnValue ) const
00174     {
00175         rnValue = m_nValue;
00176 
00177         return VmbErrorSuccess;
00178     }
00179 
00180     VmbErrorType GetVisibility( VmbFeatureVisibilityType &rVisibility ) const
00181     {
00182         rVisibility = m_Visibility;
00183 
00184         return VmbErrorSuccess;
00185     }
00186 
00187 
00188 };
00189 EnumEntry::EnumEntry(   const char              *pStrName,
00190                         const char              *pStrDisplayName,
00191                         const char              *pStrDescription,
00192                         const char              *pStrTooltip,
00193                         const char              *pStrSNFCNamespace,
00194                         VmbFeatureVisibility_t  visibility,
00195                         VmbInt64_t              nValue)
00196     : m_pImpl( new PrivateImpl(pStrName, pStrDisplayName, pStrDescription, pStrTooltip, pStrSNFCNamespace, visibility, nValue) )
00197 {
00198 }
00199 EnumEntry::EnumEntry( const EnumEntry &other)
00200     : m_pImpl( NULL == other.m_pImpl ? NULL : new PrivateImpl( *other.m_pImpl) )
00201 {
00202 }
00203 EnumEntry& EnumEntry::operator=( const EnumEntry&other)
00204 {
00205     if( this != &other)
00206     {
00207         PrivateImpl *tmp = NULL == other.m_pImpl ? NULL : new PrivateImpl(*other.m_pImpl);
00208         if( NULL != tmp)
00209         {
00210             delete m_pImpl;
00211             m_pImpl = tmp;
00212         }
00213     }
00214     return *this;
00215 }
00216 EnumEntry::EnumEntry()
00217     : m_pImpl()
00218 {
00219     // No default ctor
00220 }
00221 
00222 EnumEntry::~EnumEntry()
00223 {
00224     if( NULL != m_pImpl)
00225     {
00226         delete m_pImpl;
00227         m_pImpl = NULL;
00228     }
00229 }
00230 
00231 VmbErrorType EnumEntry::GetName( char * const pStrName, VmbUint32_t &rnSize ) const
00232 {
00233     if( NULL == m_pImpl )
00234     {
00235         return VmbErrorInternalFault;
00236     }
00237     return m_pImpl->GetName( pStrName, rnSize );
00238 }
00239 
00240 VmbErrorType EnumEntry::GetDisplayName( char * const pStrDisplayName, VmbUint32_t &rnSize ) const
00241 {
00242     if( NULL == m_pImpl )
00243     {
00244         return VmbErrorInternalFault;
00245     }
00246     return m_pImpl->GetDisplayName( pStrDisplayName, rnSize);
00247 }
00248 
00249 VmbErrorType EnumEntry::GetDescription( char * const pStrDescription, VmbUint32_t &rnSize ) const
00250 {
00251     if( NULL == m_pImpl )
00252     {
00253         return VmbErrorInternalFault;
00254     }
00255     return m_pImpl->GetDescription( pStrDescription, rnSize);
00256 }
00257 
00258 VmbErrorType EnumEntry::GetTooltip( char * const pStrTooltip, VmbUint32_t &rnSize ) const
00259 {
00260     if( NULL == m_pImpl )
00261     {
00262         return VmbErrorInternalFault;
00263     }
00264     return  m_pImpl->GetTooltip( pStrTooltip, rnSize );
00265 }
00266 
00267 VmbErrorType EnumEntry::GetSFNCNamespace( char * const pStrNamespace, VmbUint32_t &rnSize ) const
00268 {
00269     if( NULL == m_pImpl )
00270     {
00271         return VmbErrorInternalFault;
00272     }
00273     return m_pImpl->GetSFNCNamespace( pStrNamespace, rnSize);
00274 }
00275 
00276 VmbErrorType EnumEntry::GetValue( VmbInt64_t &rnValue ) const
00277 {
00278     if( NULL == m_pImpl )
00279     {
00280         return VmbErrorInternalFault;
00281     }
00282     rnValue = m_pImpl->m_nValue;
00283 
00284     return VmbErrorSuccess;
00285 }
00286 
00287 VmbErrorType EnumEntry::GetVisibility( VmbFeatureVisibilityType &rVisibility ) const
00288 {
00289     if( NULL ==  m_pImpl )
00290     {
00291         return VmbErrorInternalFault;
00292     }
00293     rVisibility = m_pImpl->m_Visibility;
00294 
00295     return VmbErrorSuccess;
00296 }
00297 
00298 
00299 }} // namespace AVT::VmbAPI


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