FileMap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 SQUID_SRC_FILEMAP_H
12 #define SQUID_SRC_FILEMAP_H
13 
14 #include "store/forward.h"
15 
23 class FileMap
24 {
25 public:
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_;}
64 private:
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 /* SQUID_SRC_FILEMAP_H */
80 
unsigned int usedSlots_
used slots in the map
Definition: FileMap.h:73
~FileMap()
Definition: filemap.cc:135
unsigned long * bitmap
Definition: FileMap.h:76
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
bool setBit(sfileno num)
Definition: filemap.cc:62
int numFilesInMap() const
return the number of used slots in the FileMap
Definition: FileMap.h:63
sfileno capacity_
max number of files which can be tracked in the current store
Definition: FileMap.h:71
void grow()
grow the FileMap (size is doubled each time, up to 2^24 bits)
Definition: filemap.cc:45
signed_int32_t sfileno
Definition: forward.h:22
int capacity() const
return the max number of slots in the FileMap
Definition: FileMap.h:60
void clearBit(sfileno num)
Definition: filemap.cc:84
sfileno allocate(sfileno suggestion)
Definition: filemap.cc:104
FileMap()
Definition: filemap.cc:35
FileMap & operator=(const FileMap &)

 

Introduction

Documentation

Support

Miscellaneous