svcore  1.9
StorageAdviser.h
Go to the documentation of this file.
1 
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3 
4 /*
5  Sonic Visualiser
6  An audio file viewer and annotation editor.
7  Centre for Digital Music, Queen Mary, University of London.
8  This file copyright 2006 QMUL.
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License as
12  published by the Free Software Foundation; either version 2 of the
13  License, or (at your option) any later version. See the file
14  COPYING included with this distribution for more information.
15 */
16 
17 #ifndef _STORAGE_ADVISER_H_
18 #define _STORAGE_ADVISER_H_
19 
27 {
28 public:
29  // pass to recommend() zero or more of these OR'd together
30  enum Criteria {
36  };
37 
38  // recommend() returns one or two of these OR'd together
41  UseMemory = 1, // Disc is strongly contraindicated
42  PreferMemory = 2, // Either would do; memory probably better
43  PreferDisc = 4, // Either would do; disc probably better
44  UseDisc = 8, // Probably won't fit in memory
45  ConserveSpace = 16,// Whatever you choose, keep it compact
46  UseAsMuchAsYouLike = 32 // Take my advice and there'll be space for all
47  };
48 
59  static Recommendation recommend(Criteria criteria,
60  int minimumSize,
61  int maximumSize);
62 
66  };
67 
72  static void notifyPlannedAllocation(AllocationArea area, int size);
73 
79  static void notifyDoneAllocation(AllocationArea area, int size);
80 
86  static void setFixedRecommendation(Recommendation recommendation);
87 
88 private:
89  static long m_discPlanned;
90  static long m_memoryPlanned;
92 };
93 
94 #endif
95 
A utility class designed to help decide whether to store cache data (for example FFT outputs) in memo...
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 i...
static long m_memoryPlanned
static long m_discPlanned
static Recommendation m_baseRecommendation
static void notifyDoneAllocation(AllocationArea area, int size)
Specify that we have now allocated, or abandoned the allocation of, the given amount (in kilobytes) o...
static Recommendation recommend(Criteria criteria, int minimumSize, int maximumSize)
Recommend where to store some data, given certain storage and recall criteria.
static void setFixedRecommendation(Recommendation recommendation)
Force all subsequent recommendations to use the (perhaps partial) specification given here.