MultiIndex
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
OrderedListsMerger< OrderType, MetaInfo > Class Template Reference

#include <ordered_lists_merger.h>

Collaboration diagram for OrderedListsMerger< OrderType, MetaInfo >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OrderedListsMerger ()
void setLists (const vector< vector< pair< OrderType, MetaInfo > > > &lists)
bool GetNextMergedItemIndices (MergedItemIndices *merged_item_indices)
Multitable< char > & GetYieldedItems ()

Public Attributes

const vector< vector< pair
< OrderType, MetaInfo > > > * 
lists_ptr

Private Member Functions

void InsertMergedItemIndicesInHeap (const MergedItemIndices &merged_item_indices)
void UpdatePrioirityQueue (MergedItemIndices &merged_item_indices)

Private Attributes

multimap< OrderType,
MergedItemIndices
heap_
Multitable< char > yielded_items_indices_

Detailed Description

template<class OrderType, class MetaInfo>
class OrderedListsMerger< OrderType, MetaInfo >

This class merges any number of ordered lists and yields elements of merged list in Order-increasing order. Initial lists are ordered by Order. This class is used in multilist algorithm to get coordinates of cells in multiindex. Class does not return the whole result list, it just yields by one item. Class also assumes that input lists are the same length


Constructor & Destructor Documentation

template<class OrderType , class MetaInfo >
OrderedListsMerger< OrderType, MetaInfo >::OrderedListsMerger ( )

This constructor inits merger for input lists


Member Function Documentation

template<class OrderType , class MetaInfo >
bool OrderedListsMerger< OrderType, MetaInfo >::GetNextMergedItemIndices ( MergedItemIndices merged_item_indices) [inline]

This function yields indices if next item of merged list. It returns "false" if all items have been already yielded and "true" otherwise

Parameters:
merged_item_indicesresult indices
template<class OrderType, class MetaInfo>
Multitable<char>& OrderedListsMerger< OrderType, MetaInfo >::GetYieldedItems ( ) [inline]

Getter

template<class OrderType , class MetaInfo >
void OrderedListsMerger< OrderType, MetaInfo >::InsertMergedItemIndicesInHeap ( const MergedItemIndices merged_item_indices) [private]

This function pushes new item into priority queue

Parameters:
merged_item_indicesindices of item to add
template<class OrderType, class MetaInfo>
void OrderedListsMerger< OrderType, MetaInfo >::setLists ( const vector< vector< pair< OrderType, MetaInfo > > > &  lists)

This function sets lists to merge

Parameters:
listsinput lists to merge (must be ordered)
template<class OrderType , class MetaInfo >
void OrderedListsMerger< OrderType, MetaInfo >::UpdatePrioirityQueue ( MergedItemIndices merged_item_indices) [private]

This function tries to update priority queue after yielding

Parameters:
merged_item_indicesnew indices we should try to push in priority queue

Member Data Documentation

template<class OrderType, class MetaInfo>
multimap<OrderType, MergedItemIndices> OrderedListsMerger< OrderType, MetaInfo >::heap_ [private]

Proirity queue for multilist algorithm

template<class OrderType, class MetaInfo>
const vector<vector<pair<OrderType, MetaInfo> > >* OrderedListsMerger< OrderType, MetaInfo >::lists_ptr

Pointer to input lists

template<class OrderType, class MetaInfo>
Multitable<char> OrderedListsMerger< OrderType, MetaInfo >::yielded_items_indices_ [private]

Table with "1"-value for yielded items and "0"-value otherwise


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator