VR-Forces 4.1.1 Class Documentation
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  LoadFileOptions defaultOptions();
78 
81  virtual bool getCachedNodeFile(const std::string& filePathIn,
82  const FilePathList& paths, std::string& cachedFilePathOut,
83  bool emitError );
84 
87  virtual bool getCachedImageFile(const std::string& filePathIn,
88  const FilePathList& paths, std::string& cachedFilePathOut,
89  bool emitError);
90 
92  virtual void setCachingEnabled(bool flag);
93 
95  virtual bool acceleratedCachingEnabled() const;
96 
101  virtual void setCompressTextures(bool compress);
102 
104  virtual bool compressTexturesEnabled() const;
105 
107  virtual void releaseResources();
108 
110  virtual void clearAccelerationCache();
111 
113  virtual void setInstancingEnabled(bool enabled);
114 
116  virtual bool instancingEnabled();
117 
119  bool clearInstancesOnNewScene() const;
120 
122  void setClearInstancesOnNewScene(bool clearInstances);
123 
125  void clearInstancingCache();
126 
131  void flushInstanceCache(bool multipass,bool flushNodes,
132  bool flushTextures, bool flushImages);
133 
136  unsigned int flushCycleCount();
137 
139  virtual void ts_clearInstancingCache();
140 
142  virtual void setFromRecord(const makArchives::DtCacheSettingsRecord& rec);
143 
145  virtual void getRecord(makArchives::DtCacheSettingsRecord& rec);
146 
148  void loadDefaults(bool loadOnlyFactorySettings = false);
149 
151  void saveAsDefaults();
152 
154  void exportSettings(const std::string& fileName);
155 
157  void importSettings(const std::string& fileName);
158 
160  virtual ExcludedExtensions& excludedExtensions();
161 
163  inline bool isExcludedExtension(const std::string& ext) const
164  {
165  return ts_isExcludedExtension(ext);
166  }
167 
168  const DtRecordSettingsBackupInterface* settingsBackup() const
169  {
170  return mySettingsBackup;
171  }
172 
174  {
175  return mySettingsBackup;
176  }
177 
180  boost::signal<void ()> signal_clearInstanceCache;
181 
182  protected:
183 
185  virtual void autoSaveDefaultsIfNeeded();
186 
188  virtual bool ts_isExcludedExtension(const std::string& ext) const;
189 
191  virtual void ts_flushInstancingCache(bool multiPass,
192  bool flushNodes, bool flushTextures, bool flushImages);
193 
196  virtual void addExcludedExtension(const std::string &ext);
197 
200  virtual void removeExcludedExtension(const std::string &ext);
201 
203  DtFileCache(DtDe& de);
204 
207  virtual bool save(const std::string& origFilename,
208  const std::string& cachedFilename);
209 
210  protected:
211 
217  unsigned int myFlushCycleCount;
218 
220 
222  };
223 
227  {
228 
229  public:
230 
233  static DtFileCacheCreator& instance(DtDe& theIG);
234 
236  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
237 
239  virtual DtFileCache* create(DtDe& de);
240 
241  };
242 
243 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)