CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlgoImpl.cc
Go to the documentation of this file.
4 
5 AlgoImpl::AlgoImpl( AlgoPos * al, std::string label )
6  : ParS_(al->ParS_),
7  ParE_(al->ParE_),
8  start_(al->start_), end_(al->end_), incr_(al->incr_),
9  curr_(al->curr_), count_(al->count_),
10  terminate_(al->terminate_), err_(al->err_),
11  label_(label)
12 {
13  // DCOUT('E', "AlgoImpl ctor called with label=" << label << " AlgoPos.ddname=" << al->ddname() );
14  al->registerAlgo(this);
15 }
16 
18 { }
19 
20 int
21 AlgoImpl::copyno( void ) const
22 {
23  return incr_ ? curr_ : count_ ;
24 }
25 
26 void
28 {
29  terminate_ = true;
30 }
31 
32 void
34 {
35  terminate();
36 }
37 
38 std::string
39 AlgoImpl::d2s( double x )
40 {
41  char buffer [25];
42  int len = snprintf( buffer, 25, "%g", x );
43  if( len >= 25 )
44  edm::LogError( "DoubleToString" ) << "Length truncated (from " << len << ")";
45  return std::string( buffer );
46 }
47 
const std::string & label
Definition: MVAComputer.cc:186
class for algorithmic positioning, represents an algorithm
Definition: AlgoPos.h:27
virtual void checkTermination()
for algorithms with incr_==0 the algorithm must check whether to terminate
Definition: AlgoImpl.cc:33
const int & curr_
Definition: AlgoImpl.h:117
virtual int copyno() const
copy-number calculation
Definition: AlgoImpl.cc:21
virtual ~AlgoImpl()
Definition: AlgoImpl.cc:17
const int & count_
Definition: AlgoImpl.h:118
static std::string d2s(double x)
ahh, converts a double into a std::string ... yet another one of this kind!
Definition: AlgoImpl.cc:39
const int & incr_
Definition: AlgoImpl.h:116
void registerAlgo(AlgoImpl *)
registers an implementation of the algorithm
Definition: AlgoPos.cc:73
bool & terminate_
Definition: AlgoImpl.h:119
AlgoImpl(AlgoPos *, std::string label)
subclass must provide a similar constructor and call this one
Definition: AlgoImpl.cc:5
void terminate()
stop the current iteration of the algorithm (for incr_==0 types of algorithms)
Definition: AlgoImpl.cc:27