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

#include <CMatchBookKeeper.h>

Public Member Functions

 CMatchBookKeeper ()
 Default constructor. More...
 
void Reset ()
 Reset method. More...
 
void Match (const std::vector< unsigned int > &matched_indexes, const float &score)
 Method to register matched clusters. More...
 
std::vector< std::vector
< unsigned int > > 
GetResult () const
 Method to get result. More...
 
void PassResult (std::vector< std::vector< unsigned int > > &result) const
 Method to pass result. More...
 

Protected Attributes

std::multimap< float,
std::vector< unsigned int > > 
_register
 

Detailed Description

User defined class CMatchBookKeeper ... these comments are used to generate doxygen documentation!

Definition at line 26 of file CMatchBookKeeper.h.

Constructor & Destructor Documentation

cmtool::CMatchBookKeeper::CMatchBookKeeper ( )

Default constructor.

Definition at line 5 of file CMatchBookKeeper.cxx.

6  {
7  Reset();
8  }
void Reset()
Reset method.

Member Function Documentation

std::vector< std::vector< unsigned int > > cmtool::CMatchBookKeeper::GetResult ( ) const

Method to get result.

Definition at line 22 of file CMatchBookKeeper.cxx.

23  {
24  std::vector<std::vector<unsigned int> > res;
25 
26  PassResult(res);
27 
28  return res;
29 
30  }
void PassResult(std::vector< std::vector< unsigned int > > &result) const
Method to pass result.
void cmtool::CMatchBookKeeper::Match ( const std::vector< unsigned int > &  matched_indexes,
const float &  score 
)

Method to register matched clusters.

Definition at line 15 of file CMatchBookKeeper.cxx.

17  {
18  _register.insert(std::make_pair(score,matched_indexes));
19  }
BEGIN_PROLOG or score(default)}sbnd_crttrackmatchingalg_crID
std::multimap< float, std::vector< unsigned int > > _register
void cmtool::CMatchBookKeeper::PassResult ( std::vector< std::vector< unsigned int > > &  result) const

Method to pass result.

Definition at line 33 of file CMatchBookKeeper.cxx.

34  {
35  result.clear();
36 
37  // Rough guess: assume half of registered pairs are good
38  result.reserve((unsigned int)(_register.size()/2));
39 
40  std::vector<bool> used_index;
41 
42  for( auto riter = _register.rbegin();
43  riter != _register.rend();
44  ++riter) {
45 
46  bool valid_set = true;
47 
48  for(auto const& index : (*riter).second) {
49 
50  if(index >= used_index.size())
51 
52  used_index.resize(index+1,false);
53 
54  else if(used_index.at(index)) valid_set = false;
55 
56  }
57 
58  if(valid_set) {
59 
60  result.push_back((*riter).second);
61 
62  for(auto& index : (*riter).second)
63 
64  used_index.at(index) = true;
65 
66  }
67 
68  }
69 
70  }
std::multimap< float, std::vector< unsigned int > > _register
void cmtool::CMatchBookKeeper::Reset ( )

Reset method.

Definition at line 10 of file CMatchBookKeeper.cxx.

11  {
12  _register.clear();
13  }
std::multimap< float, std::vector< unsigned int > > _register

Member Data Documentation

std::multimap<float,std::vector<unsigned int> > cmtool::CMatchBookKeeper::_register
protected

Definition at line 48 of file CMatchBookKeeper.h.


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