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