FileMap.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 08 Swap File Bitmap */
10
11#ifndef FILEMAP_H_
12#define FILEMAP_H_
13
14#include "store/forward.h"
15
24{
25public:
26 FileMap();
27 ~FileMap();
28
37 bool setBit(sfileno num);
38
40 bool testBit(sfileno num) const;
41
48 void clearBit(sfileno num);
49
57 sfileno allocate(sfileno suggestion);
58
60 int capacity() const {return capacity_;}
61
63 int numFilesInMap() const {return usedSlots_;}
64private:
66 void grow();
67 FileMap(const FileMap &); //no copying
68 FileMap& operator=(const FileMap &); //no assignments
69
73 unsigned int usedSlots_;
75 unsigned int nwords;
76 unsigned long *bitmap;
77};
78
79#endif /* FILEMAP_H_ */
80
~FileMap()
Definition: filemap.cc:135
unsigned int nwords
number of "long ints" making up the filemap
Definition: FileMap.h:75
bool testBit(sfileno num) const
Test whether the num-th bit in the FileMap is set.
Definition: filemap.cc:92
void clearBit(sfileno num)
Definition: filemap.cc:84
unsigned long * bitmap
Definition: FileMap.h:76
void grow()
grow the FileMap (size is doubled each time, up to 2^24 bits)
Definition: filemap.cc:45
int capacity() const
return the max number of slots in the FileMap
Definition: FileMap.h:60
sfileno allocate(sfileno suggestion)
Definition: filemap.cc:104
sfileno capacity_
max number of files which can be tracked in the current store
Definition: FileMap.h:71
bool setBit(sfileno num)
Definition: filemap.cc:62
FileMap()
Definition: filemap.cc:35
FileMap(const FileMap &)
FileMap & operator=(const FileMap &)
int numFilesInMap() const
return the number of used slots in the FileMap
Definition: FileMap.h:63
unsigned int usedSlots_
used slots in the map
Definition: FileMap.h:73
signed_int32_t sfileno
Definition: forward.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors