ThreeB 1.1
Public Member Functions | Public Attributes | Static Public Attributes
IndexLexicographicPosition< Cmp, First > Struct Template Reference

Class for sorting a list of indexes to an array of spots lexicographically according to the 2D positions of the spots. More...

List of all members.

Public Member Functions

 IndexLexicographicPosition (const vector< Vector< 4 > > &s)
bool operator() (int a, int b)

Public Attributes

const vector< Vector< 4 > > & spots

Static Public Attributes

static const int Second = First==2?3:2

Detailed Description

template<class Cmp, int First>
struct IndexLexicographicPosition< Cmp, First >

Class for sorting a list of indexes to an array of spots lexicographically according to the 2D positions of the spots.

Parameters:
Cmpcomparator function to specify less or greater
Firstmost significant position index

Definition at line 453 of file multispot5.cc.


Constructor & Destructor Documentation

template<class Cmp , int First>
IndexLexicographicPosition< Cmp, First >::IndexLexicographicPosition ( const vector< Vector< 4 > > &  s) [inline]
Parameters:
sVector to sort indices of

Definition at line 457 of file multispot5.cc.

    :spots(s)
    {}

Member Function Documentation

template<class Cmp , int First>
bool IndexLexicographicPosition< Cmp, First >::operator() ( int  a,
int  b 
) [inline]

Compare two indexes into the array of spots.

Definition at line 465 of file multispot5.cc.

    {
        Cmp cmp;

        if(cmp(spots[a][First], spots[b][First]))
            return true;
        else if(spots[a][First] == spots[b][First])
            return cmp(spots[a][Second], spots[b][Second]);
        else
            return false;
    }

Member Data Documentation

template<class Cmp , int First>
const vector<Vector<4> >& IndexLexicographicPosition< Cmp, First >::spots

Keep around the array of spots for later comprison.

Definition at line 454 of file multispot5.cc.

template<class Cmp , int First>
const int IndexLexicographicPosition< Cmp, First >::Second = First==2?3:2 [static]

Second most siginifcant position index for sorting.

Definition at line 462 of file multispot5.cc.


The documentation for this struct was generated from the following file: