Feature.h
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.h
00010 
00011   Description:  Definition of base class AVT::VmbAPI::Feature.
00012                 This class wraps every call to BaseFeature resp. its concrete
00013                 subclass. That way  polymorphism is hidden away from the user.
00014                 
00015 
00016 -------------------------------------------------------------------------------
00017 
00018   THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
00019   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
00020   NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR  PURPOSE ARE
00021   DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
00022   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00023   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00024   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
00025   AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
00026   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00027   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 
00029 =============================================================================*/
00030 
00031 #ifndef AVT_VMBAPI_FEATURE_H
00032 #define AVT_VMBAPI_FEATURE_H
00033 
00034 #include <vector>
00035 #include <map>
00036 
00037 #include <VimbaC/Include/VimbaC.h>
00038 #include <VimbaCPP/Include/VimbaCPPCommon.h>
00039 #include <VimbaCPP/Include/SharedPointerDefines.h>
00040 #include <VimbaCPP/Include/IFeatureObserver.h>
00041 #include <VimbaCPP/Include/EnumEntry.h>
00042 
00043 namespace AVT {
00044 namespace VmbAPI {
00045 
00046 class BaseFeature;
00047 
00048 typedef std::vector<FeaturePtr> FeaturePtrVector;
00049 typedef std::map<std::string, FeaturePtr> FeaturePtrMap;
00050 
00051 class Feature
00052 {
00053   public:
00054     Feature( const VmbFeatureInfo_t *pFeatureInfo, FeatureContainer *pFeatureContainer );
00055     virtual ~Feature();
00056 
00057     //
00058     // Method:      GetValue()
00059     //
00060     // Purpose:     Queries the value of a feature of type VmbInt64
00061     //
00062     // Parameters:
00063     //
00064     // [out]    VmbInt64_t&     value       The feature's value
00065     //
00066     IMEXPORT    VmbErrorType GetValue( VmbInt64_t &value ) const;
00067     
00068     //
00069     // Method:      GetValue()
00070     //
00071     // Purpose:     Queries the value of a feature of type double
00072     //
00073     // Parameters:
00074     //
00075     // [out]    double&     value       The feature's value
00076     //
00077     IMEXPORT    VmbErrorType GetValue( double &value ) const;
00078 
00079     //
00080     // Method:      GetValue()
00081     //
00082     // Purpose:     Queries the value of a feature of type string
00083     //
00084     // Parameters:
00085     //
00086     // [out]    std::string&    value       The feature's value
00087     //
00088     VmbErrorType GetValue( std::string &value ) const;
00089 
00090     //
00091     // Method:      GetValue()
00092     //
00093     // Purpose:     Queries the value of a feature of type bool
00094     //
00095     // Parameters:
00096     //
00097     // [out]    bool&       value       The feature's value
00098     //
00099     IMEXPORT    VmbErrorType GetValue( bool &value ) const;
00100 
00101     //
00102     // Method:      GetValue()
00103     //
00104     // Purpose:     Queries the value of a feature of type UcharVector
00105     //
00106     // Parameters:
00107     //
00108     // [out]    UcharVector&    value       The feature's value
00109     //
00110     VmbErrorType GetValue( UcharVector &value ) const;
00111 
00112     //
00113     // Method:      GetValue()
00114     //
00115     // Purpose:     Queries the value of a feature of type const UcharVector
00116     //
00117     // Parameters:
00118     //
00119     // [out]    const UcharVector&      value       The feature's value
00120     // [out]    VmbUint32&              sizeFilled  The amount of actually received values
00121     //
00122     VmbErrorType GetValue( UcharVector &value, VmbUint32_t &sizeFilled ) const;
00123 
00124     //
00125     // Method:      GetValues()
00126     //
00127     // Purpose:     Queries the values of a feature of type Int64Vector
00128     //
00129     // Parameters:
00130     //
00131     // [out]    Int64Vector&    values       The feature's values
00132     //
00133     VmbErrorType GetValues( Int64Vector &values );
00134 
00135     //
00136     // Method:      GetValues()
00137     //
00138     // Purpose:     Queries the values of a feature of type StringVector
00139     //
00140     // Parameters:
00141     //
00142     // [out]    StringVector&    values       The feature's values
00143     //
00144     VmbErrorType GetValues( StringVector &values );
00145 
00146     //
00147     // Method:      GetEntry()
00148     //
00149     // Purpose:     Queries a single enum entry of a feature of type Enumeration
00150     //
00151     // Parameters:
00152     //
00153     // [out]    EnumEntry&    entry       An enum feature's enum entry
00154     // [in ]    const char*   pEntryName  The name of the enum entry
00155     //
00156     IMEXPORT    VmbErrorType GetEntry( EnumEntry &entry, const char *pEntryName ) const;
00157 
00158     //
00159     // Method:      GetEntries()
00160     //
00161     // Purpose:     Queries all enum entries of a feature of type Enumeration
00162     //
00163     // Parameters:
00164     //
00165     // [out]    EnumEntryVector    entries       An enum feature's enum entries
00166     //
00167     VmbErrorType GetEntries( EnumEntryVector &entries );
00168 
00169     //
00170     // Method:      GetRange()
00171     //
00172     // Purpose:     Queries the range of a feature of type double
00173     //
00174     // Parameters:
00175     //
00176     // [out]    double&    min       The feature's min value
00177     // [out]    double&    max       The feature's max value
00178     //
00179     IMEXPORT    VmbErrorType GetRange( double &minimum, double &maximum ) const;
00180 
00181     //
00182     // Method:      GetRange()
00183     //
00184     // Purpose:     Queries the range of a feature of type VmbInt64
00185     //
00186     // Parameters:
00187     //
00188     // [out]    VmbInt64&    min       The feature's min value
00189     // [out]    VmbInt64&    max       The feature's max value
00190     //
00191     IMEXPORT    VmbErrorType GetRange( VmbInt64_t &minimum, VmbInt64_t &maximum ) const;
00192 
00193     //
00194     // Method:      SetValue()
00195     //
00196     // Purpose:     Sets the value of a feature of type VmbInt32
00197     //
00198     // Parameters:
00199     //
00200     // [in ]    const VmbInt32_t&    value       The feature's value
00201     //
00202     IMEXPORT    VmbErrorType SetValue( const VmbInt32_t &value );
00203 
00204     //
00205     // Method:      SetValue()
00206     //
00207     // Purpose:     Sets the value of a feature of type VmbInt64
00208     //
00209     // Parameters:
00210     //
00211     // [in ]    const VmbInt64&    value       The feature's value
00212     //
00213     IMEXPORT    VmbErrorType SetValue( const VmbInt64_t &value );
00214 
00215     //
00216     // Method:      SetValue()
00217     //
00218     // Purpose:     Sets the value of a feature of type double
00219     //
00220     // Parameters:
00221     //
00222     // [in ]    const double&    value       The feature's value
00223     //
00224     IMEXPORT    VmbErrorType SetValue( const double &value );
00225 
00226     //
00227     // Method:      SetValue()
00228     //
00229     // Purpose:     Sets the value of a feature of type char*
00230     //
00231     // Parameters:
00232     //
00233     // [in ]    const char*    pValue       The feature's value
00234     //
00235     IMEXPORT    VmbErrorType SetValue( const char *pValue );
00236 
00237     //
00238     // Method:      SetValue()
00239     //
00240     // Purpose:     Sets the value of a feature of type bool
00241     //
00242     // Parameters:
00243     //
00244     // [in ]    bool    value       The feature's value
00245     //
00246     IMEXPORT    VmbErrorType SetValue( bool value );
00247 
00248     //
00249     // Method:      SetValue()
00250     //
00251     // Purpose:     Sets the value of a feature of type UcharVector
00252     //
00253     // Parameters:
00254     //
00255     // [in ]    const UcharVector&    value       The feature's value
00256     //
00257     VmbErrorType SetValue( const UcharVector &value );
00258 
00259     //
00260     // Method:      GetIncrement()
00261     //
00262     // Purpose:     Gets the increment of a feature of type VmbInt64
00263     //
00264     // Parameters:
00265     //
00266     // [out]    VmbInt64_t&    increment       The feature's increment
00267     //
00268     IMEXPORT    VmbErrorType GetIncrement( VmbInt64_t &increment ) const;
00269 
00270     //
00271     // Method:      IsValueAvailable()
00272     //
00273     // Purpose:     Indicates whether an existing enumeration-value is currently available.
00274     //              An enumeration-value might not be selectable due to the camera's
00275     //              current configuration.
00276     //
00277     // Parameters:
00278     //
00279     // [in ]        const char*     pStrValue   The enumeration-value as string
00280     // [out]        bool&           available   True when the given value is available
00281     //
00282     // Returns:
00283     //
00284     //  - VmbErrorSuccess:       If no error
00285     //  - VmbErrorInvalidValue:  If the given value is not a valid enumeration-value for this enum
00286     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00287     //  - VmbErrorInvalidAccess: Operation is invalid with the current access mode
00288     //  - VmbErrorWrongType:     The feature is not an enumeration
00289     //
00290     IMEXPORT    VmbErrorType IsValueAvailable( const char *pValue, bool &available ) const;
00291 
00292     //
00293     // Method:      IsValueAvailable()
00294     //
00295     // Purpose:     Indicates whether an existing enumeration-value is currently available.
00296     //              An enumeration-value might not be selectable due to the camera's
00297     //              current configuration.
00298     //
00299     // Parameters:
00300     //
00301     // [in ]        const VmbInt64_t    pStrValue   The enumeration-value as int
00302     // [out]        bool&               available   True when the given value is available
00303     //
00304     // Returns:
00305     //
00306     //  - VmbErrorSuccess:       If no error
00307     //  - VmbErrorInvalidValue:  If the given value is not a valid enumeration-value for this enum
00308     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00309     //  - VmbErrorInvalidAccess: Operation is invalid with the current access mode
00310     //  - VmbErrorWrongType:     The feature is not an enumeration
00311     //
00312     IMEXPORT    VmbErrorType IsValueAvailable( const VmbInt64_t value, bool &available ) const;
00313 
00314     //
00315     // Method:      RunCommand()
00316     //
00317     // Purpose:     Executes a feature of type Command
00318     //
00319     IMEXPORT    VmbErrorType RunCommand();
00320 
00321     //
00322     // Method:      IsCommandDone()
00323     //
00324     // Purpose:     Indicates whether the execution of a feature of type Command has finished
00325     //
00326     // Parameters:
00327     //
00328     // [out]    bool&    isDone     True when execution has finished
00329     //
00330     IMEXPORT    VmbErrorType IsCommandDone( bool &isDone ) const;
00331 
00332     //
00333     // Method:      GetName()
00334     //
00335     // Purpose:     Queries a feature's name
00336     //
00337     // Parameters:
00338     //
00339     // [out]    std::string&    name    The feature's name
00340     //
00341     VmbErrorType GetName( std::string &name ) const;
00342 
00343     //
00344     // Method:      GetDisplayName()
00345     //
00346     // Purpose:     Queries a feature's display name
00347     //
00348     // Parameters:
00349     //
00350     // [out]    std::string&    displayName    The feature's display name
00351     //
00352     VmbErrorType GetDisplayName( std::string &displayName ) const;
00353 
00354     //
00355     // Method:      GetDataType()
00356     //
00357     // Purpose:     Queries a feature's type
00358     //
00359     // Parameters:
00360     //
00361     // [out]    VmbFeatureDataType&    dataType    The feature's type
00362     //
00363     IMEXPORT    VmbErrorType GetDataType( VmbFeatureDataType &dataType ) const;
00364 
00365     //
00366     // Method:      GetFlags()
00367     //
00368     // Purpose:     Queries a feature's access status
00369     //
00370     // Parameters:
00371     //
00372     // [out]    VmbFeatureFlagsType&    flags    The feature's access status
00373     //    
00374     IMEXPORT    VmbErrorType GetFlags( VmbFeatureFlagsType &flags ) const;
00375 
00376     //
00377     // Method:      GetCategory()
00378     //
00379     // Purpose:     Queries a feature's category in the feature tress
00380     //
00381     // Parameters:
00382     //
00383     // [out]    std::string&    category    The feature's position in the feature tree
00384     //    
00385     VmbErrorType GetCategory( std::string &category ) const;
00386 
00387     //
00388     // Method:      GetPollingTime()
00389     //
00390     // Purpose:     Queries a feature's polling time
00391     //
00392     // Parameters:
00393     //
00394     // [out]    VmbUint32_t&    pollingTime    The interval to poll the feature
00395     //    
00396     IMEXPORT    VmbErrorType GetPollingTime( VmbUint32_t &pollingTime ) const;
00397 
00398     //
00399     // Method:      GetUnit()
00400     //
00401     // Purpose:     Queries a feature's unit
00402     //
00403     // Parameters:
00404     //
00405     // [out]    std::string&    unit    The feature's unit
00406     //
00407     VmbErrorType GetUnit( std::string &unit ) const;
00408 
00409     //
00410     // Method:      GetRepresentation()
00411     //
00412     // Purpose:     Queries a feature's representation
00413     //
00414     // Parameters:
00415     //
00416     // [out]    std::string&    representation    The feature's representation
00417     //
00418     VmbErrorType GetRepresentation( std::string &representation ) const;
00419 
00420     //
00421     // Method:      GetVisibility()
00422     //
00423     // Purpose:     Queries a feature's visibility
00424     //
00425     // Parameters:
00426     //
00427     // [out]    VmbFeatureVisibilityType&    visibility    The feature's visibility
00428     //
00429     IMEXPORT    VmbErrorType GetVisibility( VmbFeatureVisibilityType &visibility ) const;
00430 
00431     //
00432     // Method:      GetToolTip()
00433     //
00434     // Purpose:     Queries a feature's tool tip to display in the GUI
00435     //
00436     // Parameters:
00437     //
00438     // [out]    std::string&    toolTip    The feature's tool tip
00439     //
00440     VmbErrorType GetToolTip( std::string &toolTip ) const;
00441 
00442     //
00443     // Method:      GetDescription()
00444     //
00445     // Purpose:     Queries a feature's description
00446     //
00447     // Parameters:
00448     //
00449     // [out]    std::string&    description    The feature'sdescription
00450     //
00451     VmbErrorType GetDescription( std::string &description ) const;
00452 
00453     //
00454     // Method:      GetSFNCNamespace()
00455     //
00456     // Purpose:     Queries a feature's Standard Feature Naming Convention namespace
00457     //
00458     // Parameters:
00459     //
00460     // [out]    std::string&    SFNCNamespace    The feature's SFNC namespace
00461     //
00462     VmbErrorType GetSFNCNamespace( std::string &SFNCNamespace ) const;
00463 
00464     //
00465     // Method:      GetAffectedFeatures()
00466     //
00467     // Purpose:     Queries the feature's that are dependent from the current feature
00468     //
00469     // Parameters:
00470     //
00471     // [out]    FeaturePtrVector&    affectedFeatures    The features that get invalidated through the current feature
00472     //
00473     VmbErrorType GetAffectedFeatures( FeaturePtrVector &affectedFeatures );
00474 
00475     //
00476     // Method:      GetSelectedFeatures()
00477     //
00478     // Purpose:     Gets the features that get selected by the current feature
00479     //
00480     // Parameters:
00481     //
00482     // [out]    FeaturePtrVector&    selectedFeatures    The selected features
00483     //
00484     VmbErrorType GetSelectedFeatures( FeaturePtrVector &selectedFeatures );
00485 
00486     //
00487     // Method:      IsReadable()
00488     //
00489     // Purpose:     Queries the read access status of a feature
00490     //
00491     // Parameters:
00492     //
00493     // [out]    bool&    isReadable    True when feature can be read
00494     //
00495     IMEXPORT    VmbErrorType IsReadable( bool &isReadable );
00496 
00497     //
00498     // Method:      IsWritable()
00499     //
00500     // Purpose:     Queries the write access status of a feature
00501     //
00502     // Parameters:
00503     //
00504     // [out]    bool&    isWritable    True when feature can be written
00505     //
00506     IMEXPORT    VmbErrorType IsWritable( bool &isWritable );
00507 
00508     //
00509     // Method:      IsStreamable()
00510     //
00511     // Purpose:     Queries whether a feature's value can be transferred as a stream
00512     //
00513     // Parameters:
00514     //
00515     // [out]    bool&    isStreamable    True when streamable
00516     //
00517     IMEXPORT    VmbErrorType IsStreamable( bool &isStreamable ) const;
00518 
00519     //
00520     // Method:      RegisterObserver()
00521     //
00522     // Purpose:     Registers an observer that notifies the application whenever a features value changes
00523     //
00524     // Parameters:
00525     //
00526     // [out]    const IFeatureObserverPtr&    observer    The observer to be registered
00527     //
00528     IMEXPORT    VmbErrorType RegisterObserver( const IFeatureObserverPtr &observer );
00529 
00530     //
00531     // Method:      UnregisterObserver()
00532     //
00533     // Purpose:     Unregisters an observer
00534     //
00535     // Parameters:
00536     //
00537     // [out]    const IFeatureObserverPtr&    observer    The observer to be unregistered
00538     //
00539     IMEXPORT    VmbErrorType UnregisterObserver( const IFeatureObserverPtr &observer );
00540 
00541     void ResetFeatureContainer();
00542 
00543   private:
00544     BaseFeature *m_pImpl;
00545 
00546     // No default ctor
00547     Feature();
00548     // No copy ctor
00549     Feature( const Feature& );
00550     // No assignment operator
00551     Feature& operator=( const Feature& );
00552 
00553     // Array functions to pass data across DLL boundaries
00554     IMEXPORT    VmbErrorType GetValue( char * const pValue, VmbUint32_t &length ) const;
00555     IMEXPORT    VmbErrorType GetValue( VmbUchar_t *pValue, VmbUint32_t &size, VmbUint32_t &sizeFilled ) const;
00556     IMEXPORT    VmbErrorType GetValues( const char **pValues, VmbUint32_t &size );
00557     IMEXPORT    VmbErrorType GetValues( VmbInt64_t *pValues, VmbUint32_t &Size );
00558 
00559     IMEXPORT    VmbErrorType GetEntries( EnumEntry *pEnumEntries, VmbUint32_t &size );
00560 
00561     IMEXPORT    VmbErrorType SetValue( const VmbUchar_t *pValue, VmbUint32_t size );
00562 
00563     IMEXPORT    VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
00564     IMEXPORT    VmbErrorType GetDisplayName( char * const pDisplayName, VmbUint32_t &length ) const;
00565     IMEXPORT    VmbErrorType GetCategory( char * const pCategory, VmbUint32_t &length ) const;
00566     IMEXPORT    VmbErrorType GetUnit( char * const pUnit, VmbUint32_t &length ) const;
00567     IMEXPORT    VmbErrorType GetRepresentation( char * const pRepresentation, VmbUint32_t &length ) const;
00568     IMEXPORT    VmbErrorType GetToolTip( char * const pToolTip, VmbUint32_t &length ) const;
00569     IMEXPORT    VmbErrorType GetDescription( char * const pDescription, VmbUint32_t &length ) const;
00570     IMEXPORT    VmbErrorType GetSFNCNamespace( char * const pSFNCNamespace, VmbUint32_t &length ) const;
00571     IMEXPORT    VmbErrorType GetAffectedFeatures( FeaturePtr *pAffectedFeatures, VmbUint32_t &nSize );
00572     IMEXPORT    VmbErrorType GetSelectedFeatures( FeaturePtr *pSelectedFeatures, VmbUint32_t &nSize );
00573 };
00574 
00575 #include <VimbaCPP/Include/Feature.hpp>
00576 
00577 }} // namespace AVT::VmbAPI
00578 
00579 #endif


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