VR-Forces 4.0.4 Class Documentation
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
makVrv::DtFileCache Class Reference

Handles the caching of files. More...

Inheritance diagram for makVrv::DtFileCache:
Inheritance graph
[legend]

List of all members.

Classes

struct  LoadFileOptions

Public Types

typedef boost::unordered_set
< std::string > 
ExcludedExtensions
 A set of extensions excluded from the cache.
typedef std::deque< std::string > FilePathList

Public Member Functions

virtual ~DtFileCache ()
 CTOR.
LoadFileOptions defaultOptions ()
 Get the current default options.
virtual bool getCachedNodeFile (const std::string &filePathIn, const FilePathList &paths, std::string &cachedFilePathOut, bool emitError)
 Returns true if cachedFilePathOut contains the path to a cached version of filePathIn.
virtual bool getCachedImageFile (const std::string &filePathIn, const FilePathList &paths, std::string &cachedFilePathOut, bool emitError)
 Returns true if cachedFilePathOut contains the path to a cached version of filePathIn.
virtual void setCachingEnabled (bool flag)
 Toggle caching on or off.
virtual bool acceleratedCachingEnabled () const
 Returns true if caching is enabled.
virtual void setCompressTextures (bool compress)
 Set whether all textures will be compressed.
virtual bool compressTexturesEnabled () const
 Should we compress textures.
virtual void releaseResources ()
 Release all rendering resources.
virtual void clearAccelerationCache ()
 Clears the cache.
virtual void setInstancingEnabled (bool enabled)
 Sets whether model instancing is enabled.
virtual bool instancingEnabled ()
 Returns true if model instancing is enabled.
bool clearInstancesOnNewScene () const
 Returns whether to clear instances on new scene.
void setClearInstancesOnNewScene (bool clearInstances)
 Returns whether to clear instances on new scene.
void clearInstancingCache ()
 Clear the model instance cache.
void flushInstanceCache (bool multipass, bool flushNodes, bool flushTextures, bool flushImages)
 Removes all instances that only have 1 reference.
unsigned int flushCycleCount ()
 Get the flush cycle count, this is incremented each time flush instance cache is called.
virtual void ts_clearInstancingCache ()
 Clear the model instance cache.
virtual void setFromRecord (const makArchives::DtCacheSettingsRecord &rec)
 Set the DtFileCache state from a cache settings record.
virtual void getRecord (makArchives::DtCacheSettingsRecord &rec)
 Fill out a cache settings record with the DtFileCache state.
void loadDefaults (bool loadOnlyFactorySettings=false)
 Called from CTOR to load the default settings.
void saveAsDefaults ()
 Called to save the current settings as the default settings.
void exportSettings (const std::string &fileName)
 Exports the current cache settings to a file.
void importSettings (const std::string &fileName)
 Import the current cache settings from a file.
virtual ExcludedExtensionsexcludedExtensions ()
 Accessor for excluded extensions.
bool isExcludedExtension (const std::string &ext) const
 Check if the extension is in the list of excluded file types.
const
DtRecordSettingsBackupInterface
settingsBackup () const
DtRecordSettingsBackupInterfacesettingsBackup ()

Public Attributes

boost::signal< void()> signal_clearInstanceCache
 Signal emmitted when clearCache is called, used to allow other caches to be cleared.

Protected Member Functions

virtual void autoSaveDefaultsIfNeeded ()
 Save the default settings if necessary.
virtual bool ts_isExcludedExtension (const std::string &ext) const
 Thread safe call.
virtual void ts_flushInstancingCache (bool multiPass, bool flushNodes, bool flushTextures, bool flushImages)
 Thread safe call to flush the cache.
virtual void addExcludedExtension (const std::string &ext)
 Add the extension to the list of excluded file types This function can only be called in the CTOR of the file cache.
virtual void removeExcludedExtension (const std::string &ext)
 remove the extension from the list of excluded file types This function can only be called in the CTOR of the file cache.
 DtFileCache (DtDe &de)
 Protected CTOR. Must be called by creator.
virtual bool save (const std::string &origFilename, const std::string &cachedFilename)
 Returns true if origFilename was successfully written out as cachedFilename.

Protected Attributes

DtDemyDe
bool myCachingEnabled
bool myCompressTextureFlag
bool myClearInstancesOnNewSceneFlag
bool myInstancingEnabled
unsigned int myFlushCycleCount
ExcludedExtensions myExcludedExtensionMap
DtRecordSettingsBackupInterfacemySettingsBackup

Friends

class DtFileCacheCreator
 This allows the protected constructor to be called by the DtFileCacheCreator.
class DtDeSharedState
 This allows the de shared DtDeSharedState clear the cache.

Detailed Description

Handles the caching of files.

Includes functions for excluding files with certain extensions from being cached, which must be set correctly for prop extraction to work.


