vtkCacheManager Class Reference

#include <vtkCacheManager.h>

Inheritance diagram for vtkCacheManager:

List of all members.

Public Types

enum  { NoCachedFile = 0, OldCachedFile, CachedFile }

in case we need these.

enum  {
  InsufficientFreeBufferEvent = 21000, CacheLimitExceededEvent, CacheDeleteEvent, CacheClearEvent,
  SettingsUpdateEvent, CacheDirtyEvent

in case we need these.


Public Member Functions

const charAddCachePathToFilename (const char *filename)
virtual int CachedFileExists (const char *filename)
void CacheSizeCheck ()
bool CacheSizeQuickCheck ()
int ClearCache ()
int ClearCacheCheck ()
float ComputeCacheSize (const char *dirname, unsigned long size)
void DeleteFromCache (const char *target)
 Remove a target directory or file from the cache.
void DeleteFromCachedFileList (const char *target)
const charEncodeURI (const char *uri)
const charFindCachedFile (const char *target, const char *dirname)
void FreeCacheBufferCheck ()
int GetCachedFileList (const char *dirname)
float GetCurrentCacheSize ()
const charGetFileFromURIMap (const char *uri)
const charGetFilenameFromURI (const char *uri)
float GetFreeCacheSpaceRemaining ()
const charGetRemoteCacheDirectory ()
virtual int IsLocalReference (const char *uri)
virtual int IsRemoteReference (const char *uri)
virtual int LocalFileExists (const char *uri)
void MapFileToURI (const char *uri, const char *fname)
void MarkNode (std::string)
void MarkNodesBeforeDeletingDataFromCache (const char *)
void PrintSelf (ostream &os, vtkIndent indent)
void SetEnableForceRedownload (int)
void SetMRMLScene (vtkMRMLScene *scene)
virtual void SetRemoteCacheDirectory (const char *dir)
void SetRemoteCacheFreeBufferSize (int)
void SetRemoteCacheLimit (int)
void UpdateCacheInformation ()
 vtkGetMacro (EnableForceRedownload, int)
 vtkGetMacro (RemoteCacheFreeBufferSize, int)
 vtkGetMacro (RemoteCacheLimit, int)
 vtkGetMacro (InsufficientFreeBufferNotificationFlag, int)
 vtkSetMacro (CurrentCacheSize, float)
 vtkSetMacro (InsufficientFreeBufferNotificationFlag, int)
 vtkTypeRevisionMacro (vtkCacheManager, vtkObject)

Static Public Member Functions

static vtkCacheManagerNew ()
 The Usual vtk class functions.

Public Attributes

std::map< std::string,
std::string > 

Protected Member Functions

void operator= (const vtkCacheManager &)
 vtkCacheManager (const vtkCacheManager &)
 vtkCacheManager ()
virtual ~vtkCacheManager ()

Protected Attributes


Private Member Functions

std::vector< std::string > GetAllCachedFiles ()

Private Attributes

std::vector< std::string > CachedFileList
float CurrentCacheSize
int EnableForceRedownload
int InsufficientFreeBufferNotificationFlag
std::string RemoteCacheDirectory
int RemoteCacheFreeBufferSize
int RemoteCacheLimit

Member Enumeration Documentation

anonymous enum

in case we need these.

anonymous enum

in case we need these.


Constructor & Destructor Documentation

vtkCacheManager::vtkCacheManager (  )  [protected]
vtkCacheManager::~vtkCacheManager (  )  [protected, virtual]
vtkCacheManager::vtkCacheManager ( const vtkCacheManager  )  [protected]

Member Function Documentation

const char * vtkCacheManager::AddCachePathToFilename ( const char filename  ) 
int vtkCacheManager::CachedFileExists ( const char filename  )  [virtual]

Checks to see if the The uri provided exists on disk. If not, it appends the Remote Cache Directory path and checks again, in case no path was provided. If neither exists, returns 0. If one exists, returns 1.

References RemoteCacheDirectory.

Referenced by vtkDataIOManagerLogic::DeleteDataTransferFromCache(), vtkSlicerDataTransferWidget::DeleteTransferFromCache(), and vtkDataIOManagerLogic::QueueRead().

void vtkCacheManager::CacheSizeCheck (  ) 
bool vtkCacheManager::CacheSizeQuickCheck (  ) 
int vtkCacheManager::ClearCache (  ) 

Removes all files from the cachedir and removes all filenames from CachedFileList

References CacheClearEvent, MarkNodesBeforeDeletingDataFromCache(), FW::Actions::Modified, RemoteCacheDirectory, and UpdateCacheInformation().

Referenced by vtkDataIOManagerLogic::ClearCache().

int vtkCacheManager::ClearCacheCheck (  ) 

This method is called after ClearCache(), to see if that method actually cleaned the cache. If not, an event (CacheDirtyEvent) is invoked.

References CacheDirtyEvent, and GetRemoteCacheDirectory().

float vtkCacheManager::ComputeCacheSize ( const char dirname,
unsigned long  size 
void vtkCacheManager::DeleteFromCache ( const char target  ) 
void vtkCacheManager::DeleteFromCachedFileList ( const char target  ) 

Removes a target from the list of locally cached files and directories

References CachedFileList.

Referenced by DeleteFromCache().

const char * vtkCacheManager::EncodeURI ( const char uri  ) 

References mathExample::n.

const char * vtkCacheManager::FindCachedFile ( const char target,
const char dirname 

Takes a filename and a dirname (usually called with the RemoteCachedDirectory) and returns the full path of the filename if it exists under the dirname.

---compute dir and filename for recursive hunt

References GetRemoteCacheDirectory(), mathExample::n, and result.

Referenced by DeleteFromCache().

void vtkCacheManager::FreeCacheBufferCheck (  ) 
std::vector< std::string > vtkCacheManager::GetAllCachedFiles (  )  [private]
int vtkCacheManager::GetCachedFileList ( const char dirname  ) 
float vtkCacheManager::GetCurrentCacheSize (  ) 
const char * vtkCacheManager::GetFileFromURIMap ( const char uri  ) 

References uriMap.

Referenced by GetFilenameFromURI().

const char * vtkCacheManager::GetFilenameFromURI ( const char uri  ) 

Extracts the filename from the URI and prepends the Remote Cache Directory path to it. Returns the full path. NOTE: this method looks at a filename's extension and if appended version numbers have been added, it attempts to strip them out of the extension and add them to the filenamebase. So filename.nrrd_010 would become filename.nrrd. This will cause problems for any file type with an '_' in its extension.

References fileName, GetFileFromURIMap(), GetRemoteCacheDirectory(), and mathExample::n.

Referenced by vtkDataIOManager::QueueRead(), vtkDataIOManagerLogic::QueueRead(), and vtkMRMLStorageNode::StageReadData().

float vtkCacheManager::GetFreeCacheSpaceRemaining (  ) 
const char* vtkCacheManager::GetRemoteCacheDirectory (  )  [inline]
int vtkCacheManager::IsLocalReference ( const char uri  )  [virtual]

Looks for a 'file://' in the uri and if present, returns true.

References slicer::vtk::prefix.

int vtkCacheManager::IsRemoteReference ( const char uri  )  [virtual]

Checks to see if a uri appears to point to remote location and returns true if so. Looks for a '://' and if present, checks to see if the prefix is 'file'. If not 'file' but the thing:/// pattern exists, then returns true.

References slicer::vtk::prefix.

int vtkCacheManager::LocalFileExists ( const char uri  )  [virtual]

Checks to see if a uri is a file on disk and returns true if so. Strips off a file:/// prefix if present, and expects an absolute path.

References slicer::vtk::prefix.

void vtkCacheManager::MapFileToURI ( const char uri,
const char fname 

References uriMap.

void vtkCacheManager::MarkNode ( std::string  str  ) 
void vtkCacheManager::MarkNodesBeforeDeletingDataFromCache ( const char target  ) 

Before a file or directory is deleted, Marks any nodes that hold the uri as a reference as modified since read.

--- check in subdir too...

References MarkNode().

Referenced by ClearCache(), and DeleteFromCache().

static vtkCacheManager* vtkCacheManager::New (  )  [static]

The Usual vtk class functions.

Referenced by Slicer3Helper::AddDataIOToScene(), and vtkCacheManager().

void vtkCacheManager::operator= ( const vtkCacheManager  )  [protected]
void vtkCacheManager::PrintSelf ( ostream &  os,
vtkIndent  indent 
void vtkCacheManager::SetEnableForceRedownload ( int  val  ) 
void vtkCacheManager::SetMRMLScene ( vtkMRMLScene scene  )  [inline]
void vtkCacheManager::SetRemoteCacheDirectory ( const char dir  )  [virtual]

Sets the name of the directory to use for local file caching Does some checking to make sure this is a valid directory on the local system. Makes sure there's NO "/" at the end of the string, or kwsys/SystemTools will not see as a valid dir.

References GetRemoteCacheDirectory(), len, MRMLScene, mathExample::n, RemoteCacheDirectory, and SettingsUpdateEvent.

Referenced by vtkSlicerApplicationGUI::ConfigureRemoteIOSettings().

void vtkCacheManager::SetRemoteCacheFreeBufferSize ( int  val  ) 
void vtkCacheManager::SetRemoteCacheLimit ( int  val  ) 
void vtkCacheManager::UpdateCacheInformation (  ) 

Called when a file is loaded or removed from the cache.

References CachedFileList, GetCachedFileList(), and GetRemoteCacheDirectory().

Referenced by ClearCache(), and DeleteFromCache().

vtkCacheManager::vtkGetMacro ( EnableForceRedownload  ,
vtkCacheManager::vtkGetMacro ( RemoteCacheFreeBufferSize  ,
vtkCacheManager::vtkGetMacro ( RemoteCacheLimit  ,
vtkCacheManager::vtkGetMacro ( InsufficientFreeBufferNotificationFlag  ,
vtkCacheManager::vtkSetMacro ( CurrentCacheSize  ,
vtkCacheManager::vtkSetMacro ( InsufficientFreeBufferNotificationFlag  ,
vtkCacheManager::vtkTypeRevisionMacro ( vtkCacheManager  ,

Member Data Documentation

std::vector< std::string > vtkCacheManager::CachedFileList [private]

This array contains a list of cached file names (without paths) in case it's faster to search thru this list than to snuffle thru a large cache dir. Must keep current with every download, remove from cache, and clearcache call.

Referenced by DeleteFromCachedFileList(), GetAllCachedFiles(), GetCachedFileList(), UpdateCacheInformation(), vtkCacheManager(), and ~vtkCacheManager().

Holder for callback

Referenced by vtkCacheManager(), and ~vtkCacheManager().

std::map<std::string, std::string> vtkCacheManager::uriMap

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

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1