VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtPossibleFileNamesCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <map>
15 
16 #include <boost/thread.hpp>
17 
18 #include <unordered_map>
19 #include <tbb/spin_rw_mutex.h>
20 #include <set>
21 
22 namespace makVrv
23 {
24  class DtDe;
28  {
29  public:
32 
34  virtual ~DtPossibleFileNamesCache();
35 
37  virtual bool hasUnderScoreInPossibleFileNames(void) const;
38 
40  virtual bool keyExists(const std::string& key) const;
41 
43  virtual void updateCache(const std::string& texturePath);
44 
46  {
47  public:
48  virtual void doOperation(const std::string& possibleFileName) = 0;
49  virtual bool doContinue() const = 0;
50  };
51 
56  virtual void transform(TextureFileNameOperation* op) const;
57 
60  static void clear();
61 
62  protected:
64  std::string getPrefix(const std::string& texPath);
65 
66  protected:
67  typedef std::map<std::string, std::string> FileNameMap;
69  std::string myTexturePath;
70 
71  mutable boost::mutex myMutex;
72 
73  // shared data to avoid investigating the same directories over and over again
74  static tbb::spin_rw_mutex theMapMutex;
75  // for a directory, map lowercase to their original RegularCase names
76  static std::unordered_map<std::string, std::unordered_map<std::string, std::string> > theDirRegToLowerCaseFileMap;
77  // for a directory, keep an ordered set of lowercase file names
78  // (to help when we look for prefix matches based on incoming files)
79  static std::unordered_map<std::string, std::set<std::string> > theDirLowerCaseFileSet;
80 
82  };
83 }
Definition: DtPossibleFileNamesCache.h:45
boost::mutex myMutex
Definition: DtPossibleFileNamesCache.h:71
A thread safe cache containing a list of possible file names for effect textures, based on the curren...
Definition: DtPossibleFileNamesCache.h:27
std::map< std::string, std::string > FileNameMap
Definition: DtPossibleFileNamesCache.h:67
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
static std::unordered_map< std::string, std::set< std::string > > theDirLowerCaseFileSet
Definition: DtPossibleFileNamesCache.h:79
FileNameMap myPossibleFileNames
Definition: DtPossibleFileNamesCache.h:68
static tbb::spin_rw_mutex theMapMutex
Definition: DtPossibleFileNamesCache.h:74
Contains DLL export macros.
std::string myTexturePath
Definition: DtPossibleFileNamesCache.h:69
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
static std::unordered_map< std::string, std::unordered_map< std::string, std::string > > theDirRegToLowerCaseFileMap
Definition: DtPossibleFileNamesCache.h:76
DtDe & myDe
Definition: DtPossibleFileNamesCache.h:81

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)