VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtVirtualProgramCache Class Reference

class to hold a hashed map of strings to equivalent virtual programs to avoid repeated, duplicate creation of a virtual programs More...

Public Member Functions

virtual ~DtVirtualProgramCache ()
 DTOR. More...
 
virtual bool findAndSetOn (const std::string &strHash, osg::StateSet *stateSet)
 Find a vp with a hash and set it on the state set, if found. More...
 
virtual void cache (const std::string &strHash, osgEarth::VirtualProgram *virtualProgram)
 cache a virtual program with the given hash More...
 
virtual void clear ()
 clear internal cache More...
 
virtual void addRef (void)
 increase ref More...
 
virtual void removeRef (void)
 decrease ref More...
 
virtual int refCount (void) const
 get the ref count More...
 

Public Attributes

friend DtVirtualProgramCacheCreator
 so that creator can access constructor More...
 

Protected Types

typedef osg::ref_ptr
< osgEarth::VirtualProgram > 
VirtualProgramRef
 
typedef std::map< std::string,
VirtualProgramRef
StringVpMap
 

Protected Member Functions

 DtVirtualProgramCache (DtDe &de)
 protected. only creator can create More...
 

Protected Attributes

StringVpMap myMapHashesToVirtualPrograms
 
DtDemyDe
 
tbb::atomic< intmyRefCount
 
tbb::mutex myMapMutex
 

Private Member Functions

 DtVirtualProgramCache ()=delete
 not allowed More...
 
 DtVirtualProgramCache (const DtVirtualProgramCache &rhs)=delete
 not allowed More...
 
DtVirtualProgramCacheoperator= (const DtVirtualProgramCache &rhs)=delete
 not allowed More...
 

Detailed Description

class to hold a hashed map of strings to equivalent virtual programs to avoid repeated, duplicate creation of a virtual programs

Member Typedef Documentation

typedef osg::ref_ptr<osgEarth::VirtualProgram> makVrv::DtVirtualProgramCache::VirtualProgramRef
protected
typedef std::map<std::string, VirtualProgramRef> makVrv::DtVirtualProgramCache::StringVpMap
protected

Constructor & Destructor Documentation

virtual makVrv::DtVirtualProgramCache::~DtVirtualProgramCache ( )
virtual

DTOR.

makVrv::DtVirtualProgramCache::DtVirtualProgramCache ( DtDe de)
protected

protected. only creator can create

makVrv::DtVirtualProgramCache::DtVirtualProgramCache ( )
privatedelete

not allowed

makVrv::DtVirtualProgramCache::DtVirtualProgramCache ( const DtVirtualProgramCache rhs)
privatedelete

not allowed

Member Function Documentation

DtVirtualProgramCache& makVrv::DtVirtualProgramCache::operator= ( const DtVirtualProgramCache rhs)
privatedelete

not allowed

virtual bool makVrv::DtVirtualProgramCache::findAndSetOn ( const std::string &  strHash,
osg::StateSet *  stateSet 
)
virtual

Find a vp with a hash and set it on the state set, if found.

This was just a find returning a raw VP and that can get deleted from underneath/multi-threaded (was happening in cdb). The internal lock prevents this from happening.

virtual void makVrv::DtVirtualProgramCache::cache ( const std::string &  strHash,
osgEarth::VirtualProgram *  virtualProgram 
)
virtual

cache a virtual program with the given hash

virtual void makVrv::DtVirtualProgramCache::clear ( )
virtual

clear internal cache

virtual void makVrv::DtVirtualProgramCache::addRef ( void  )
virtual

increase ref

virtual void makVrv::DtVirtualProgramCache::removeRef ( void  )
virtual

decrease ref

virtual int makVrv::DtVirtualProgramCache::refCount ( void  ) const
virtual

get the ref count

Member Data Documentation

friend makVrv::DtVirtualProgramCache::DtVirtualProgramCacheCreator

so that creator can access constructor

StringVpMap makVrv::DtVirtualProgramCache::myMapHashesToVirtualPrograms
protected
DtDe& makVrv::DtVirtualProgramCache::myDe
protected
tbb::atomic<int> makVrv::DtVirtualProgramCache::myRefCount
protected
tbb::mutex makVrv::DtVirtualProgramCache::myMapMutex
mutableprotected

The documentation for this class was generated from the following file:

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)