StorageAdviser Class Reference

#include <StorageAdviser.h>

List of all members.


Detailed Description

A utility class designed to help decide whether to store cache data (for example FFT outputs) in memory or on disk in the TempDirectory.

This is basically a compendium of simple rules of thumb.

Definition at line 26 of file StorageAdviser.h.

Public Types

enum  Criteria {
  NoCriteria = 0, SpeedCritical = 1, PrecisionCritical = 2, LongRetentionLikely = 4,
  FrequentLookupLikely = 8
}
enum  Recommendation {
  NoRecommendation = 0, UseMemory = 1, PreferMemory = 2, PreferDisc = 4,
  UseDisc = 8, ConserveSpace = 16, UseAsMuchAsYouLike = 32
}
enum  AllocationArea { MemoryAllocation, DiscAllocation }

Static Public Member Functions

static Recommendation recommend (Criteria criteria, int minimumSize, int maximumSize)
 Recommend where to store some data, given certain storage and recall criteria.
static void notifyPlannedAllocation (AllocationArea area, int size)
 Specify that we are planning to use a given amount of storage (in kilobytes), but haven't allocated it yet.
static void notifyDoneAllocation (AllocationArea area, int size)
 Specify that we have now allocated, or abandoned the allocation of, the given amount (in kilobytes) of a storage area that was previously notified using notifyPlannedAllocation.

Static Private Attributes

static long m_discPlanned
static long m_memoryPlanned


Member Enumeration Documentation

enum StorageAdviser::Criteria

Enumerator:
NoCriteria 
SpeedCritical 
PrecisionCritical 
LongRetentionLikely 
FrequentLookupLikely 

Definition at line 30 of file StorageAdviser.h.

enum StorageAdviser::Recommendation

Enumerator:
NoRecommendation 
UseMemory 
PreferMemory 
PreferDisc 
UseDisc 
ConserveSpace 
UseAsMuchAsYouLike 

Definition at line 39 of file StorageAdviser.h.

enum StorageAdviser::AllocationArea

Enumerator:
MemoryAllocation 
DiscAllocation 

Definition at line 63 of file StorageAdviser.h.


Member Function Documentation

StorageAdviser::Recommendation StorageAdviser::recommend ( Criteria  criteria,
int  minimumSize,
int  maximumSize 
) [static]

Recommend where to store some data, given certain storage and recall criteria.

The minimum size is the approximate amount of data in kilobytes that will be stored if the recommendation is to ConserveSpace; the maximum size is approximately the amount that will be used if UseAsMuchAsYouLike is returned.

May throw InsufficientDiscSpace exception if there appears to be nowhere the minimum amount of data can be stored.

!! We have a potentially serious problem here if multiple

Definition at line 31 of file StorageAdviser.cpp.

References ConserveSpace, FrequentLookupLikely, GetDiscSpaceMBAvailable(), TempDirectory::getInstance(), TempDirectory::getPath(), GetRealMemoryMBAvailable(), LongRetentionLikely, m_discPlanned, m_memoryPlanned, NoRecommendation, PrecisionCritical, PreferDisc, PreferMemory, SpeedCritical, UseAsMuchAsYouLike, UseDisc, and UseMemory.

Referenced by FFTDataServer::getStorageAdvice().

void StorageAdviser::notifyPlannedAllocation ( AllocationArea  area,
int  size 
) [static]

Specify that we are planning to use a given amount of storage (in kilobytes), but haven't allocated it yet.

Definition at line 175 of file StorageAdviser.cpp.

References DiscAllocation, m_discPlanned, m_memoryPlanned, and MemoryAllocation.

void StorageAdviser::notifyDoneAllocation ( AllocationArea  area,
int  size 
) [static]

Specify that we have now allocated, or abandoned the allocation of, the given amount (in kilobytes) of a storage area that was previously notified using notifyPlannedAllocation.

Definition at line 184 of file StorageAdviser.cpp.

References DiscAllocation, m_discPlanned, m_memoryPlanned, and MemoryAllocation.


Member Data Documentation

long StorageAdviser::m_discPlanned [static, private]

Definition at line 82 of file StorageAdviser.h.

Referenced by notifyDoneAllocation(), notifyPlannedAllocation(), and recommend().

long StorageAdviser::m_memoryPlanned [static, private]

Definition at line 83 of file StorageAdviser.h.

Referenced by notifyDoneAllocation(), notifyPlannedAllocation(), and recommend().


The documentation for this class was generated from the following files:
Generated on Wed Feb 20 15:45:36 2008 for SonicVisualiser by  doxygen 1.5.1