Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

xmli::doubleBuilder Class Reference

Builder a vector<double> from XML data. More...

#include <doubleBuilder.h>

Inheritance diagram for xmli::doubleBuilder:

xmli::Builder List of all members.

Public Member Functions

 doubleBuilder (const char *tag)
void Build (const AttributeList &attr, const std::string &buffer)

Detailed Description

Builder a vector<double> from XML data.

Definition at line 14 of file doubleBuilder.h.


Constructor & Destructor Documentation

xmli::doubleBuilder::doubleBuilder const char *  tag  ) 
 

Definition at line 20 of file doubleBuilder.cxx.

00020 : xmli::Builder(tag) { }


Member Function Documentation

void xmli::doubleBuilder::Build const AttributeList attr,
const std::string &  buffer
 

Definition at line 24 of file doubleBuilder.cxx.

References xmli::AttributeList, and xmli::ChString::Split().

00026 {
00027 //======================================================================
00028 // Build vector<double> from XML data and place it on the XMLIStack
00029 //
00030 //  attr - unused
00031 //  buffer - list of space-separted floating point numbers
00032 //======================================================================
00033   double                   d;
00034   std::vector<std::string> vs;
00035   std::vector<double>      vd;
00036 
00037   // Split the string in to sub fields and extra the values from each
00038   // sub-field
00039   xmli::ChString::Split(buffer.c_str()," ,\n\t\r",vs);
00040   std::vector<std::string>::iterator itr(vs.begin());  
00041   std::vector<std::string>::iterator itrEnd(vs.end());
00042   for (; itr!=itrEnd; ++itr) {
00043     d = atof(itr->c_str());
00044     vd.push_back(d);
00045   }
00046   
00047   // Add this vector of doubleean values into the "global" stack
00048   xmli::Stack<std::vector<double> >::Instance().push(vd);
00049 }


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:55 2008 for NOvA Offline by doxygen 1.3.5