Skip to content

pylon/FloatParameter.h#

Contains the class CFloatParameter used to simplify access to GenApi parameters.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
struct Pylon::IFloatEx
Extends the GenApi::IFloat interface with convenience methods.
class Pylon::CFloatParameter
CFloatParameter class used to simplify access to GenApi parameters.

Source code#

//------------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2018-2022 Basler AG
//  http://www.baslerweb.com
//------------------------------------------------------------------------------
#ifndef INCLUDED_BASLER_PYLON_CFLOATPARAMETER_H
#define INCLUDED_BASLER_PYLON_CFLOATPARAMETER_H

#pragma once

#include <pylon/PylonBase.h>
#include <GenApi/IFloat.h>
#include <pylon/Parameter.h>

#ifdef _MSC_VER
#   pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */

#ifdef _MSC_VER
#   pragma warning( push )
#   pragma warning( disable : 4275 ) // Class needs to have a dll interface to be used by clients of the class.
#   pragma warning( disable : 4250 ) // warning C4250: 'Pylon::CXYZParameter': inherits 'Pylon::CParameter::Pylon::CParameter::ZYX' via dominance
#endif

namespace Pylon
{
    enum EFloatValueCorrection
    {
        FloatValueCorrection_None = 0,
        FloatValueCorrection_ClipToRange = 3
    };

    class CIntegerParameter;
    interface IFloatEx : virtual public GenApi::IFloat, virtual public IValueEx
    {
        using GenApi::IFloat::operator=;

        using GenApi::IFloat::SetValue;

        virtual bool TrySetValue( double value ) = 0;


        virtual double GetValueOrDefault( double defaultValue ) = 0;


        virtual bool TrySetValue( double value, EFloatValueCorrection correction ) = 0;


        virtual void SetValue( double value, EFloatValueCorrection correction ) = 0;


        virtual double GetValuePercentOfRange() = 0;


        virtual void SetValuePercentOfRange( double percentOfRange ) = 0;


        virtual bool TrySetValuePercentOfRange( double percentOfRange ) = 0;


        virtual void SetToMaximum() = 0;


        virtual void SetToMinimum() = 0;


        virtual bool TrySetToMaximum() = 0;


        virtual bool TrySetToMinimum() = 0;


        virtual void GetAlternativeIntegerRepresentation( CIntegerParameter& parameter ) = 0;
    };


    class PYLONBASE_API CFloatParameter : public IFloatEx, public CParameter
    {
    public:
        CFloatParameter();


        explicit CFloatParameter( GenApi::INode* pNode );


        explicit CFloatParameter( GenApi::IFloat* pFloat );


        CFloatParameter( GenApi::INodeMap* pNodeMap, const char* pName );


        CFloatParameter( GenApi::INodeMap& nodeMap, const char* pName );


        CFloatParameter( const CFloatParameter& rhs );


        virtual ~CFloatParameter();


        virtual bool Attach( GenApi::INodeMap* pNodeMap, const char* pName );


        virtual bool Attach( GenApi::INodeMap& nodeMap, const char* pName );


        virtual bool Attach( GenApi::INode* pNode );


        virtual bool Attach( GenApi::IFloat* pFloat );


        CFloatParameter& operator=( const CFloatParameter& rhs );


        virtual bool Equals( const CFloatParameter& rhs ) const;


        virtual bool Equals( const GenApi::INode* pNode ) const;


        virtual bool Equals( const GenApi::IFloat* pFloat ) const;


        virtual void Release();


        // Implements IValueEx
        virtual bool IsValid() const;


        // Implements GenApi::IFloat
        virtual void SetValue( double value, bool verify = true );

        // Implements GenApi::IFloat
        virtual GenApi::IFloat& operator=( double value );

        // Implements GenApi::IFloat
        virtual double GetValue( bool verify = false, bool ignoreCache = false );

        // Implements GenApi::IFloat
        virtual double operator()();

        // Implements GenApi::IFloat
        virtual double operator*();

        // Implements GenApi::IFloat
        virtual double GetMin();

        // Implements GenApi::IFloat
        virtual double GetMax();

        // Implements GenApi::IFloat
        virtual bool HasInc();

        // Implements GenApi::IFloat
        virtual GenApi::EIncMode GetIncMode();

        // Implements GenApi::IFloat
        virtual double GetInc();

        // Implements GenApi::IFloat
        virtual GenApi::double_autovector_t GetListOfValidValues( bool bounded = true );

        // Implements GenApi::IFloat
        virtual GenApi::ERepresentation GetRepresentation();

        // Implements GenApi::IFloat
        virtual GenICam::gcstring GetUnit() const;

        // Implements GenApi::IFloat
        virtual GenApi::EDisplayNotation GetDisplayNotation() const;

        // Implements GenApi::IFloat
        virtual int64_t GetDisplayPrecision() const;

        // Implements GenApi::IFloat
        virtual void ImposeMin( double value );

        // Implements GenApi::IFloat
        virtual void ImposeMax( double value );


        // Implements IFloatEx
        virtual bool TrySetValue( double value );

        // Implements IFloatEx
        virtual double GetValueOrDefault( double defaultValue );

        // Implements IFloatEx
        virtual bool TrySetValue( double value, EFloatValueCorrection correction );

        // Implements IFloatEx
        virtual void SetValue( double value, EFloatValueCorrection correction );

        // Implements IFloatEx
        virtual double GetValuePercentOfRange();

        // Implements IFloatEx
        virtual void SetValuePercentOfRange( double percentOfRange );

        // Implements IFloatEx
        virtual bool TrySetValuePercentOfRange( double percentOfRange );

        // Implements IFloatEx
        virtual void SetToMaximum();

        // Implements IFloatEx
        virtual void SetToMinimum();

        // Implements IFloatEx
        virtual bool TrySetToMaximum();

        // Implements IFloatEx
        virtual bool TrySetToMinimum();

        // Implements IFloatEx
        virtual void GetAlternativeIntegerRepresentation( CIntegerParameter& parameter );

    protected:
        GenApi::IFloat* m_pFeature;
    };
}
#ifdef _MSC_VER
#   pragma warning( pop )
#endif

#ifdef _MSC_VER
#   pragma pack(pop)
#endif /* _MSC_VER */

#endif /* INCLUDED_BASLER_PYLON_CFLOATPARAMETER_H */

Updated on 5 July 2022 at 15:30:01