comparison base/StorageAdviser.h @ 168:04baa690f90d

* Start adding StorageAdviser class to determine whether caches should be on disc or in memory
author Chris Cannam
date Mon, 25 Sep 2006 13:44:05 +0000
parents
children 603991c63ff6
comparison
equal deleted inserted replaced
167:665342c6ec57 168:04baa690f90d
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _STORAGE_ADVISER_H_
17 #define _STORAGE_ADVISER_H_
18
19 /**
20 * A utility class designed to help decide whether to store cache data
21 * (for example FFT outputs) in memory or on disk in the TempDirectory.
22 */
23
24 class StorageAdviser
25 {
26 public:
27 // pass to recommend() zero or more of these OR'd together
28 enum Criteria {
29 SpeedCritical = 1,
30 PrecisionCritical = 2,
31 RepeatabilityUseful = 4
32 };
33
34 // recommend() returns one or two of these OR'd together
35 enum Recommendation {
36 UseMemory = 1,
37 UseDisc = 2,
38 ConserveSpace = 4,
39 UseAsMuchAsYouLike = 8
40 };
41
42 // may throw InsufficientDiscSpace exception if it looks like
43 // minimumSize won't fit on the disc
44
45 static Recommendation recommend(Criteria criteria,
46 int minimumSize,
47 int maximumSize);
48 };
49
50 #endif
51