ProteoWizard
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ralab::base::resample::Bucket1D Struct Reference

#include <bucket1d.hpp>

Public Member Functions

 Bucket1D (std::vector< double > &breaks, std::vector< uint32_t > &indic)
 CTor.
 
 Bucket1D (const Bucket1D &rhs)
 CCTor.
 
Bucket1Doperator= (const Bucket1D &rhs)
 
template<typename InputIterator >
void operator() (InputIterator beg, InputIterator end, std::vector< std::pair< std::size_t, std::size_t > > &bucketPairs)
 The result tells you in which bucket which input should end up.
 
std::pair< std::size_t, bool > operator() (double dat)
 

Private Member Functions

void set (const std::vector< double > &breaks, const std::vector< uint32_t > &indic)
 set the data
 

Private Attributes

std::vector< double > breaks_
 
std::vector< uint32_tindicator_
 
double * begbreaks_
 
double * endbreaks_
 
uint32_tindicatorptr_
 

Detailed Description

Definition at line 38 of file bucket1d.hpp.

Constructor & Destructor Documentation

◆ Bucket1D() [1/2]

ralab::base::resample::Bucket1D::Bucket1D ( std::vector< double > &  breaks,
std::vector< uint32_t > &  indic 
)
inline

CTor.

Definition at line 50 of file bucket1d.hpp.

54 {
55 set( breaks , indic );
56 }
void breaks(double minMass, double maxMass, TMassComparator tmassComp, std::vector< double > &breaks, bool exact=false)
Segment mass range according to Mass Compare functor could be used to histogram a dataset or to compu...
Definition breakspec.hpp:41
std::vector< double > breaks_
Definition bucket1d.hpp:41
std::vector< uint32_t > indicator_
Definition bucket1d.hpp:42
void set(const std::vector< double > &breaks, const std::vector< uint32_t > &indic)
set the data
Definition bucket1d.hpp:68

References ralab::base::resample::breaks(), and set().

◆ Bucket1D() [2/2]

ralab::base::resample::Bucket1D::Bucket1D ( const Bucket1D rhs)
inline

CCTor.

Definition at line 59 of file bucket1d.hpp.

62 {
63 this->set(rhs.breaks_,rhs.indicator_);
64 }

References breaks_, indicator_, and set().

Member Function Documentation

◆ set()

void ralab::base::resample::Bucket1D::set ( const std::vector< double > &  breaks,
const std::vector< uint32_t > &  indic 
)
inlineprivate

set the data

Definition at line 68 of file bucket1d.hpp.

70 {
71 if(( breaks.size() - 1 ) != indic.size()){
72 throw std::out_of_range( "breaks.size == inic + 1 , failed!" );
73 }
75 begbreaks_ = &breaks_[0];
76 endbreaks_ = begbreaks_ + breaks_.size();
77 indicator_ = indic;
79 }

References begbreaks_, ralab::base::resample::breaks(), breaks_, endbreaks_, indicator_, and indicatorptr_.

Referenced by Bucket1D(), Bucket1D(), and operator=().

◆ operator=()

Bucket1D & ralab::base::resample::Bucket1D::operator= ( const Bucket1D rhs)
inline

\Assignment

Definition at line 84 of file bucket1d.hpp.

85 {
86 if (this == &rhs) // protect against invalid self-assignment
87 return *this; // See "4:"
88 this->set( rhs.breaks_, rhs.indicator_);
89 return *this;
90 }

References breaks_, indicator_, and set().

◆ operator()() [1/2]

template<typename InputIterator >
void ralab::base::resample::Bucket1D::operator() ( InputIterator  beg,
InputIterator  end,
std::vector< std::pair< std::size_t, std::size_t > > &  bucketPairs 
)
inline

The result tells you in which bucket which input should end up.

Parameters
begCheck wich of these masses should be bucketed

Definition at line 96 of file bucket1d.hpp.

101 {
102 std::size_t index(0);
103 std::pair<std::size_t, bool> res;
104 for(;beg !=end; ++beg, ++index)
105 {
106 res = this->operator()(*beg);
107 if(res.second)
108 {
109 bucketPairs.push_back(std::make_pair(res.first , index ));
110 }
111 }
112 }
void operator()(InputIterator beg, InputIterator end, std::vector< std::pair< std::size_t, std::size_t > > &bucketPairs)
The result tells you in which bucket which input should end up.
Definition bucket1d.hpp:96

References operator()().

Referenced by operator()().

◆ operator()() [2/2]

std::pair< std::size_t, bool > ralab::base::resample::Bucket1D::operator() ( double  dat)
inline
       the std::size_t indicates to which bucket dat belongs too.
       The bool indicates if a new bucket is of interest

Definition at line 119 of file bucket1d.hpp.

120 {
121 double * it2 = std::lower_bound(begbreaks_,endbreaks_,dat);
122 std::size_t ub = std::distance(begbreaks_,it2);
123
124 if(ub > 0 && ub <= indicator_.size())
125 {
126 ub = ub - 1;
127 if(*(indicatorptr_ + ub) > 0)
128 return std::make_pair(ub, true);
129 else
130 return std::make_pair(ub, false);
131 }
132 else
133 return std::make_pair(0, false);
134 }

References begbreaks_, endbreaks_, indicator_, and indicatorptr_.

Member Data Documentation

◆ breaks_

std::vector<double> ralab::base::resample::Bucket1D::breaks_
private

Definition at line 41 of file bucket1d.hpp.

Referenced by Bucket1D(), operator=(), and set().

◆ indicator_

std::vector<uint32_t> ralab::base::resample::Bucket1D::indicator_
private

Definition at line 42 of file bucket1d.hpp.

Referenced by Bucket1D(), operator()(), operator=(), and set().

◆ begbreaks_

double* ralab::base::resample::Bucket1D::begbreaks_
private

Definition at line 45 of file bucket1d.hpp.

Referenced by operator()(), and set().

◆ endbreaks_

double* ralab::base::resample::Bucket1D::endbreaks_
private

Definition at line 46 of file bucket1d.hpp.

Referenced by operator()(), and set().

◆ indicatorptr_

uint32_t* ralab::base::resample::Bucket1D::indicatorptr_
private

Definition at line 47 of file bucket1d.hpp.

Referenced by operator()(), and set().


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