VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes
makVrv::DtOsgReferencedCollection< OsgObject > Class Template Reference

A thread safe collection, used by the mult-threaded cache, of OSG referenced objects. More...

Inheritance diagram for makVrv::DtOsgReferencedCollection< OsgObject >:
Inheritance graph
[legend]

Classes

struct  FindReference

Public Types

typedef boost::unordered_map
< std::string, osg::ref_ptr
< OsgObject > > 
InstanceMap
typedef std::vector< std::pair
< std::string, OsgObject * > > 
ReferenceList

Public Member Functions

 DtOsgReferencedCollection (unsigned int initialCapacity)
 Constructor.
void lock ()
 Lock the collection.
ReferenceListgetUnsafeList ()
 Get the unsafe list, to make this safe you MUST lock the collection first.
InstanceMapgetUnsafeMap ()
 Get the unsafe map, to make this safe you MUST lock the collection first.
void unlock ()
 Unlock the collection.
bool find (const std::string &name, osg::ref_ptr< OsgObject > &object)
 Find an object with a given name or save the name as pending.
void insert (const std::string &name, const osg::ref_ptr< OsgObject > &obj)
 Insert an instance into the cache.
void releaseGLObjects (osg::State *state)
 Release GL objects on all objects in the cache.
void clear ()
 Clears all of the instances.
osg::ref_ptr< OsgObject > find (const std::string &filename)
 Look for an object and return a value (null or not).
bool findTexture (const std::string &filename, osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, osg::Texture::WrapMode s, osg::Texture::WrapMode t, osg::ref_ptr< osg::Texture > &texture)
 Find a texture with the given image name.
void addTexture (const std::string &filename, osg::ref_ptr< osg::Texture > texture, bool unloadImageDataFlag, bool compressTexturesFlag, std::string alternateFilename="")
 add a texture for the given image name.
unsigned int flush ()
 Do a partial flush of items.
unsigned int partialFlush (unsigned int maxToCheck, unsigned int maxToFlush)
 Do a partial flush of items.
unsigned int partialFlushTextures (unsigned int maxToCheck, unsigned int maxToFlush)
 Do a partial flush of items.

Protected Types

typedef boost::unordered_set
< std::string > 
PendingSet

Protected Attributes

boost::mutex myMutex
InstanceMap myInstanceMap
ReferenceList myRefInstanceList
PendingSet myPendingInstances
unsigned int myPartialFlushIndex

Detailed Description

template<typename OsgObject>
class makVrv::DtOsgReferencedCollection< OsgObject >

A thread safe collection, used by the mult-threaded cache, of OSG referenced objects.

Member Typedef Documentation

template<typename OsgObject>
typedef boost::unordered_map<std::string,osg::ref_ptr<OsgObject> > makVrv::DtOsgReferencedCollection< OsgObject >::InstanceMap
template<typename OsgObject>
typedef std::vector<std::pair<std::string,OsgObject*> > makVrv::DtOsgReferencedCollection< OsgObject >::ReferenceList
template<typename OsgObject>
typedef boost::unordered_set<std::string> makVrv::DtOsgReferencedCollection< OsgObject >::PendingSet
protected

Constructor & Destructor Documentation

template<typename OsgObject>
makVrv::DtOsgReferencedCollection< OsgObject >::DtOsgReferencedCollection ( unsigned int  initialCapacity)

Constructor.

Member Function Documentation

template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::lock ( )
inline

Lock the collection.

Warning
This WILL cause deadlock if you make any calls other than to the unsafe list and map.
template<typename OsgObject>
ReferenceList& makVrv::DtOsgReferencedCollection< OsgObject >::getUnsafeList ( )
inline

Get the unsafe list, to make this safe you MUST lock the collection first.

template<typename OsgObject>
InstanceMap& makVrv::DtOsgReferencedCollection< OsgObject >::getUnsafeMap ( )
inline

Get the unsafe map, to make this safe you MUST lock the collection first.

template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::unlock ( )
inline

Unlock the collection.

template<typename OsgObject>
bool makVrv::DtOsgReferencedCollection< OsgObject >::find ( const std::string &  name,
osg::ref_ptr< OsgObject > &  object 
)

Find an object with a given name or save the name as pending.

This function will block if the object name was already pending.

Returns
true if the object was found, and the value should be returned. //! A returned value may be NULL if there was a problem with the object pending.
template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::insert ( const std::string &  name,
const osg::ref_ptr< OsgObject > &  obj 
)

Insert an instance into the cache.

template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::releaseGLObjects ( osg::State *  state)

Release GL objects on all objects in the cache.

template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::clear ( )

Clears all of the instances.

template<typename OsgObject>
osg::ref_ptr<OsgObject> makVrv::DtOsgReferencedCollection< OsgObject >::find ( const std::string &  filename)

Look for an object and return a value (null or not).

template<typename OsgObject>
bool makVrv::DtOsgReferencedCollection< OsgObject >::findTexture ( const std::string &  filename,
osg::Texture::FilterMode  minFilter,
osg::Texture::FilterMode  magFilter,
osg::Texture::WrapMode  s,
osg::Texture::WrapMode  t,
osg::ref_ptr< osg::Texture > &  texture 
)

Find a texture with the given image name.

Returns
whether or not the texture was found.
template<typename OsgObject>
void makVrv::DtOsgReferencedCollection< OsgObject >::addTexture ( const std::string &  filename,
osg::ref_ptr< osg::Texture >  texture,
bool  unloadImageDataFlag,
bool  compressTexturesFlag,
std::string  alternateFilename = "" 
)

add a texture for the given image name.

also processes the texture to put on a callback for handling when an openGL context is recreated.

template<typename OsgObject>
unsigned int makVrv::DtOsgReferencedCollection< OsgObject >::flush ( )

Do a partial flush of items.

Returns
the number of items flushed.
template<typename OsgObject>
unsigned int makVrv::DtOsgReferencedCollection< OsgObject >::partialFlush ( unsigned int  maxToCheck,
unsigned int  maxToFlush 
)

Do a partial flush of items.

Returns
the number of items flushed.
template<typename OsgObject>
unsigned int makVrv::DtOsgReferencedCollection< OsgObject >::partialFlushTextures ( unsigned int  maxToCheck,
unsigned int  maxToFlush 
)

Do a partial flush of items.

Returns
the number of items flushed.

Member Data Documentation

template<typename OsgObject>
boost::mutex makVrv::DtOsgReferencedCollection< OsgObject >::myMutex
protected
template<typename OsgObject>
InstanceMap makVrv::DtOsgReferencedCollection< OsgObject >::myInstanceMap
protected
template<typename OsgObject>
ReferenceList makVrv::DtOsgReferencedCollection< OsgObject >::myRefInstanceList
protected
template<typename OsgObject>
PendingSet makVrv::DtOsgReferencedCollection< OsgObject >::myPendingInstances
protected
template<typename OsgObject>
unsigned int makVrv::DtOsgReferencedCollection< OsgObject >::myPartialFlushIndex
protected

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

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)