comparison base/StorageAdviser.h @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 52303ec15cd2
children adbd16d2c1e8
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
14 COPYING included with this distribution for more information. 14 COPYING included with this distribution for more information.
15 */ 15 */
16 16
17 #ifndef _STORAGE_ADVISER_H_ 17 #ifndef _STORAGE_ADVISER_H_
18 #define _STORAGE_ADVISER_H_ 18 #define _STORAGE_ADVISER_H_
19
20 #include <cstdlib>
19 21
20 /** 22 /**
21 * A utility class designed to help decide whether to store cache data 23 * A utility class designed to help decide whether to store cache data
22 * (for example FFT outputs) in memory or on disk in the TempDirectory. 24 * (for example FFT outputs) in memory or on disk in the TempDirectory.
23 * This is basically a compendium of simple rules of thumb. 25 * This is basically a compendium of simple rules of thumb.
55 * 57 *
56 * May throw InsufficientDiscSpace exception if there appears to 58 * May throw InsufficientDiscSpace exception if there appears to
57 * be nowhere the minimum amount of data can be stored. 59 * be nowhere the minimum amount of data can be stored.
58 */ 60 */
59 static Recommendation recommend(Criteria criteria, 61 static Recommendation recommend(Criteria criteria,
60 int minimumSize, 62 size_t minimumSize,
61 int maximumSize); 63 size_t maximumSize);
62 64
63 enum AllocationArea { 65 enum AllocationArea {
64 MemoryAllocation, 66 MemoryAllocation,
65 DiscAllocation 67 DiscAllocation
66 }; 68 };
67 69
68 /** 70 /**
69 * Specify that we are planning to use a given amount of storage 71 * Specify that we are planning to use a given amount of storage
70 * (in kilobytes), but haven't allocated it yet. 72 * (in kilobytes), but haven't allocated it yet.
71 */ 73 */
72 static void notifyPlannedAllocation(AllocationArea area, int size); 74 static void notifyPlannedAllocation(AllocationArea area, size_t size);
73 75
74 /** 76 /**
75 * Specify that we have now allocated, or abandoned the allocation 77 * Specify that we have now allocated, or abandoned the allocation
76 * of, the given amount (in kilobytes) of a storage area that was 78 * of, the given amount (in kilobytes) of a storage area that was
77 * previously notified using notifyPlannedAllocation. 79 * previously notified using notifyPlannedAllocation.
78 */ 80 */
79 static void notifyDoneAllocation(AllocationArea area, int size); 81 static void notifyDoneAllocation(AllocationArea area, size_t size);
80 82
81 /** 83 /**
82 * Force all subsequent recommendations to use the (perhaps 84 * Force all subsequent recommendations to use the (perhaps
83 * partial) specification given here. If NoRecommendation given 85 * partial) specification given here. If NoRecommendation given
84 * here, this will reset to the default free behaviour. 86 * here, this will reset to the default free behaviour.
85 */ 87 */
86 static void setFixedRecommendation(Recommendation recommendation); 88 static void setFixedRecommendation(Recommendation recommendation);
87 89
88 private: 90 private:
89 static long m_discPlanned; 91 static size_t m_discPlanned;
90 static long m_memoryPlanned; 92 static size_t m_memoryPlanned;
91 static Recommendation m_baseRecommendation; 93 static Recommendation m_baseRecommendation;
92 }; 94 };
93 95
94 #endif 96 #endif
95 97