VR-Engage  2.2
Loading...
Searching...
No Matches
vreModelSet.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6#pragma once
7//! \file vreModelSet.h
8//! \ingroup vreUtil
9//! \brief Defines the model set for VREngage objects
10//!
11//! This file defines the DtVreModelSet class which manages collections of models
12//! available to users for editing or creation. It extends the base VRF model set
13//! with VREngage-specific functionality for handling entity files and models.
14
15#include "vreUtil/export.h"
17
18#include <vrfobjparam/modelSet.h>
19
20namespace makVre
21{
22class DtVrfModelSetEntry;
23
24//! \brief VREngage-specific model set implementation
25//!
26//! This class extends the base VRF model set to provide VREngage-specific
27//! functionality for managing collections of entity models, including loading
28//! entity files and resolving variable bindings.
29class UTIL_DLL DtVreModelSet : public DtModelSet
30{
31public:
32 //! \brief Default constructor
33 //!
34 //! Creates an empty model set with no name or registry
36
37 //! \brief Named constructor with optional registry
38 //! \param name The name of the model set
39 //! \param parentRegistry Optional parent registry for resource loading
40 DtVreModelSet(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL);
41
42 //! \brief Virtual destructor
43 //!
44 //! Cleans up resources owned by the model set
45 virtual ~DtVreModelSet() override;
46
47 //! \brief Copy constructor
48 //! \param orig The model set to copy
49 //! \param parentRegistry Optional parent registry for resource loading
50 DtVreModelSet(const DtVreModelSet& orig, DtReaderWriterRegistry* parentRegistry = NULL);
51
52 //! \brief Gets the fast lookup map of model set entries
53 //! \return Constant reference to the map of model set entries by name
54 //!
55 //! This method provides efficient access to the model set entries using a hash map.
56 virtual const boost::unordered_map<DtString, DtModelSetEntry*>& fastMap() const;
57
58 //! \brief Loads a model set entry from an entity file
59 //! \param filename Path to the .entity file to load
60 //! \param smsSearchPaths Search paths for SMS files
61 //! \param initializer Optional initializer for the loaded entity
62 //! \return Shared pointer to the loaded model set entry
63 //!
64 //! This method loads an entity file and creates a corresponding model set entry.
65 std::shared_ptr<makVre::DtVreModelSetEntry> loadEntityFile(
66 const std::string& filename, const SearchPaths& smsSearchPaths, DtInitializer* initializer = 0);
67
68 //! \brief Factory method for creating model set instances
69 //! \param name The name of the model set to create
70 //! \param parentRegistry Optional parent registry for resource loading
71 //! \return Pointer to the newly created model set
72 //!
73 //! This static method creates a new instance of DtVreModelSet. Used by the factory system.
74 static DtModelSet* Create(const DtString& name, DtReaderWriterRegistry* parentRegistry);
75
76 // Helper functions
77public:
78 //! \brief Recursively searches for variable bindings in SMS files
79 //! \param smsList List of SMS file paths to search
80 //! \param binding The variable binding name to search for
81 //! \param searchPaths Output parameter to store the found binding paths
82 //!
83 //! This utility function recursively searches through SMS files and their included files
84 //! to find all locations of a particular variable binding.
86 const std::vector<DtString>& smsList, const std::string& binding, std::vector<DtFilename>* searchPaths);
87
88 //! \brief Gets all SMS files included by a list of SMS files
89 //! \param smsList List of SMS file paths to process
90 //! \param includedSMSs Output parameter to store the list of included SMS files
91 //!
92 //! This utility function recursively searches through SMS files to find all
93 //! SMS files they include, building a complete list of dependencies.
94 static void getIncludedSMSs(const std::vector<DtString>& smsList, std::vector<DtString>* includedSMSs);
95
96 //! \brief Gets a specific variable binding from an SMS file
97 //! \param smsFile Path to the SMS file to search
98 //! \param bindingToLookFor The variable binding name to search for
99 //! \return Path from the binding, or empty if not found
100 //!
101 //! This utility function looks for a specific variable binding in a single SMS file
102 //! and returns its value if found.
103 static DtFilename getVariableBinding(const DtString& smsFile, const std::string& bindingToLookFor);
104};
105
106} // namespace makVre
Configuration initializer for VREngage components.
Definition initializer.h:80
static void getIncludedSMSs(const std::vector< DtString > &smsList, std::vector< DtString > *includedSMSs)
Gets all SMS files included by a list of SMS files.
std::shared_ptr< makVre::DtVreModelSetEntry > loadEntityFile(const std::string &filename, const SearchPaths &smsSearchPaths, DtInitializer *initializer=0)
Loads a model set entry from an entity file.
virtual ~DtVreModelSet() override
Virtual destructor.
DtVreModelSet()
Default constructor.
static void recursiveFindVariableBindingPaths(const std::vector< DtString > &smsList, const std::string &binding, std::vector< DtFilename > *searchPaths)
Recursively searches for variable bindings in SMS files.
virtual const boost::unordered_map< DtString, DtModelSetEntry * > & fastMap() const
Gets the fast lookup map of model set entries.
DtVreModelSet(const DtVreModelSet &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Copy constructor.
static DtFilename getVariableBinding(const DtString &smsFile, const std::string &bindingToLookFor)
Gets a specific variable binding from an SMS file.
static DtModelSet * Create(const DtString &name, DtReaderWriterRegistry *parentRegistry)
Factory method for creating model set instances.
DtVreModelSet(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Named constructor with optional registry.
Defines export macros for the VREngage Utility library.
#define UTIL_DLL
Export/import macro for non-Windows platforms.
Definition export.h:39
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Extends model set entries with VR-Engage specific role data.