Anp::PrevDataKey Struct Reference

#include <AlgThread.h>

List of all members.

Public Member Functions

 PrevDataKey ()
 PrevDataKey (DataIter ibeg, DataIter iend)
 PrevDataKey (const std::vector< short > &kvec_)
bool operator() (const Data &data) const
bool operator() (Event &event) const
bool operator() (Track &track) const

Private Attributes

DataVec dvec
bool valid

Detailed Description

Definition at line 84 of file AlgThread.h.


Constructor & Destructor Documentation

Anp::PrevDataKey::PrevDataKey (  ) 

Definition at line 187 of file AlgThread.cxx.

00188    :dvec(),
00189     valid(false)
00190 {
00191 }

Anp::PrevDataKey::PrevDataKey ( DataIter  ibeg,
DataIter  iend 
)

Definition at line 194 of file AlgThread.cxx.

References dvec.

00195    :dvec(),
00196     valid(true)
00197 {
00198    //
00199    // Save input elements: key and data pairs
00200    //
00201    dvec.insert(dvec.end(), ibeg, iend);
00202 
00203    //
00204    // Sort keys
00205    //
00206    std::sort(dvec.begin(), dvec.end());
00207 }

Anp::PrevDataKey::PrevDataKey ( const std::vector< short > &  kvec_  )  [explicit]

Member Function Documentation

bool Anp::PrevDataKey::operator() ( Track track  )  const

Definition at line 261 of file AlgThread.cxx.

References Anp::Track::Add(), dvec, and valid.

00262 {
00263    if(!valid)
00264    {
00265       cerr << "PrevDataKey::operator() - invalid internal state" << endl;
00266       return false;
00267    }
00268 
00269    //
00270    // Add current elements to Track
00271    //
00272    for(DataVec::const_iterator dit = dvec.begin(); dit != dvec.end(); ++dit)
00273    {
00274       track.Add(dit -> Key(), dit -> Data());
00275    }
00276 
00277    return true;
00278 }

bool Anp::PrevDataKey::operator() ( Event event  )  const

Definition at line 241 of file AlgThread.cxx.

References dvec, and valid.

00242 {
00243    if(!valid)
00244    {
00245       cerr << "PrevDataKey::operator() - invalid internal state" << endl;
00246       return false;
00247    }
00248 
00249    //
00250    // Add current elements to Event
00251    //
00252    for(DataVec::const_iterator dit = dvec.begin(); dit != dvec.end(); ++dit)
00253    {
00254       event.Add(dit -> Key(), dit -> Data());
00255    }
00256 
00257    return true;
00258 }

bool Anp::PrevDataKey::operator() ( const Data data  )  const

Definition at line 226 of file AlgThread.cxx.

References dvec, and valid.

00227 {
00228    if(!valid)
00229    {
00230       cerr << "PrevDataKey::operator() - invalid internal state" << endl;
00231       return false;
00232    }
00233 
00234    //
00235    // return true if this key is found
00236    //
00237    return std::binary_search(dvec.begin(), dvec.end(), data);
00238 }


Member Data Documentation

Definition at line 96 of file AlgThread.h.

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

bool Anp::PrevDataKey::valid [private]

Definition at line 97 of file AlgThread.h.

Referenced by operator()().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1