Member Typedef Documentation

typedef boost::unordered_set<std::string> makVrv::DtFileCache::ExcludedExtensions

A set of extensions excluded from the cache.

typedef std::deque<std::string> makVrv::DtFileCache::FilePathList

Constructor & Destructor Documentation

virtual makVrv::DtFileCache::~DtFileCache ( ) [virtual]

CTOR.

makVrv::DtFileCache::DtFileCache ( DtDe de) [protected]

Protected CTOR. Must be called by creator.


Member Function Documentation

Get the current default options.

virtual bool makVrv::DtFileCache::getCachedNodeFile ( const std::string &  filePathIn,
const FilePathList paths,
std::string &  cachedFilePathOut,
bool  emitError 
) [virtual]

Returns true if cachedFilePathOut contains the path to a cached version of filePathIn.

virtual bool makVrv::DtFileCache::getCachedImageFile ( const std::string &  filePathIn,
const FilePathList paths,
std::string &  cachedFilePathOut,
bool  emitError 
) [virtual]

Returns true if cachedFilePathOut contains the path to a cached version of filePathIn.

virtual void makVrv::DtFileCache::setCachingEnabled ( bool  flag) [virtual]

Toggle caching on or off.

Returns true if caching is enabled.

virtual void makVrv::DtFileCache::setCompressTextures ( bool  compress) [virtual]

Set whether all textures will be compressed.

This slows down texture loading unless the input file is already compressed. Only .DDS and .MEIF files support HW compressed. JPEG, PNG etc are NOT considered compressed formats.

Should we compress textures.

virtual void makVrv::DtFileCache::releaseResources ( ) [virtual]

Release all rendering resources.

Reimplemented in makVrv::DtOsgFileCache.

virtual void makVrv::DtFileCache::clearAccelerationCache ( ) [virtual]

Clears the cache.

virtual void makVrv::DtFileCache::setInstancingEnabled ( bool  enabled) [virtual]

Sets whether model instancing is enabled.

Returns true if model instancing is enabled.

Returns whether to clear instances on new scene.

Returns whether to clear instances on new scene.

Clear the model instance cache.

void makVrv::DtFileCache::flushInstanceCache ( bool  multipass,
bool  flushNodes,
bool  flushTextures,
bool  flushImages 
)

Removes all instances that only have 1 reference.

When multipass = true, while a flush causes item[s] to be removed then another flush will be called. This allows instances that are referenced by other instances to be cleared.

Get the flush cycle count, this is incremented each time flush instance cache is called.

Clear the model instance cache.

Reimplemented in makVrv::DtOsgFileCache.

Set the DtFileCache state from a cache settings record.

Fill out a cache settings record with the DtFileCache state.

void makVrv::DtFileCache::loadDefaults ( bool  loadOnlyFactorySettings = false)

Called from CTOR to load the default settings.

Called to save the current settings as the default settings.

void makVrv::DtFileCache::exportSettings ( const std::string &  fileName)

Exports the current cache settings to a file.

void makVrv::DtFileCache::importSettings ( const std::string &  fileName)

Import the current cache settings from a file.

Accessor for excluded extensions.

bool makVrv::DtFileCache::isExcludedExtension ( const std::string &  ext) const [inline]

Check if the extension is in the list of excluded file types.

virtual void makVrv::DtFileCache::autoSaveDefaultsIfNeeded ( ) [protected, virtual]

Save the default settings if necessary.

virtual bool makVrv::DtFileCache::ts_isExcludedExtension ( const std::string &  ext) const [protected, virtual]

Thread safe call.

virtual void makVrv::DtFileCache::ts_flushInstancingCache ( bool  multiPass,
bool  flushNodes,
bool  flushTextures,
bool  flushImages 
) [protected, virtual]

Thread safe call to flush the cache.

Reimplemented in makVrv::DtOsgFileCache.

virtual void makVrv::DtFileCache::addExcludedExtension ( const std::string &  ext) [protected, virtual]

Add the extension to the list of excluded file types This function can only be called in the CTOR of the file cache.

virtual void makVrv::DtFileCache::removeExcludedExtension ( const std::string &  ext) [protected, virtual]

remove the extension from the list of excluded file types This function can only be called in the CTOR of the file cache.

virtual bool makVrv::DtFileCache::save ( const std::string &  origFilename,
const std::string &  cachedFilename 
) [protected, virtual]

Returns true if origFilename was successfully written out as cachedFilename.


Friends And Related Function Documentation

friend class DtFileCacheCreator [friend]

This allows the protected constructor to be called by the DtFileCacheCreator.

friend class DtDeSharedState [friend]

This allows the de shared DtDeSharedState clear the cache.


Member Data Documentation

Signal emmitted when clearCache is called, used to allow other caches to be cleared.

unsigned int makVrv::DtFileCache::myFlushCycleCount [protected]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)