CMS 3D CMS Logo

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

gen::ParameterCollector::const_iterator Class Reference

#include <ParameterCollector.h>

List of all members.

Public Member Functions

 const_iterator ()

Protected Member Functions

 const_iterator (const ParameterCollector *collector, std::vector< std::string >::const_iterator begin, std::vector< std::string >::const_iterator end, bool special=false, std::ostream *dump=0)

Private Types

typedef std::pair< std::vector
< std::string >
::const_iterator, std::vector
< std::string >
::const_iterator
IterPair

Private Member Functions

const std::string & dereference () const
bool equal (const const_iterator &other) const
void increment ()
void next ()

Private Attributes

std::string cache_
const ParameterCollectorcollector_
std::ostream * dump_
std::vector< IterPairiter_
bool special_

Friends

class boost::iterator_core_access
class ParameterCollector

Detailed Description

Definition at line 35 of file ParameterCollector.h.


Member Typedef Documentation

typedef std::pair<std::vector<std::string>::const_iterator, std::vector<std::string>::const_iterator> gen::ParameterCollector::const_iterator::IterPair [private]

Definition at line 60 of file ParameterCollector.h.


Constructor & Destructor Documentation

gen::ParameterCollector::const_iterator::const_iterator ( ) [inline]

Definition at line 39 of file ParameterCollector.h.

: collector_(0), dump_(0) {}
ParameterCollector::const_iterator::const_iterator ( const ParameterCollector collector,
std::vector< std::string >::const_iterator  begin,
std::vector< std::string >::const_iterator  end,
bool  special = false,
std::ostream *  dump = 0 
) [inline, protected]

Definition at line 32 of file ParameterCollector.cc.

References iter_, and next().

   : collector_(collector), dump_(dump), special_(special)
{
   if (begin != end)
      iter_.push_back(IterPair(begin, end));

   next();
}

Member Function Documentation

const std::string& gen::ParameterCollector::const_iterator::dereference ( ) const [inline, private]

Definition at line 53 of file ParameterCollector.h.

References cache_.

{ return cache_; }
bool gen::ParameterCollector::const_iterator::equal ( const const_iterator other) const [inline, private]

Definition at line 54 of file ParameterCollector.h.

References iter_.

      { return iter_ == other.iter_; }
void ParameterCollector::const_iterator::increment ( ) [private]

Definition at line 45 of file ParameterCollector.cc.

{
   if (++iter_.back().first == iter_.back().second)
      iter_.pop_back();

   next();
}
void ParameterCollector::const_iterator::next ( void  ) [private]

Definition at line 53 of file ParameterCollector.cc.

References createPayload::block, edm::errors::Configuration, geometryCSVtoXML::line, and pos.

Referenced by const_iterator().

{
   if (iter_.empty()) {
      cache_.clear();
      return;
   }

   for(;;) {
      const std::string &line = *iter_.back().first;

      bool special = special_ && iter_.size() == 1;
      if ( (!line.empty() && line[0] == '+') || special) {
         if (++iter_.back().first == iter_.back().second) {
            iter_.pop_back();
            if (iter_.empty())
              special_ = false;
         }

         std::string block = special ? line : line.substr(1);

         std::map<std::string, std::vector<std::string> >::const_iterator
                                        pos = collector_->contents_.find(block);
           if (pos == collector_->contents_.end())
              throw edm::Exception(edm::errors::Configuration)
                 << "ParameterCollector could not find configuration lines "
                    "block \"" << block << "\", included via plus sign.";

           if (dump_)
              *dump_ << "\n####### " << block << " #######" << std::endl;

           if (!pos->second.empty())
              iter_.push_back(IterPair(pos->second.begin(),
                                       pos->second.end()));
      } else {
         cache_ = collector_->resolve(line);
         if (dump_)
            *dump_ << cache_ << std::endl;
         break;
      }
   }
}

Friends And Related Function Documentation

friend class boost::iterator_core_access [friend]

Definition at line 50 of file ParameterCollector.h.

friend class ParameterCollector [friend]

Definition at line 42 of file ParameterCollector.h.


Member Data Documentation

Definition at line 66 of file ParameterCollector.h.

Referenced by dereference().

Definition at line 62 of file ParameterCollector.h.

Definition at line 63 of file ParameterCollector.h.

Definition at line 65 of file ParameterCollector.h.

Referenced by const_iterator(), and equal().

Definition at line 64 of file ParameterCollector.h.