VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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]

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 ()
 DTOR.
virtual void init ()
 Initialize the cache. Must be called before using.
LoadFileOptions defaultOptions () const
 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 () const
 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.
virtual void getSplitRecord (std::vector< makArchives::DtCacheSettingsRecord > &rec, std::vector< std::string > &fileNames)
 To support writing element definitions in folders as multiple files not implemented for DtFileCache.
virtual void addRecords (makArchives::DtCacheSettingsRecord &recs, makArchives::DtCacheSettingsRecord &combinedRec)
 To support writing element definitions in folders as multiple files not implemented for DtFileCache.
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.
virtual bool save (const std::string &origFilename, const std::string &cachedFilename, bool optimize)
 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

DTOR.

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

Protected CTOR.

Must be called by creator.

Must call init() after constructing before use

Member Function Documentation

virtual void makVrv::DtFileCache::init ( )
virtual

Initialize the cache. Must be called before using.

LoadFileOptions makVrv::DtFileCache::defaultOptions ( ) const

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.

virtual bool makVrv::DtFileCache::acceleratedCachingEnabled ( ) const
virtual

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.

virtual bool makVrv::DtFileCache::compressTexturesEnabled ( ) const
virtual

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.

virtual bool makVrv::DtFileCache::instancingEnabled ( ) const
virtual

Returns true if model instancing is enabled.

bool makVrv::DtFileCache::clearInstancesOnNewScene ( ) const

Returns whether to clear instances on new scene.

void makVrv::DtFileCache::setClearInstancesOnNewScene ( bool  clearInstances)

Returns whether to clear instances on new scene.

void makVrv::DtFileCache::clearInstancingCache ( )

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.

unsigned int makVrv::DtFileCache::flushCycleCount ( )

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

virtual void makVrv::DtFileCache::ts_clearInstancingCache ( )
virtual

Clear the model instance cache.

Reimplemented in makVrv::DtOsgFileCache.

virtual void makVrv::DtFileCache::setFromRecord ( const makArchives::DtCacheSettingsRecord rec)
virtual

Set the DtFileCache state from a cache settings record.

Reimplemented in makVrv::DtOsgFileCache.

virtual void makVrv::DtFileCache::getRecord ( makArchives::DtCacheSettingsRecord rec)
virtual

Fill out a cache settings record with the DtFileCache state.

virtual void makVrv::DtFileCache::getSplitRecord ( std::vector< makArchives::DtCacheSettingsRecord > &  rec,
std::vector< std::string > &  fileNames 
)
inlinevirtual

To support writing element definitions in folders as multiple files not implemented for DtFileCache.

virtual void makVrv::DtFileCache::addRecords ( makArchives::DtCacheSettingsRecord recs,
makArchives::DtCacheSettingsRecord combinedRec 
)
inlinevirtual

To support writing element definitions in folders as multiple files not implemented for DtFileCache.

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

Called from CTOR to load the default settings.

void makVrv::DtFileCache::saveAsDefaults ( )

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.

virtual ExcludedExtensions& makVrv::DtFileCache::excludedExtensions ( )
virtual

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.

const DtRecordSettingsBackupInterface* makVrv::DtFileCache::settingsBackup ( ) const
inline
DtRecordSettingsBackupInterface* makVrv::DtFileCache::settingsBackup ( )
inline
virtual void makVrv::DtFileCache::autoSaveDefaultsIfNeeded ( )
protectedvirtual

Save the default settings if necessary.

virtual bool makVrv::DtFileCache::ts_isExcludedExtension ( const std::string &  ext) const
protectedvirtual

Thread safe call.

virtual void makVrv::DtFileCache::ts_flushInstancingCache ( bool  multiPass,
bool  flushNodes,
bool  flushTextures,
bool  flushImages 
)
protectedvirtual

Thread safe call to flush the cache.

Reimplemented in makVrv::DtOsgFileCache.

virtual void makVrv::DtFileCache::addExcludedExtension ( const std::string &  ext)
protectedvirtual

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)
protectedvirtual

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,
bool  optimize 
)
protectedvirtual

Returns true if origFilename was successfully written out as cachedFilename.

Reimplemented in makVrv::DtOsgFileCache.

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

boost::signal<void ()> makVrv::DtFileCache::signal_clearInstanceCache

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

DtDe& makVrv::DtFileCache::myDe
protected
bool makVrv::DtFileCache::myCachingEnabled
protected
bool makVrv::DtFileCache::myCompressTextureFlag
protected
bool makVrv::DtFileCache::myClearInstancesOnNewSceneFlag
protected
bool makVrv::DtFileCache::myInstancingEnabled
protected
unsigned int makVrv::DtFileCache::myFlushCycleCount
protected
ExcludedExtensions makVrv::DtFileCache::myExcludedExtensionMap
protected
DtRecordSettingsBackupInterface* makVrv::DtFileCache::mySettingsBackup
protected

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)