OpenSDN source code
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
index_allocator.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3
*/
4
5
#ifndef ctrlplane_index_allocator_h
6
#define ctrlplane_index_allocator_h
7
8
#include <assert.h>
9
#include <inttypes.h>
10
#include <string>
11
#include <vector>
12
#include <
base/bitset.h
>
13
14
class
IndexAllocator
{
15
public
:
16
IndexAllocator
(
size_t
max_index)
17
:
max_index_
(max_index),
last_index_
(
BitSet
::npos) { }
18
19
size_t
AllocIndex
();
20
void
FreeIndex
(
size_t
index);
21
bool
NoneIndexSet
();
22
bool
AnyIndexSet
();
23
24
private
:
25
BitSet
bitset_
;
26
size_t
max_index_
;
27
size_t
last_index_
;
28
};
29
30
#endif
IndexAllocator::last_index_
size_t last_index_
Definition:
index_allocator.h:27
IndexAllocator
Definition:
index_allocator.h:14
IndexAllocator::NoneIndexSet
bool NoneIndexSet()
Definition:
index_allocator.cc:31
IndexAllocator::AnyIndexSet
bool AnyIndexSet()
Definition:
index_allocator.cc:35
IndexAllocator::max_index_
size_t max_index_
Definition:
index_allocator.h:26
IndexAllocator::IndexAllocator
IndexAllocator(size_t max_index)
Definition:
index_allocator.h:16
IndexAllocator::AllocIndex
size_t AllocIndex()
Definition:
index_allocator.cc:7
IndexAllocator::FreeIndex
void FreeIndex(size_t index)
Definition:
index_allocator.cc:26
IndexAllocator::bitset_
BitSet bitset_
Definition:
index_allocator.h:25
BitSet
Definition:
bitset.h:17
bitset.h
contrail
src
contrail-common
base
index_allocator.h
Generated by
1.8.5