Skip to content

pylon/IntegerParameter.h#

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

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
struct Pylon::IIntegerEx
Extends the GenApi::IInteger interface with convenience methods.
class Pylon::CIntegerParameter
CIntegerParameter 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_CINTEGERPARAMETER_H
#define INCLUDED_BASLER_PYLON_CINTEGERPARAMETER_H

#pragma once

#include <pylon/PylonBase.h>
#include <GenApi/IInteger.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 EIntegerValueCorrection
    {
        IntegerValueCorrection_None = 0,
        IntegerValueCorrection_Up = 1,
        IntegerValueCorrection_Down = 2,
        IntegerValueCorrection_Nearest = 3
    };


    interface IIntegerEx : virtual public GenApi::IInteger, virtual public IValueEx
    {
        using GenApi::IInteger::operator=;

        using GenApi::IInteger::SetValue;

        virtual bool TrySetValue( int64_t value ) = 0;


        virtual int64_t GetValueOrDefault( int64_t defaultValue ) = 0;


        virtual bool TrySetValue( int64_t value, EIntegerValueCorrection correction ) = 0;


        virtual void SetValue( int64_t value, EIntegerValueCorrection 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;
    };


    class PYLONBASE_API CIntegerParameter : public IIntegerEx, public CParameter
    {
    public:
        CIntegerParameter();


        explicit CIntegerParameter( GenApi::INode* pNode );


        explicit CIntegerParameter( GenApi::IInteger* pInteger );


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


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


        CIntegerParameter( const CIntegerParameter& rhs );


        virtual ~CIntegerParameter();


        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::IInteger* pInteger );


        CIntegerParameter& operator=( const CIntegerParameter& rhs );


        virtual bool Equals( const CIntegerParameter& rhs ) const;


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


        virtual bool Equals( const GenApi::IInteger* pInteger ) const;


        virtual void Release();


        // Implements IValueEx
        virtual bool IsValid() const;


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

        // Implements GenApi::IInteger
        virtual GenApi::IInteger& operator=( int64_t value );

        // Implements GenApi::IInteger
        virtual int64_t GetValue( bool verify = false, bool ignoreCache = false );

        // Implements GenApi::IInteger
        virtual int64_t operator()();

        // Implements GenApi::IInteger
        virtual int64_t operator*();

        // Implements GenApi::IInteger
        virtual int64_t GetMin();

        // Implements GenApi::IInteger
        virtual int64_t GetMax();

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

        // Implements GenApi::IInteger
        virtual int64_t GetInc();

        // Implements GenApi::IInteger
        virtual GenApi::int64_autovector_t GetListOfValidValues( bool bounded = true );

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

        // Implements GenApi::IInteger
        virtual GenICam::gcstring GetUnit();

        // Implements GenApi::IInteger
        virtual void ImposeMin( int64_t value );

        // Implements GenApi::IInteger
        virtual void ImposeMax( int64_t value );


        // Implements IIntegerEx
        virtual bool TrySetValue( int64_t value );

        // Implements IIntegerEx
        virtual int64_t GetValueOrDefault( int64_t defaultValue );

        // Implements IIntegerEx
        virtual bool TrySetValue( int64_t value, EIntegerValueCorrection correction );

        // Implements IIntegerEx
        virtual void SetValue( int64_t value, EIntegerValueCorrection correction );

        // Implements IIntegerEx
        virtual double GetValuePercentOfRange();

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

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

        // Implements IIntegerEx
        virtual void SetToMaximum();

        // Implements IIntegerEx
        virtual void SetToMinimum();

        // Implements IIntegerEx
        virtual bool TrySetToMaximum();

        // Implements IIntegerEx
        virtual bool TrySetToMinimum();

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

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

#endif /* INCLUDED_BASLER_PYLON_CINTEGERPARAMETER_H */

Updated on 5 July 2022 at 15:30:01