Chris@168
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@168
|
2
|
Chris@168
|
3 /*
|
Chris@168
|
4 Sonic Visualiser
|
Chris@168
|
5 An audio file viewer and annotation editor.
|
Chris@168
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@168
|
7 This file copyright 2006 Chris Cannam.
|
Chris@168
|
8
|
Chris@168
|
9 This program is free software; you can redistribute it and/or
|
Chris@168
|
10 modify it under the terms of the GNU General Public License as
|
Chris@168
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@168
|
12 License, or (at your option) any later version. See the file
|
Chris@168
|
13 COPYING included with this distribution for more information.
|
Chris@168
|
14 */
|
Chris@168
|
15
|
Chris@168
|
16 #ifndef _STORAGE_ADVISER_H_
|
Chris@168
|
17 #define _STORAGE_ADVISER_H_
|
Chris@168
|
18
|
Chris@168
|
19 /**
|
Chris@168
|
20 * A utility class designed to help decide whether to store cache data
|
Chris@168
|
21 * (for example FFT outputs) in memory or on disk in the TempDirectory.
|
Chris@168
|
22 */
|
Chris@168
|
23
|
Chris@168
|
24 class StorageAdviser
|
Chris@168
|
25 {
|
Chris@168
|
26 public:
|
Chris@168
|
27 // pass to recommend() zero or more of these OR'd together
|
Chris@168
|
28 enum Criteria {
|
Chris@168
|
29 SpeedCritical = 1,
|
Chris@168
|
30 PrecisionCritical = 2,
|
Chris@168
|
31 RepeatabilityUseful = 4
|
Chris@168
|
32 };
|
Chris@168
|
33
|
Chris@168
|
34 // recommend() returns one or two of these OR'd together
|
Chris@168
|
35 enum Recommendation {
|
Chris@168
|
36 UseMemory = 1,
|
Chris@168
|
37 UseDisc = 2,
|
Chris@168
|
38 ConserveSpace = 4,
|
Chris@168
|
39 UseAsMuchAsYouLike = 8
|
Chris@168
|
40 };
|
Chris@168
|
41
|
Chris@169
|
42 // May throw InsufficientDiscSpace exception if it looks like
|
Chris@169
|
43 // minimumSize won't fit on the disc.
|
Chris@168
|
44
|
Chris@169
|
45 /**
|
Chris@169
|
46 * Recommend where to store some data, given certain storage and
|
Chris@169
|
47 * recall criteria. The minimum size is the approximate amount of
|
Chris@169
|
48 * data in bytes that will be stored if the recommendation is to
|
Chris@169
|
49 * ConserveSpace; the maximum size is approximately the amount
|
Chris@169
|
50 * that will be used if UseAsMuchAsYouLike is returned.
|
Chris@169
|
51 **!!! sizes should be longer types
|
Chris@169
|
52 */
|
Chris@168
|
53 static Recommendation recommend(Criteria criteria,
|
Chris@168
|
54 int minimumSize,
|
Chris@168
|
55 int maximumSize);
|
Chris@168
|
56 };
|
Chris@168
|
57
|
Chris@168
|
58 #endif
|
Chris@168
|
59
|