SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
ParameterMap Class Reference

Detailed Description

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

Definition at line 165 of file ParameterMap.h.

Public Member Functions

 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 Attributes

DynArray< ParameterMapElement * > m_map_elements
DynArray< ParameterMapElement * > m_multi_map_elements
bool m_finalized

Constructor & Destructor Documentation

constructor

Definition at line 242 of file ParameterMap.cpp.

~ParameterMap ( )
virtual

destructor

Definition at line 248 of file ParameterMap.cpp.

Member Function Documentation

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)

Definition at line 308 of file ParameterMap.cpp.

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

Definition at line 281 of file ParameterMap.cpp.

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)

Parameters
keykey of the element to get
Returns
set of values of the key element

Definition at line 286 of file ParameterMap.cpp.

void print_map ( )

prints all elements of this map

Definition at line 379 of file ParameterMap.cpp.

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).

Parameters
keykey of the element
valuevalue of the lement

Definition at line 257 of file ParameterMap.cpp.

Member Data Documentation

bool m_finalized
protected

variable that indicates if its possible to call get method

Definition at line 229 of file ParameterMap.h.

DynArray<ParameterMapElement*> m_map_elements
protected

list of CLinearMap elements, this is always kept sorted

Definition at line 222 of file ParameterMap.h.

DynArray<ParameterMapElement*> m_multi_map_elements
protected

hidden internal structure which is used to hold multiple values for one key. It is built when finalize_map() is called.

Definition at line 226 of file ParameterMap.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation