annotate 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 |
rev |
line source |
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@168
|
42 // may throw InsufficientDiscSpace exception if it looks like
|
Chris@168
|
43 // minimumSize won't fit on the disc
|
Chris@168
|
44
|
Chris@168
|
45 static Recommendation recommend(Criteria criteria,
|
Chris@168
|
46 int minimumSize,
|
Chris@168
|
47 int maximumSize);
|
Chris@168
|
48 };
|
Chris@168
|
49
|
Chris@168
|
50 #endif
|
Chris@168
|
51
|