VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVirtualProgramCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <osg/ref_ptr>
17 
18 #include <string>
19 #include <map>
20 
21 namespace osg
22 {
23  class StateSet;
24 }
25 namespace osgEarth
26 {
27  class VirtualProgram;
28 }
29 
30 namespace makVrv
31 {
32  class DtDe;
33 
36 
39 
41  template <>
42  inline const char* creatorTypeName<DtVirtualProgramCache>(void) { return "DtVirtualProgramCacheCreator"; }
43 
47  {
48  public:
51 
53  virtual ~DtVirtualProgramCache();
54 
55  protected:
58 
59  private:
61  DtVirtualProgramCache() = delete;
62 
64  DtVirtualProgramCache(const DtVirtualProgramCache& rhs) = delete;
65 
67  DtVirtualProgramCache &operator=(const DtVirtualProgramCache& rhs) = delete;
68 
69  public:
73  virtual bool findAndSetOn(const std::string& strHash, osg::StateSet* stateSet);
74 
76  virtual void cache(const std::string& strHash, osgEarth::VirtualProgram* virtualProgram);
77 
79  virtual void clear();
80 
82  virtual void addRef(void);
83 
85  virtual void removeRef(void);
86 
88  virtual int refCount(void) const;
89 
90  protected:
92  typedef std::map<std::string, VirtualProgramRef> StringVpMap;
93 
95 
97 
98  tbb::atomic<int> myRefCount;
99  mutable tbb::mutex myMapMutex;
100  };
101 
102 }
const char * creatorTypeName< DtVirtualProgramCache >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtVirtualProgramCache.h:42
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
friend DtVirtualProgramCacheCreator
so that creator can access constructor
Definition: DtVirtualProgramCache.h:50
StringVpMap myMapHashesToVirtualPrograms
Definition: DtVirtualProgramCache.h:94
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
tbb::atomic< int > myRefCount
Definition: DtVirtualProgramCache.h:98
class to hold a hashed map of strings to equivalent virtual programs to avoid repeated, duplicate creation of a virtual programs
Definition: DtVirtualProgramCache.h:46
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtDe & myDe
Definition: DtVirtualProgramCache.h:96
std::map< std::string, VirtualProgramRef > StringVpMap
Definition: DtVirtualProgramCache.h:92
DtVirtualBaseClassCreator< DtVirtualProgramCache > DtVirtualProgramCacheCreator
creator
Definition: DtVirtualProgramCache.h:35
osg::ref_ptr< osgEarth::VirtualProgram > VirtualProgramRef
Definition: DtVirtualProgramCache.h:91
tbb::mutex myMapMutex
Definition: DtVirtualProgramCache.h:99

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)