Skip to content

pylon/NodeMapProxy.h#

Pylon generic node map interface declaration.

Namespaces#

Name
Pylon
Contains definitions of pylon types.

Classes#

Name
class Pylon::CNodeMapProxyT
Implementation Detail: This class wraps programming interfaces that are generated from GenICam parameter description files to provide native parameter access.

Defines#

Name
PYLON_DEFINE_NODEMAP(ClassName, BaseClass)
Macro to define a custom Node map proxy.

Macros Documentation#

define PYLON_DEFINE_NODEMAP#

#define PYLON_DEFINE_NODEMAP(
    ClassName,
    BaseClass
)
class ClassName : public BaseClass \
    { \
    public: \
        /** \name Construction */ \
        /*@{*/ \
        /** \brief \copybrief Pylon::CNodeMapProxyT::CNodeMapProxyT()
        \copydetails Pylon::CNodeMapProxyT::CNodeMapProxyT()
        */ \
            ClassName() \
        { \
        } \
            /** \brief \copybrief Pylon::CNodeMapProxyT::CNodeMapProxyT(GenApi::INodeMap*)
            \copydetails Pylon::CNodeMapProxyT::CNodeMapProxyT(GenApi::INodeMap*)
            */ \
            ClassName( GenApi::INodeMap* pNodeMap ) : BaseClass( pNodeMap ) \
        { \
        } \
            /*@}*/ \
    };

Macro to define a custom Node map proxy.

Source code#

//-----------------------------------------------------------------------------
//  Basler pylon SDK
//  Copyright (c) 2007-2022 Basler AG
//  http://www.baslerweb.com
//  Author:  AH
//-----------------------------------------------------------------------------
#ifndef __PYLON_NODEMAPROXY__H__
#define __PYLON_NODEMAPROXY__H__

#if _MSC_VER > 1000
#pragma once
#endif

#include <pylon/Platform.h>

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

#include <Base/GCException.h>
#include <GenApi/INodeMap.h>
#include <GenApi/INode.h>

#define PYLON_DEFINE_NODEMAP(ClassName, BaseClass) \
    class ClassName : public BaseClass \
    { \
    public: \
 \
 \
 \
            ClassName() \
        { \
        } \
 \
            ClassName( GenApi::INodeMap* pNodeMap ) : BaseClass( pNodeMap ) \
        { \
        } \
 \
    };


    namespace Pylon
    {
        //**************************************************************************************************

        //**************************************************************************************************
        template<class TParams>
        class CNodeMapProxyT : public TParams
        {
        public:
            // \{

            CNodeMapProxyT();

            CNodeMapProxyT( GenApi::INodeMap* );

            virtual ~CNodeMapProxyT();

            //\}


        private:
            // \{
            CNodeMapProxyT( const CNodeMapProxyT& );
            CNodeMapProxyT& operator=( const CNodeMapProxyT& );
            // \}


        public:
            // \{

            virtual void Attach( GenApi::INodeMap*, bool replace = false );

            virtual bool IsAttached() const;

            virtual GenApi::INodeMap* GetNodeMap() const;

            // \}


        public:
            // \{
            void GetNodes( GenApi::NodeList_t& Nodes ) const
            {
                CheckNodeMapPtr();
                return m_pNodeMap->GetNodes( Nodes );
            }

            GenApi::INode* GetNode( const GenICam::gcstring& Name ) const
            {
                CheckNodeMapPtr();
                return m_pNodeMap->GetNode( Name );
            }

            void InvalidateNodes() const
            {
                CheckNodeMapPtr();
                m_pNodeMap->InvalidateNodes();
            }

            void Poll( int64_t ElapsedTime )
            {
                CheckNodeMapPtr();
                m_pNodeMap->Poll( ElapsedTime );
            }

            // \}


        protected:
            void CheckNodeMapPtr() const
            {
                if (NULL == m_pNodeMap)
                {
                    throw LOGICAL_ERROR_EXCEPTION( "The object is not attached to a NodeMap" );
                }
            }

            GenApi::INodeMap* m_pNodeMap;
        };


        //**************************************************************************************************
        // CPylonDeviceProxyT implementation
        //**************************************************************************************************


        template<class TParams>
        inline CNodeMapProxyT<TParams>::CNodeMapProxyT()
            : m_pNodeMap( NULL )
        {
        }

        template<class TParams>
        inline CNodeMapProxyT<TParams>::CNodeMapProxyT( GenApi::INodeMap* pNodeMap )
            : m_pNodeMap( NULL )
        {
            Attach( pNodeMap );
        }

        template<class TParams>
        inline CNodeMapProxyT<TParams>::~CNodeMapProxyT( void )
        {
        }

        template<class TParams>
        inline void CNodeMapProxyT<TParams>::Attach( GenApi::INodeMap* pNodeMap, bool replace )
        {
            if (IsAttached() && !replace)
            {
                throw LOGICAL_ERROR_EXCEPTION( "Object is already attached to a node map" );
            }

            if (NULL == pNodeMap)
            {
                throw LOGICAL_ERROR_EXCEPTION( "Tried to attach a NULL pointer as node map" );
            }

            TParams::_Initialize( pNodeMap );
            m_pNodeMap = pNodeMap;
        }

        template<class TParams>
        inline bool CNodeMapProxyT<TParams>::IsAttached() const
        {
            return NULL != m_pNodeMap;
        }

        template<class TParams>
        inline GenApi::INodeMap* CNodeMapProxyT<TParams>::GetNodeMap() const
        {
            return m_pNodeMap;
        }
    }


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

#endif // __PYLON_NODEMAPROXY__H__

Updated on 5 July 2022 at 15:30:01