Skip to content

pylon/DeviceAccessMode.h#

Definition of Device Access Mode.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::AccessModeSet
Collection of access mode bits.

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2006-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  Hartmut Nebelung
//-----------------------------------------------------------------------------
#ifndef INCLUDED_DEVICEACCESSMODE_H_6600916
#define INCLUDED_DEVICEACCESSMODE_H_6600916

#include <pylon/PylonBase.h>
#include <pylon/PylonVersionNumber.h>

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

#include <string>
#include <iomanip>

namespace Pylon
{
    // --------------------------------------------------------------------------
    // enum EDeviceAccessMode
    // --------------------------------------------------------------------------

    enum EDeviceAccessMode
    {
        Control = 0x1,     
        Stream = 0x3,      
        Event = 0x4,       
        Exclusive = 0x5,   
        _NumModes
    };

    // --------------------------------------------------------------------------
    // class AccessModeSet
    // --------------------------------------------------------------------------

    class PYLONBASE_API AccessModeSet
    {
    public:
        AccessModeSet( void );
        AccessModeSet( EDeviceAccessMode am );
        AccessModeSet( const AccessModeSet& ams );
        explicit AccessModeSet( unsigned long l );
        // Destructor
        ~AccessModeSet();

        AccessModeSet& set( size_t pos );


        AccessModeSet& reset();

        bool any() const;

        bool none() const;

        bool test( size_t pos ) const;

        unsigned long to_ulong() const;

    private:
        unsigned long mBits;


    };

    // -------------------------------------------------------------------------
    // Access mode operators
    // -------------------------------------------------------------------------

    AccessModeSet PYLONBASE_API operator+( EDeviceAccessMode lhs, EDeviceAccessMode rhs );

    AccessModeSet PYLONBASE_API operator|( EDeviceAccessMode lhs, EDeviceAccessMode rhs );

    AccessModeSet PYLONBASE_API operator+( const AccessModeSet& lhs, EDeviceAccessMode rhs );

    AccessModeSet PYLONBASE_API operator|( const AccessModeSet& lhs, EDeviceAccessMode rhs );



    bool PYLONBASE_API operator==( const AccessModeSet& lhs, const AccessModeSet& rhs );

    bool PYLONBASE_API operator!=( const AccessModeSet& lhs, const AccessModeSet& rhs );


    // -------------------------------------------------------------------------
    // STL output operators
    // -------------------------------------------------------------------------

    inline std::ostream& operator <<( std::ostream& ostr, const Pylon::AccessModeSet& ams )
    {
        // use formatted output operator of std::string
        ostr << "0x"
            << std::setfill( '0' ) << std::setw( sizeof( unsigned long ) * 2 )
            << std::hex << ams.to_ulong();

        return ostr;
    }


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

#endif /* INCLUDED_DEVICEACCESSMODE_H_6600916 */

Updated on 27 July 2022 at 19:03:47