VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtFileCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 #include <vrvCore/vrvCore.h>
13 #include <vrvUtil/signalslib.h>
14 #include <boost/unordered_set.hpp>
15 #include <string>
16 #include <deque>
17 #include <map>
18 #include <tbb/task.h>
20 
21 namespace makArchives
22 {
23  class DtCacheSettingsRecord;
24 }
25 
26 namespace makVrv
27 {
28  class DtDe;
29  class DtRecordSettingsBackupInterface;
30  class DtFileCache;
31  class DtTextureInterface;
32 
38  {
39  public:
40 
42  typedef boost::unordered_set<std::string> ExcludedExtensions;
43  typedef std::deque<std::string> FilePathList;
44 
46  {
48  unsigned int myCacheHint;
49 
50  std::multimap<std::string,std::string> customOptionStrings;
51  std::multimap<std::string, void*> customPluginData;
52 
53  std::string myCacheDir;
54  std::string myOriginalPath;
57 
63 
68  std::string myCDBMcodTable;
69 
71  };
72 
75  friend class DtFileCacheCreator;
76 
78  friend class DtDeSharedState;
79 
81  virtual ~DtFileCache();
82 
84  virtual void init();
85 
88  virtual void initSingletonDependencies();
89 
91  LoadFileOptions defaultOptions() const;
92 
95  virtual bool getCachedNodeFile(const std::string& filePathIn,
96  const FilePathList& paths, std::string& cachedFilePathOut,
97  bool emitError );
98 
101  virtual bool getCachedImageFile(const std::string& filePathIn,
102  const FilePathList& paths, std::string& cachedFilePathOut,
103  bool emitError);
104 
106  virtual void setCachingEnabled(bool flag);
107 
109  virtual bool acceleratedCachingEnabled() const;
110 
115  virtual void setCompressTextures(bool compress);
116 
118  virtual bool compressTexturesEnabled() const;
119 
121  virtual void releaseResources();
122 
124  virtual void clearAccelerationCache();
125 
127  virtual void setInstancingEnabled(bool enabled);
128 
130  virtual bool instancingEnabled() const;
131 
133  bool clearInstancesOnNewScene() const;
134 
136  void setClearInstancesOnNewScene(bool clearInstances);
137 
139  void clearInstancingCache();
140 
146  void flushInstanceCache(bool multipass,bool flushNodes,
147  bool flushTextures, bool flushImages);
148 
151  unsigned int flushCycleCount();
152 
154  virtual void ts_clearInstancingCache();
155 
157  virtual void setFromRecord(const makArchives::DtCacheSettingsRecord& rec);
158 
160  virtual void getRecord(makArchives::DtCacheSettingsRecord& rec) const;
161 
163  void loadDefaults(bool loadOnlyFactorySettings = false);
164 
166  void saveAsDefaults();
167 
169  void exportSettings(const std::string& fileName);
170 
172  void importSettings(const std::string& fileName);
173 
175  virtual ExcludedExtensions& excludedExtensions();
176 
178  inline bool isExcludedExtension(const std::string& ext) const
179  {
180  return ts_isExcludedExtension(ext);
181  }
182 
184  {
185  return mySettingsBackup;
186  }
187 
189  {
190  return mySettingsBackup;
191  }
192 
194  {
195  return myDe;
196  }
197 
200  boost::signalslib::signal<void ()> signal_clearInstanceCache;
201 
203  virtual void ts_flushInstancingCache(bool multiPass,
204  bool flushNodes, bool flushTextures, bool flushImages);
205 
211  virtual bool getOrLoadTexture( DtTextureInterface* textureWrapper, const std::string& filename,
212  const DtFileCache::LoadFileOptions& loadFileOptions );
213 
214  protected:
215 
217  virtual void autoSaveDefaultsIfNeeded();
218 
220  virtual bool ts_isExcludedExtension(const std::string& ext) const;
221 
224  virtual void addExcludedExtension(const std::string &ext);
225 
228  virtual void removeExcludedExtension(const std::string &ext);
229 
233  DtFileCache(DtDe& de);
234 
237  virtual bool save(const std::string& origFilename,
238  const std::string& cachedFilename, bool optimize);
239 
240 
241  protected:
242 
248  unsigned int myFlushCycleCount;
249 
251 
253 
255  };
256 
260  {
261 
262  public:
263 
266  static DtFileCacheCreator& instance(DtDe& theIG);
267 
269  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
270 
272  virtual DtFileCache* create(DtDe& de);
273 
274  };
275 
276 }
DtDe & myDe
Definition: DtFileCache.h:243
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
unsigned int myCacheHint
Definition: DtFileCache.h:48
std::deque< std::string > FilePathList
Definition: DtFileCache.h:43
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
bool myFlipDDSTexturesFlag
Definition: DtFileCache.h:66
bool myCachingEnabled
Definition: DtFileCache.h:244
bool myUseMemoryImageCacheFlag
Definition: DtFileCache.h:59
boost::unordered_set< std::string > ExcludedExtensions
A set of extensions excluded from the cache.
Definition: DtFileCache.h:42
std::string myCacheDir
Definition: DtFileCache.h:53
bool myInstancingEnabled
Definition: DtFileCache.h:247
bool myCompressTexturesFlag
Definition: DtFileCache.h:61
bool myInstanceTexturesFlag
Definition: DtFileCache.h:60
std::multimap< std::string, void * > customPluginData
Definition: DtFileCache.h:51
bool myUseAccelerationCacheFlag
Definition: DtFileCache.h:56
The abstract creator for the abstract DtFileCache class.
Definition: DtFileCache.h:259
ExcludedExtensions myExcludedExtensionMap
Definition: DtFileCache.h:252
bool myCompressTextureFlag
Definition: DtFileCache.h:245
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:24
bool myHasNoOptions
Definition: DtFileCache.h:55
bool myCDBSource
Definition: DtFileCache.h:67
bool myOptimizeDataFlag
Definition: DtFileCache.h:64
bool myUnloadImageDataFlag
Definition: DtFileCache.h:62
std::string myOriginalPath
Definition: DtFileCache.h:54
Contains makVrv::DtVirtualBaseClass class.
DtRecordSettingsBackupInterface * mySettingsBackup
Definition: DtFileCache.h:254
The DtDeSharedState represents all the data that is shared between the master and its slaves...
Definition: DtDeSharedState.h:47
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
DtDe & getDe()
Definition: DtFileCache.h:193
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::multimap< std::string, std::string > customOptionStrings
Definition: DtFileCache.h:50
DtRecordSettingsBackupInterface * settingsBackup()
Definition: DtFileCache.h:188
Definition: DtFileCache.h:45
int myOptimizeFileLevel
Definition: DtFileCache.h:65
Record for the settings associated with the VRV caching.
Definition: DtCacheSettingsRecord.h:17
bool myInstanceNodesFlag
Definition: DtFileCache.h:58
bool myClearInstancesOnNewSceneFlag
Definition: DtFileCache.h:246
Base class to provide boost signal/slot management.
bool isExcludedExtension(const std::string &ext) const
Check if the extension is in the list of excluded file types.
Definition: DtFileCache.h:178
DtSignalConnectionManager myConnectionManager
Definition: DtFileCache.h:250
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
const DtRecordSettingsBackupInterface * settingsBackup() const
Definition: DtFileCache.h:183
The makVrv::DtRecordSettingsBackupInterface provides an interface to record-based backups...
Definition: DtRecordSettingsBackup.h:23
std::string myCDBMcodTable
Definition: DtFileCache.h:68
FilePathList myDatabasePaths
Definition: DtFileCache.h:47
Handles the caching of files. Includes functions for excluding files with certain extensions from bei...
Definition: DtFileCache.h:37
bool myEnableSequenceSynchronizationFlag
Definition: DtFileCache.h:70
unsigned int myFlushCycleCount
Definition: DtFileCache.h:248
boost::signalslib::signal< void()> signal_clearInstanceCache
Signal emmitted when clearCache is called, used to allow other caches to be cleared.
Definition: DtFileCache.h:200
Contains DLL export macros.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)