CMS 3D CMS Logo

Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

LHERunInfoProduct::const_iterator Class Reference

#include <LHERunInfoProduct.h>

List of all members.

Public Types

typedef std::ptrdiff_t difference_type
typedef std::forward_iterator_tag iterator_category
typedef std::string * pointer
typedef std::string & reference
typedef std::string value_type

Public Member Functions

 const_iterator ()
bool operator!= (const const_iterator &other) const
const std::string & operator* () const
const_iteratoroperator++ ()
const_iterator operator++ (int dummy)
const std::string * operator-> () const
bool operator== (const const_iterator &other) const
 ~const_iterator ()

Private Types

enum  Mode {
  kHeader, kBody, kInit, kDone,
  kFooter
}

Private Member Functions

void next ()

Private Attributes

headers_const_iterator header
Header::const_iterator iter
unsigned int line
Mode mode
const LHERunInfoProductrunInfo
std::string tmp

Friends

class LHERunInfoProduct

Detailed Description

Definition at line 64 of file LHERunInfoProduct.h.


Member Typedef Documentation

Definition at line 68 of file LHERunInfoProduct.h.

typedef std::forward_iterator_tag LHERunInfoProduct::const_iterator::iterator_category

Definition at line 66 of file LHERunInfoProduct.h.

Definition at line 69 of file LHERunInfoProduct.h.

Definition at line 70 of file LHERunInfoProduct.h.

Definition at line 67 of file LHERunInfoProduct.h.


Member Enumeration Documentation

Enumerator:
kHeader 
kBody 
kInit 
kDone 
kFooter 

Definition at line 92 of file LHERunInfoProduct.h.


Constructor & Destructor Documentation

LHERunInfoProduct::const_iterator::const_iterator ( ) [inline]

Definition at line 72 of file LHERunInfoProduct.h.

: mode(kDone) {}
LHERunInfoProduct::const_iterator::~const_iterator ( ) [inline]

Definition at line 73 of file LHERunInfoProduct.h.

{}

Member Function Documentation

void LHERunInfoProduct::const_iterator::next ( void  ) [private]

Definition at line 40 of file LHERunInfoProduct.cc.

References LHERunInfoProduct::comments_begin(), LHERunInfoProduct::comments_size(), lhef::HEPRUP::EBMUP, header, LHERunInfoProduct::headers_end(), LHERunInfoProduct::heprup(), lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, iter, kBody, kDone, kFooter, kHeader, kInit, line, lhef::HEPRUP::LPRUP, mode, lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, runInfo, GlobalPosition_Frontier_DevDB_cff::tag, tmp, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

Referenced by operator++().

{
        tmp.clear();

        do {
                switch(mode) {
                    case kHeader:
                        if (header == runInfo->headers_end()) {
                                if (line++ == 1)
                                        tmp = "</header>\n";
                                else {
                                        mode = kInit;
                                        tmp = "<init>\n";
                                        line = 0;
                                }
                                break;
                        } else if (!line) {
                                line++;
                                tmp = "<header>\n";
                                break;
                        } else {
                                mode = kBody;
                                const std::string &tag = header->tag();
                                tmp = tag.empty() ? "<!--" :
                                      (tag == "<>") ? "" : ("<" + tag + ">");
                                iter = header->begin();
                                continue;
                        }

                    case kBody:
                        if (iter == header->end()) {
                                mode = kHeader;
                                const std::string &tag = header->tag();
                                tmp += tag.empty() ? "-->" :
                                       (tag == "<>") ? "" : ("</" + tag + ">");
                                tmp += "\n";
                                header++;
                        } else {
                                tmp += *iter++;
                                if (iter == header->end() &&
                                    (tmp.empty() ||
                                     (tmp[tmp.length() - 1] != '\r' &&
                                      tmp[tmp.length() - 1] != '\n')))
                                        continue;
                        }
                        break;

                    case kInit: {
                        const lhef::HEPRUP &heprup = runInfo->heprup();
                        if (!line++) {
                                std::ostringstream ss;
                                ss << std::setprecision(7)
                                   << std::scientific
                                   << std::uppercase
                                   << "    " << heprup.IDBMUP.first
                                   << "  " << heprup.IDBMUP.second
                                   << "  " << heprup.EBMUP.first
                                   << "  " << heprup.EBMUP.second
                                   << "  " << heprup.PDFGUP.first
                                   << "  " << heprup.PDFGUP.second
                                   << "  " << heprup.PDFSUP.first
                                   << "  " << heprup.PDFSUP.second
                                   << "  " << heprup.IDWTUP
                                   << "  " << heprup.NPRUP << std::endl;
                                tmp = ss.str();
                                break;
                        }
                        if (line >= (unsigned int)heprup.NPRUP +
                                    runInfo->comments_size() + 2) {
                                tmp = "</init>\n";
                                mode = kFooter;
                                break;
                        } else if (line >= (unsigned int)heprup.NPRUP + 2) {
                                tmp = *(runInfo->comments_begin() + (line -
                                             (unsigned int)heprup.NPRUP - 2));
                                break;
                        }

                        std::ostringstream ss;
                        ss << std::setprecision(7)
                           << std::scientific
                           << std::uppercase
                           << "\t" << heprup.XSECUP[line - 2]
                           << "\t" << heprup.XERRUP[line - 2]
                           << "\t" << heprup.XMAXUP[line - 2]
                           << "\t" << heprup.LPRUP[line - 2] << std::endl;
                        tmp = ss.str();
                    }   break;

                    case kFooter:
                        mode = kDone;

                    default:
                        /* ... */;
                }
        } while(false);
}
bool LHERunInfoProduct::const_iterator::operator!= ( const const_iterator other) const [inline]

Definition at line 76 of file LHERunInfoProduct.h.

References operator==().

                { return !operator == (other); }
const std::string& LHERunInfoProduct::const_iterator::operator* ( void  ) const [inline]

Definition at line 84 of file LHERunInfoProduct.h.

References tmp.

{ return tmp; }
const_iterator LHERunInfoProduct::const_iterator::operator++ ( int  dummy) [inline]

Definition at line 81 of file LHERunInfoProduct.h.

References next().

                { const_iterator orig = *this; next(); return orig; }
const_iterator& LHERunInfoProduct::const_iterator::operator++ ( void  ) [inline]

Definition at line 79 of file LHERunInfoProduct.h.

References next().

                { next(); return *this; }
const std::string* LHERunInfoProduct::const_iterator::operator-> ( ) const [inline]

Definition at line 85 of file LHERunInfoProduct.h.

References tmp.

{ return &tmp; }
bool LHERunInfoProduct::const_iterator::operator== ( const const_iterator other) const

Definition at line 17 of file LHERunInfoProduct.cc.

References geometryCSVtoXML::line, and mode.

Referenced by operator!=().

{
        if (mode != other.mode)
                return false;

        switch(mode) {
            case kFooter:
            case kDone:
                return true;

            case kHeader:
                return header == other.header;

            case kBody:
                return header == other.header && iter == other.iter;

            case kInit:
                return line == other.line;
        }

        return false;
}

Friends And Related Function Documentation

friend class LHERunInfoProduct [friend]

Definition at line 88 of file LHERunInfoProduct.h.


Member Data Documentation

Definition at line 101 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), and next().

Definition at line 102 of file LHERunInfoProduct.h.

Referenced by next().

Definition at line 104 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().

Definition at line 103 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().

Definition at line 100 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().