BLCMDfieldntuple::Loop Class Reference

List of all members.

Public Member Functions

 Loop (double &_coord, G4String s)
void start ()
bool next ()

Private Attributes

double & coord
std::vector< double > value
unsigned index


Constructor & Destructor Documentation

BLCMDfieldntuple::Loop::Loop ( double &  _coord,
G4String  s 
)

References coord, BLCommand::getList(), index, BLCommand::printError(), and value.

00191                                                      : coord(_coord)
00192 {
00193         value = getList(s,",");
00194         if(value.size() == 3) {
00195                 double a = value[0];
00196                 double b = value[1];
00197                 double c = value[2];
00198                 value.clear();
00199                 if(c > 0.0 && b >= a) {
00200                         for(double v=a; v<=b; v+= c)
00201                                 value.push_back(v);
00202                 }
00203         } else {
00204                 value = getList(s,":");
00205         }
00206         if(value.size() == 0) {
00207                 printError("Invalid coordinate loop.");
00208                 value.push_back(0.0);
00209         }
00210         index = 0;
00211         coord = value[0];
00212 }


Member Function Documentation

void BLCMDfieldntuple::Loop::start (  )  [inline]

References index.

Referenced by BLCMDfieldntuple::callback().

00049 { index=0; }

bool BLCMDfieldntuple::Loop::next (  )  [inline]

References coord, index, and value.

Referenced by BLCMDfieldntuple::callback().

00050                             {
00051                         if(index >= value.size()) return false;
00052                         coord = value[index++];
00053                         return true;
00054                 }


Member Data Documentation

double& BLCMDfieldntuple::Loop::coord [private]

Referenced by Loop(), and next().

std::vector<double> BLCMDfieldntuple::Loop::value [private]

Referenced by Loop(), and next().

unsigned BLCMDfieldntuple::Loop::index [private]

Referenced by Loop(), next(), and start().


The documentation for this class was generated from the following file:
g4beamline