Skip to content

File NodeMapFactory.h

File List > include > SpinGenApi > NodeMapFactory.h

Go to the documentation of this file

//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR).
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================

#pragma once

//#include <GenApi/GenApiVersion.h>
//#include <GenApi/GenApiDll.h>
#include "GCString.h"
#include "GCStringVector.h"
#include <memory>

namespace Spinnaker
{
    namespace GenApi
    {
        class CLock; // forward
        class CNodeDataMap;
        struct INodeMap;

        typedef enum
        {
            CacheUsage_Automatic,  
            CacheUsage_ForceWrite, 
            CacheUsage_ForceRead,  
            CacheUsage_Ignore 
        } ECacheUsage_t;

        typedef enum
        {
            // ContentType_Auto,
            ContentType_Xml,      
            ContentType_ZippedXml 
        } EContentType_t;

        //*************************************************************
        // CNodeMapFactory
        //*************************************************************

        class SPINNAKER_API CNodeMapFactory
        {
          public:
            CNodeMapFactory();

            virtual ~CNodeMapFactory();

            CNodeMapFactory(const CNodeMapFactory&);

            CNodeMapFactory& operator=(const CNodeMapFactory&);

            CNodeMapFactory(
                EContentType_t FileType,
                const GenICam::gcstring& FileName,
                ECacheUsage_t CacheUsage = CacheUsage_Automatic,
                bool SuppressStringsOnLoad = false);

            CNodeMapFactory(
                EContentType_t ContentType,
                const void* pData,
                size_t DataSize,
                ECacheUsage_t CacheUsage = CacheUsage_Automatic,
                bool SuppressStringsOnLoad = false);

            CNodeMapFactory(
                const GenICam::gcstring& XmlData,
                ECacheUsage_t CacheUsage = CacheUsage_Automatic,
                bool SuppressStringsOnLoad = false);

            bool IsEmpty() const;

            void AddInjectionData(CNodeMapFactory& injectionData);

            void LoadAndInject();

            bool IsLoaded() const;

            CNodeMapFactory ExtractSubtree(const GenICam::gcstring& SubTreeRootNodeName, bool doRenameToRoot = false);

            void Preprocess();

            bool IsPreprocessed() const;

            void ReleaseCameraDescriptionFileData();

            bool IsCameraDescriptionFileDataReleased() const;

            INodeMap* CreateNodeMap(
                const GenICam::gcstring& DeviceName = "Device",
                bool DoReleaseCameraDescriptionFileData = true);

            INodeMap* CreateNodeMap(
                CLock& UserProvidedLock,
                const GenICam::gcstring& DeviceName = "Device",
                bool DoReleaseCameraDescriptionFileData = true);

            static INodeMap* CreateEmptyNodeMap();

            static bool ClearCache();

            void GetSupportedSchemaVersions(GenICam::gcstring_vector& SchemaVersions) const;

            GenICam::gcstring ToString() const;

            GenICam::gcstring ToXml() const;

            static CNodeDataMap* CreateNodeDataFromNodeMap(INodeMap* pNodeMap);

            typedef struct
            {
                uint32_t NumNodes;
                uint32_t NumProperties;
                uint32_t NumLinks;
                uint32_t NumStrings;
            } NodeStatistics_t;

            void GetNodeStatistics(NodeStatistics_t& NodeStatistics);

            const GenICam::gcstring ApplyStyleSheet(const GenICam::gcstring& StyleSheetFileName);

          private:
            class CNodeMapFactoryImpl;

            CNodeMapFactoryImpl* m_pImpl;
        };

    } // namespace GenApi
} // namespace Spinnaker