class for algorithmic positioning, represents an algorithm More...
#include <AlgoPos.h>
Public Member Functions | |
AlgoPos (AlgoCheck *check=0) | |
creates an algorithm named name More... | |
int | copyno () const |
copy-number calculation More... | |
int | end () const |
bool | go () const |
no further algorithm processing if go() returns false More... | |
int | incr () const |
void | next () |
update for next iteration of the algorithm, don't call it yourself! More... | |
size_t | numRegistered () |
return number of registered implementations More... | |
const parE_type & | parE () const |
const parS_type & | parS () const |
void | registerAlgo (AlgoImpl *) |
registers an implementation of the algorithm More... | |
DDRotationMatrix | rotation () |
rotation calculations More... | |
void | setParameters (int start, int end, int incr, const parS_type &, const parE_type &) |
sets mandatory and optional parameters More... | |
int | start () const |
void | stream (std::ostream &os) const |
streams some information about common parameters and the name of the algorithm More... | |
DD3Vector | translation () |
translation calculations More... | |
~AlgoPos () | |
destructor clears registered AlgoImpl More... | |
Protected Member Functions | |
void | checkTermination () |
for algorithms with incr_==0 the algorithm must check whether to terminate More... | |
bool | select () |
selection of one of the registered AlgoImpl More... | |
void | terminate () |
terminates current algorithmic processing More... | |
Protected Attributes | |
AlgoCheck * | checkAlgo_ |
checking object which checks the user-supplied parameters whether they fulfill their spec. More... | |
int | count_ |
invocation count More... | |
int | curr_ |
current position in the range of the algorithm More... | |
int | end_ |
std::string | err_ |
std::string to hold potential error messages found inside checkParameters() More... | |
int | incr_ |
parE_type | ParE_ |
double valued parameters passed to the algorithm More... | |
parS_type | ParS_ |
std::string valued parameters passed to the algorithm More... | |
std::vector< AlgoImpl * > | regAlgos_ |
registry of algorithm implementation objects More... | |
AlgoImpl * | selAlgo_ |
selected algorithm implementation More... | |
int | start_ |
range of the algorithm More... | |
bool | terminate_ |
flag to signal whether the algorithm has finished (true) More... | |
Friends | |
class | AlgoImpl |
class for algorithmic positioning, represents an algorithm
Implementations of the algorithm (AlgoImpl objects) have to register with AlgoPos. At least one implementation must register, so that AlgoPos is a valid representation of an algorithm. In case of multiple registration of AlgoImpl-implementations, it must be assured by the implementations that given a set of user-supplied parameters only one or none of these implementations will execute the algorithm (see AlgoImpl::checkParamters()).
AlgoPos::AlgoPos | ( | AlgoCheck * | check = 0 | ) |
creates an algorithm named name
Definition at line 8 of file AlgoPos.cc.
AlgoPos::~AlgoPos | ( | ) |
destructor clears registered AlgoImpl
Definition at line 14 of file AlgoPos.cc.
References checkAlgo_, and regAlgos_.
|
protected |
for algorithms with incr_==0 the algorithm must check whether to terminate
Overload this function in case the algorithm is a 'incr_==0' type. In this case provide some code which checks using perhaps the value of count_ and/or supplied algorithm parameters to check whether terminate() has to be called or not.
Will only work, if one registered algorithm AlgoImpl has been selected by checkParameters()
The default implementation will immidiately terminate the algorithm in case incr_==0.
In case of incr_!=0: checkTermination() is not called then, the algorithm will terminate automatically when the specified range [start_, end_, incr_] has been covered.
Definition at line 127 of file AlgoPos.cc.
References AlgoImpl::checkTermination(), and selAlgo_.
Referenced by next().
int AlgoPos::copyno | ( | void | ) | const |
copy-number calculation
Definition at line 82 of file AlgoPos.cc.
References AlgoImpl::copyno(), and selAlgo_.
|
inline |
Definition at line 84 of file AlgoPos.h.
References end_.
Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and setParameters().
bool AlgoPos::go | ( | ) | const |
no further algorithm processing if go() returns false
Definition at line 139 of file AlgoPos.cc.
References terminate_.
|
inline |
void AlgoPos::next | ( | void | ) |
update for next iteration of the algorithm, don't call it yourself!
In the case of incr_!=0 this function will set curr_ to the next point in the range [start_,end_,incr_] or terminate the algorithm if the next point is going to be out of the range bounds.
In the case of incr_=0 this function calls checkTermination() in which the algorithm itself must check whether to terminate or not
Definition at line 96 of file AlgoPos.cc.
References checkTermination(), count_, curr_, end_, incr_, start_, and terminate().
Referenced by BeautifulSoup.PageElement::_invert().
size_t AlgoPos::numRegistered | ( | ) |
return number of registered implementations
Definition at line 77 of file AlgoPos.cc.
References regAlgos_.
|
inline |
Definition at line 87 of file AlgoPos.h.
References ParE_.
|
inline |
Definition at line 86 of file AlgoPos.h.
References ParS_.
void AlgoPos::registerAlgo | ( | AlgoImpl * | a | ) |
registers an implementation of the algorithm
At least 1 implementation must be registered.
In case multiple implementations are registered, only one checkParamters() member function of these is allowed to return true given a set of user-supplied parameters. The particular registered algorithm is then selected. If all checkParamters() of the registered AlgoImpls return false, an exception is raised.
Definition at line 72 of file AlgoPos.cc.
References regAlgos_.
Referenced by AlgoImpl::AlgoImpl().
DDRotationMatrix AlgoPos::rotation | ( | void | ) |
rotation calculations
Will only work, if one registered algorithm AlgoImpl has been selected by checkParameters()
Definition at line 151 of file AlgoPos.cc.
References AlgoImpl::rotation(), and selAlgo_.
|
protected |
selection of one of the registered AlgoImpl
checkParamters() of the registered AlgoImpl objects will be called sequentially until either an error is detected in the parameters or true is returned. In the latter case this AlgoImpl is choosen.
select() returns true as soon as a checkParamters() of a registered AlgoImpl returns true. Otherwise it returns false.
Definition at line 157 of file AlgoPos.cc.
References AlgoCheck::check(), checkAlgo_, err_, ParE_, ParS_, regAlgos_, query::result, alignCSCRings::s, and selAlgo_.
Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and setParameters().
void AlgoPos::setParameters | ( | int | start, |
int | end, | ||
int | incr, | ||
const parS_type & | ps, | ||
const parE_type & | pe | ||
) |
sets mandatory and optional parameters
Definition at line 25 of file AlgoPos.cc.
References CastorDataFrameFilter_impl::check(), count_, curr_, AlgoImpl::d2s(), end(), end_, err_, edm::hlt::Exception, incr(), incr_, ParE_, ParS_, select(), start(), start_, and terminate_.
|
inline |
Definition at line 83 of file AlgoPos.h.
References start_.
Referenced by progressbar.ProgressBar::__next__(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and setParameters().
void AlgoPos::stream | ( | std::ostream & | os | ) | const |
streams some information about common parameters and the name of the algorithm
Definition at line 197 of file AlgoPos.cc.
References end_, incr_, ParE_, ParS_, and start_.
|
protected |
terminates current algorithmic processing
current algorithm iteration will not result in a positioning, if terminate() was called from within translation() or rotation()
Definition at line 133 of file AlgoPos.cc.
References terminate_.
Referenced by next().
DD3Vector AlgoPos::translation | ( | void | ) |
translation calculations
Will only work, if one registered algorithm AlgoImpl has been selected by checkParameters()
Definition at line 145 of file AlgoPos.cc.
References selAlgo_, and AlgoImpl::translation().
|
protected |
checking object which checks the user-supplied parameters whether they fulfill their spec.
Definition at line 184 of file AlgoPos.h.
Referenced by select(), and ~AlgoPos().
|
protected |
invocation count
count_ will be set to 1 at the first invocation of the algorithm and will be increased by 1 at every subsequent invocation.
Definition at line 153 of file AlgoPos.h.
Referenced by next(), and setParameters().
|
protected |
current position in the range of the algorithm
see doc of start_, end_, incr_ as well.
In case of incr_==0, the value of curr_ is undefined.
Definition at line 146 of file AlgoPos.h.
Referenced by next(), and setParameters().
|
protected |
|
protected |
std::string to hold potential error messages found inside checkParameters()
Definition at line 175 of file AlgoPos.h.
Referenced by select(), and setParameters().
|
protected |
|
protected |
double valued parameters passed to the algorithm
Before the first invocation of the algorithm ParS_ will be filled with the std::string-valued parameters passed to the algorithm implementation object AlgoImpl.
Definition at line 169 of file AlgoPos.h.
Referenced by parE(), select(), setParameters(), and stream().
|
protected |
std::string valued parameters passed to the algorithm
Before the first invocation of the algorithm ParS_ will be filled with the std::string-valued parameters passed to the algorithm implementation object AlgoImpl.
Definition at line 161 of file AlgoPos.h.
Referenced by parS(), select(), setParameters(), and stream().
|
protected |
registry of algorithm implementation objects
Definition at line 178 of file AlgoPos.h.
Referenced by numRegistered(), registerAlgo(), select(), and ~AlgoPos().
|
protected |
selected algorithm implementation
Definition at line 181 of file AlgoPos.h.
Referenced by checkTermination(), copyno(), rotation(), select(), and translation().
|
protected |
range of the algorithm
The algorithm will be invoked like /c for(curr_=start_; curr_<=end_; curr_ += incr_) { algo code } // incr > 0 /c for(curr_=end_; curr_>=start_; curr_ += incr_) { algo code } // incr < 0
If incr_==0 the algorithm code will be invoked until term() is called from within the algorithm code. The iteration in wich term() is called will not result in a positioning.
Definition at line 138 of file AlgoPos.h.
Referenced by next(), setParameters(), start(), and stream().
|
protected |
flag to signal whether the algorithm has finished (true)
Definition at line 172 of file AlgoPos.h.
Referenced by go(), setParameters(), and terminate().