OpenSDN source code
index_vector_resource.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef vnsw_agent_index_vector_resource_hpp
7 #define vnsw_agent_index_vector_resource_hpp
8 
9 #include <cmn/agent_cmn.h>
10 #include <cmn/agent.h>
11 #include <cmn/index_vector.h>
12 
13 
14 template<typename Object>
15 // This Class is to do Index Allocation.
17 public:
19  }
21  }
22 
23  //index allocation from index table
24  uint32_t AllocIndex(Object entry) {
25  return index_table_.Insert(entry);
26  }
27 
28  uint32_t InsertAtIndex(uint32_t index, Object entry) {
29  return index_table_.InsertAtIndex(index, entry);
30  }
31 
32  void UpdateIndex(uint32_t index, Object entry) {
33  return index_table_.Update((index), entry);
34  }
35  void FreeIndex(uint32_t index) {
36  index_table_.Remove(index);
37  }
38 
39  Object FindIndex(size_t index) {
40  return index_table_.At(index);
41  }
42 
43 private:
45 };
46 #endif //index_vector_resource
uint32_t AllocIndex(Object entry)
uint32_t InsertAtIndex(uint32_t index, Object entry)
IndexVector< Object > index_table_
Object FindIndex(size_t index)
void FreeIndex(uint32_t index)
void UpdateIndex(uint32_t index, Object entry)
size_t InsertAtIndex(uint32_t index, EntryType entry)
Definition: index_vector.h:55
size_t Insert(EntryType entry)
Definition: index_vector.h:41
void Update(size_t index, EntryType entry)
Definition: index_vector.h:73
EntryType At(size_t index) const
Definition: index_vector.h:33
void Remove(size_t index)
Definition: index_vector.h:79