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 #include <cstdio>
5 
6 AlgoImpl::AlgoImpl( AlgoPos * al, std::string label )
7  : ParS_(al->ParS_),
8  ParE_(al->ParE_),
9  start_(al->start_), end_(al->end_), incr_(al->incr_),
10  curr_(al->curr_), count_(al->count_),
11  terminate_(al->terminate_), err_(al->err_),
12  label_(label)
13 {
14  // DCOUT('E', "AlgoImpl ctor called with label=" << label << " AlgoPos.ddname=" << al->ddname() );
15  al->registerAlgo(this);
16 }
17 
19 { }
20 
21 int
22 AlgoImpl::copyno( void ) const
23 {
24  return incr_ ? curr_ : count_ ;
25 }
26 
27 void
29 {
30  terminate_ = true;
31 }
32 
33 void
35 {
36  terminate();
37 }
38 
39 std::string
40 AlgoImpl::d2s( double x )
41 {
42  char buffer [25];
43  int len = snprintf( buffer, 25, "%g", x );
44  if( len >= 25 )
45  edm::LogError( "DoubleToString" ) << "Length truncated (from " << len << ")";
46  return std::string( buffer );
47 }
48 
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:34
const int & curr_
Definition: AlgoImpl.h:117
virtual int copyno() const
copy-number calculation
Definition: AlgoImpl.cc:22
virtual ~AlgoImpl()
Definition: AlgoImpl.cc:18
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:40
const int & incr_
Definition: AlgoImpl.h:116
void registerAlgo(AlgoImpl *)
registers an implementation of the algorithm
Definition: AlgoPos.cc:72
bool & terminate_
Definition: AlgoImpl.h:119
x
Definition: VDTMath.h:216
AlgoImpl(AlgoPos *, std::string label)
subclass must provide a similar constructor and call this one
Definition: AlgoImpl.cc:6
void terminate()
stop the current iteration of the algorithm (for incr_==0 types of algorithms)
Definition: AlgoImpl.cc:28