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.

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


Member Function Documentation

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

References index.

Referenced by BLCMDfieldntuple::callback().

00047 { index=0; }

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

References coord, index, and value.

Referenced by BLCMDfieldntuple::callback().

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


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