OmniSciDB  04ee39c94c
BufferSeg.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BUFFERSEG_H
18 #define BUFFERSEG_H
19 
20 #include <list>
21 
22 namespace Buffer_Namespace {
23 
24 class Buffer; // forward declaration
25 
26 // Memory Pages types in buffer pool
27 enum MemStatus { FREE, USED };
28 
29 struct BufferSeg {
30  int startPage;
31  size_t numPages;
35  unsigned int pinCount;
36  int slabNum;
37  unsigned int lastTouched;
38 
39  BufferSeg() : memStatus(FREE), buffer(0), pinCount(0), slabNum(-1), lastTouched(0) {}
40  BufferSeg(const int startPage, const size_t numPages)
41  : startPage(startPage)
42  , numPages(numPages)
43  , memStatus(FREE)
44  , buffer(0)
45  , pinCount(0)
46  , slabNum(-1)
47  , lastTouched(0) {}
48  BufferSeg(const int startPage, const size_t numPages, const MemStatus memStatus)
49  : startPage(startPage)
50  , numPages(numPages)
51  , memStatus(memStatus)
52  , buffer(0)
53  , pinCount(0)
54  , slabNum(-1)
55  , lastTouched(0) {}
56  BufferSeg(const int startPage,
57  const size_t numPages,
58  const MemStatus memStatus,
59  const int lastTouched)
60  : startPage(startPage)
61  , numPages(numPages)
62  , memStatus(memStatus)
63  , buffer(0)
64  , pinCount(0)
65  , slabNum(-1)
66  , lastTouched(lastTouched) {}
67 };
68 
69 using BufferList = std::list<BufferSeg>;
70 } // namespace Buffer_Namespace
71 
72 #endif
BufferSeg(const int startPage, const size_t numPages)
Definition: BufferSeg.h:40
BufferSeg(const int startPage, const size_t numPages, const MemStatus memStatus, const int lastTouched)
Definition: BufferSeg.h:56
BufferSeg(const int startPage, const size_t numPages, const MemStatus memStatus)
Definition: BufferSeg.h:48
unsigned int lastTouched
Definition: BufferSeg.h:37
std::vector< int > ChunkKey
Definition: types.h:35
std::list< BufferSeg > BufferList
Definition: BufferSeg.h:69
Note(s): Forbid Copying Idiom 4.1.
Definition: Buffer.h:45