VR-Forces Development_Version 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();
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();
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 
151  void loadDefaults(bool loadOnlyFactorySettings = false);
152 
154  void saveAsDefaults();
155 
157  void exportSettings(const std::string& fileName);
158 
160  void importSettings(const std::string& fileName);
161 
163  virtual ExcludedExtensions& excludedExtensions();
164 
166  inline bool isExcludedExtension(const std::string& ext) const
167  {
168  return ts_isExcludedExtension(ext);
169  }
170 
171  const DtRecordSettingsBackupInterface* settingsBackup() const
172  {
173  return mySettingsBackup;
174  }
175 
177  {
178  return mySettingsBackup;
179  }
180 
183  boost::signal<void ()> signal_clearInstanceCache;
184 
185  protected:
186 
188  virtual void autoSaveDefaultsIfNeeded();
189 
191  virtual bool ts_isExcludedExtension(const std::string& ext) const;
192 
194  virtual void ts_flushInstancingCache(bool multiPass,
195  bool flushNodes, bool flushTextures, bool flushImages);
196 
199  virtual void addExcludedExtension(const std::string &ext);
200 
203  virtual void removeExcludedExtension(const std::string &ext);
204 
208  DtFileCache(DtDe& de);
209 
212  virtual bool save(const std::string& origFilename,
213  const std::string& cachedFilename);
214 
215  protected:
216 
222  unsigned int myFlushCycleCount;
223 
225 
227  };
228 
232  {
233 
234  public:
235 
238  static DtFileCacheCreator& instance(DtDe& theIG);
239 
241  static void registerInstance(DtDe& de, DtFileCacheCreator* instance);
242 
244  virtual DtFileCache* create(DtDe& de);
245 
246  };
247 
248 }

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)