diff base/StorageAdviser.h @ 170:b23eea68357e

* flesh out StorageAdviser
author Chris Cannam
date Tue, 26 Sep 2006 12:58:12 +0000
parents 603991c63ff6
children 91fdc752e540
line wrap: on
line diff
--- a/base/StorageAdviser.h	Mon Sep 25 20:32:44 2006 +0000
+++ b/base/StorageAdviser.h	Tue Sep 26 12:58:12 2006 +0000
@@ -19,6 +19,7 @@
 /**
  * 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.
  */
 
 class StorageAdviser
@@ -26,29 +27,33 @@
 public:
     // pass to recommend() zero or more of these OR'd together
     enum Criteria {
-        SpeedCritical       = 1,
-        PrecisionCritical   = 2,
-        RepeatabilityUseful = 4
+        NoCriteria           = 0,
+        SpeedCritical        = 1,
+        PrecisionCritical    = 2,
+        LongRetentionLikely  = 4,
+        FrequentLookupLikely = 8
     };
 
     // recommend() returns one or two of these OR'd together
     enum Recommendation {
-        UseMemory          = 1,
-        UseDisc            = 2,
-        ConserveSpace      = 4,
-        UseAsMuchAsYouLike = 8
+        NoRecommendation   = 0,
+        UseMemory          = 1, // Disc is strongly contraindicated
+        PreferMemory       = 2, // Either would do; memory probably better
+        PreferDisc         = 4, // Either would do; disc probably better
+        UseDisc            = 8, // Probably won't fit in memory
+        ConserveSpace      = 16,// Whatever you choose, keep it compact
+        UseAsMuchAsYouLike = 32 // Take my advice and there'll be space for all
     };
 
-    // May throw InsufficientDiscSpace exception if it looks like
-    // minimumSize won't fit on the disc.  
-
     /**
      * Recommend where to store some data, given certain storage and
      * recall criteria.  The minimum size is the approximate amount of
-     * data in bytes that will be stored if the recommendation is to
-     * ConserveSpace; the maximum size is approximately the amount
+     * 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.
-     **!!! sizes should be longer types
+     *
+     * May throw InsufficientDiscSpace exception if there appears to
+     * be nowhere the minimum amount of data can be stored.
      */
     static Recommendation recommend(Criteria criteria,
                                     int minimumSize,