SHOGUN
4.1.0
|
Implements a map of ParameterMapElement instances Maps one key to a set of values.
Implementation is done via an array. Via the call finalize_map(), a hidden structure is built which bundles all values for each key. Then, get() may be called, which returns an array of values for a key. If it is called before, an error is thrown.
Putting elements is in O(1). finalize_map sorts the underlying array and then regroups values, O(n*log n). Add all values and then call once. Getting a set of values is possible in O(log n) via binary search
在文件 ParameterMap.h 第 165 行定义.
Public 成员函数 | |
ParameterMap () | |
virtual | ~ParameterMap () |
void | put (const SGParamInfo *key, const SGParamInfo *value) |
DynArray< const SGParamInfo * > * | get (const SGParamInfo) const |
DynArray< const SGParamInfo * > * | get (const SGParamInfo *key) const |
void | finalize_map () |
void | print_map () |
Protected 属性 | |
DynArray< ParameterMapElement * > | m_map_elements |
DynArray< ParameterMapElement * > | m_multi_map_elements |
bool | m_finalized |
ParameterMap | ( | ) |
constructor
在文件 ParameterMap.cpp 第 242 行定义.
|
virtual |
destructor
在文件 ParameterMap.cpp 第 248 行定义.
void finalize_map | ( | ) |
Finalizes the map. Has to be called before get may be called if more than one element in map
Operation in O(n*log n)
在文件 ParameterMap.cpp 第 308 行定义.
DynArray< const SGParamInfo * > * get | ( | const SGParamInfo | key | ) | const |
Gets a specific element of the map finalize_map() has to be called first if more than one elements are in map.
Operation in O(log n)
Same as below but without pointer for syntactic ease.
parameter key: key of the element to get returns set of values of the key element
在文件 ParameterMap.cpp 第 281 行定义.
DynArray< const SGParamInfo * > * get | ( | const SGParamInfo * | key | ) | const |
Gets a specific element of the map. finalize_map() has to be called first if more than one elements are in map.
Operation in O(log n)
key | key of the element to get |
在文件 ParameterMap.cpp 第 286 行定义.
void print_map | ( | ) |
prints all elements of this map
在文件 ParameterMap.cpp 第 379 行定义.
void put | ( | const SGParamInfo * | key, |
const SGParamInfo * | value | ||
) |
Puts an newly allocated element into the map. Note that get(...) returns an array of value elements, so it is allowed to add multiple values for one key. Note that there is also no check for double entries, i.e. same key and same value.This will result in two elements when get is called. Operation in O(1).
key | key of the element |
value | value of the lement |
在文件 ParameterMap.cpp 第 257 行定义.
|
protected |
variable that indicates if its possible to call get method
在文件 ParameterMap.h 第 229 行定义.
|
protected |
list of CLinearMap elements, this is always kept sorted
在文件 ParameterMap.h 第 222 行定义.
|
protected |
hidden internal structure which is used to hold multiple values for one key. It is built when finalize_map() is called.
在文件 ParameterMap.h 第 226 行定义.