VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtFileCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2008 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtFileCache.h,v $ $Revision: 1.14 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvCore/vrvCore.h>
16 #include <boost/signals.hpp>
17 #include <boost/unordered_set.hpp>
18 #include <string>
19 #include <deque>
20 #include <map>
21 
22 namespace makArchives
23 {
24  class DtCacheSettingsRecord;
25 }
26 
27 namespace makVrv
28 {
29  class DtDe;
30  class DtRecordSettingsBackupInterface;
31 
37  {
38  public:
39 
41  typedef boost::unordered_set<std::string> ExcludedExtensions;
42  typedef std::deque<std::string> FilePathList;
43 
45  {
47  unsigned int myCacheHint;
48 
49  std::multimap<std::string,std::string> customOptionStrings;
50 
51  std::string myCacheDir;
52  std::string myOriginalPath;
55 
60 
64  };
65 
68  friend class DtFileCacheCreator;
69 
71  friend class DtDeSharedState;
72 
74  virtual ~DtFileCache();
75 
77  virtual void init();
78 
80  LoadFileOptions defaultOptions() const;
81 
84  virtual bool getCachedNodeFile(const std::string& filePathIn,
85  const FilePathList& paths, std::string& cachedFilePathOut,
86  bool emitError );
87 
90  virtual bool getCachedImageFile(const std::string& filePathIn,
91  const FilePathList& paths, std::string& cachedFilePathOut,
92  bool emitError);
93 
95  virtual void setCachingEnabled(bool flag);
96 
98  virtual bool acceleratedCachingEnabled() const;
99 
104  virtual void setCompressTextures(bool compress);
105 
107  virtual bool compressTexturesEnabled() const;
108 
110  virtual void releaseResources();
111 
113  virtual void clearAccelerationCache();
114 
116  virtual void setInstancingEnabled(bool enabled);
117 
119  virtual bool instancingEnabled() const;
120 
122  bool clearInstancesOnNewScene() const;
123 
125  void setClearInstancesOnNewScene(bool clearInstances);
126 
128  void clearInstancingCache();
129 
134  void flushInstanceCache(bool multipass,bool flushNodes,
135  bool flushTextures, bool flushImages);
136 
139  unsigned int flushCycleCount();
140 
142  virtual void ts_clearInstancingCache();
143 
145  virtual void setFromRecord(const makArchives::DtCacheSettingsRecord& rec);
146 
148  virtual void getRecord(makArchives::DtCacheSettingsRecord& rec);
149 
152  virtual void getSplitRecord(std::vector<makArchives::DtCacheSettingsRecord>& rec,
153  std::vector<std::string>& fileNames) {};
154 
157  virtual void addRecords(makArchives::DtCacheSettingsRecord& recs,
158  makArchives::DtCacheSettingsRecord& combinedRec) {};
159 
161  void loadDefaults(bool loadOnlyFactorySettings = false);
162 
164  void saveAsDefaults();
165 
167  void exportSettings(const std::string& fileName);
168 
170  void importSettings(const std::string& fileName);
171 
173  virtual ExcludedExtensions& excludedExtensions();
174 
176  inline bool isExcludedExtension(const std::string& ext) const
177  {
178  return ts_isExcludedExtension(ext);
179  }
180 
181  const DtRecordSettingsBackupInterface* settingsBackup() const
182  {
183  return mySettingsBackup;
184  }
185 
187  {
188  return mySettingsBackup;
189  }
190 
193  boost::signal<void ()> signal_clearInstanceCache;
194 
195  protected:
196 
198  virtual void autoSaveDefaultsIfNeeded();
199 
201  virtual bool ts_isExcludedExtension(const std::string& ext) const;
202 
204  virtual void ts_flushInstancingCache(bool multiPass,
205  bool flushNodes, bool flushTextures, bool flushImages);
206 
209  virtual void addExcludedExtension(const std::string &ext);
210 
213  virtual void removeExcludedExtension(const std::string &ext);
214 
218  DtFileCache(DtDe& de);
219 
222  virtual bool save(const std::string& origFilename,
223  const std::string& cachedFilename, bool optimize);
224 
225  protected:
226 
232  unsigned int myFlushCycleCount;
233 
235 
237  };
238 
242  {
243 
244  public:
245 
248  static DtFileCacheCreator& instance(DtDe& theIG);
249 
251  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
252 
254  virtual DtFileCache* create(DtDe& de);
255 
256  };
257 
258 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)