| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Gaudi::Parsers::Parser Class Reference

`#include <ParserUtils.h>`

Collaboration diagram for Gaudi::Parsers::Parser:

[legend]
List of all members.

## Detailed Description

Parser controller.

Author:
  Alexander Mazurov

Date:
  2006-02-17

Definition at line 100 of file ParserUtils.h.

## Public Types
enum | Sign { S_ASSIGN = 0, S_PLUSASSIGN = 1, S_MINUSASSIGN = 2 }
typedef std::vector< Gaudi::Parsers::Message > | MessagesStoreT
typedef std::map< std::string, double > | UnitsStoreT
## Public Member Functions
| Parser (Catalogue &catalogue, std::vector< std::string > &included, std::ostream &m=std::cout)
| Default creator.
| Parser (Catalogue &catalogue, std::vector< std::string > &included, const std::vector< std::string > &searchPath, std::ostream &m=std::cout)
| Constructor from directories list for search files in.
| Parser (Catalogue &catalogue, std::vector< std::string > &included, const std::string &searchPath, std::ostream &m=std::cout)
| Constructor from directories list for search files in.
StatusCode | parse (const std::string &fileName)
| Start parse file.
const std::vector< Message > & | messages ()
| Return parser messages.
int | errorsCount ()
| Count of errors.
UnitsStoreT & | units (void)
void | matchInclude (const std::string &fileName, const Position &pos)
| Do actions when include file is matched.
void | matchUnits (const std::string &fileName, const Position &pos)
| Do actions when units file is matched.
long double | matchUnit (const std::string &unit, const Position &pos)
| Do actions when we match unit.
void | matchUnitEntry (const std::string &newUnit, double value, const Position &pos)
| Do actions when we match unit entry in units file.
void | matchAssign (const std::string &objName, const std::string &propName, const Sign &oper, const std::vector< std::string > &vectorValues, const Position &pos, bool isVector)
| Do actions when we match property.
void | setIsPrint (bool on, const Position &pos)
| Control printing.
void | setIsPrintOptions (bool on, const Position &pos)
| Control printing options.
## Private Member Functions
void | initUnits ()
| Init units.
StatusCode | parseFile (const std::string &fileName, const Position &pos, bool isUnitFile=false)
| Parse file from another file.
void | resolveReferences ()
| Resolve references.
void | addMessage (const Message::Severity &severity, const Message::Code &code, const std::string &message, const Position &pos)
| Add message.
std::string | severityName (Message::Severity severity)
| String representation of severity.
bool | isIncluded (const std::string &fileName)
| Test if file already included.
std::string | sign (Sign aSign)
| String representation of sign.
std::string | valueToString (std::vector< std::string > value, bool isVector)
| String representation of value vector.
bool | isPrint ()
| Print information or not.
void | printOptions ()
| Print options.
std::string | posString (int line, int column)
| Convert position to string.
## Private Attributes
bool | m_isPrint
bool | m_isPrintOptions
std::vector< std::string > | m_searchPath
Catalogue & | m_catalogue
std::vector< std::string > & | m_included
MessagesStoreT | m_messages
UnitsStoreT | m_units
std::ostream & | m_stream

## Member Typedef Documentation

typedef std::vector<Gaudi::Parsers::Message> Gaudi::Parsers::Parser::MessagesStoreT

Definition at line 103 of file ParserUtils.h.

typedef std::map<std::string,double> Gaudi::Parsers::Parser::UnitsStoreT

Definition at line 104 of file ParserUtils.h.

## Member Enumeration Documentation

enum Gaudi::Parsers::Parser::Sign

Enumerator:

  S_ASSIGN |
  S_PLUSASSIGN |
  S_MINUSASSIGN |

Definition at line 105 of file ParserUtils.h.

    00106         {
    00107           S_ASSIGN      = 0 ,
    00108           S_PLUSASSIGN  = 1 ,
    00109           S_MINUSASSIGN = 2
    00110         };

## Constructor & Destructor Documentation

Gaudi::Parsers::Parser::Parser | ( | Catalogue & | catalogue,
|  | std::vector< std::string > & | included,
|  | std::ostream & | m = `std::cout` |
| ) |  |  |

Default creator.

Definition at line 35 of file Parser.cpp.

References Gaudi::Parsers::Utils::extractPath().

    00038   : m_isPrint(true)
    00039   , m_isPrintOptions(false)
    00040   , m_catalogue(catalogue)
    00041   , m_included(included)
    00042   , m_stream ( m )
    00043 {
    00044   m_searchPath = Gaudi::Parsers::Utils::extractPath("$JOBOPTSEARCHPATH");
    00045   initUnits();
    00046 }

Gaudi::Parsers::Parser::Parser | ( | Catalogue & | catalogue,
|  | std::vector< std::string > & | included,
|  | const std::vector< std::string > & | searchPath,
|  | std::ostream & | m = `std::cout` |
| ) |  |  |

Constructor from directories list for search files in.

Definition at line 49 of file Parser.cpp.

    00053   : m_isPrint(true)
    00054   , m_isPrintOptions(false)
    00055   , m_catalogue(catalogue)
    00056   , m_included(included)
    00057   , m_stream ( m )
    00058 {
    00059   m_searchPath = searchPath;
    00060   initUnits();
    00061 }

Gaudi::Parsers::Parser::Parser | ( | Catalogue & | catalogue,
|  | std::vector< std::string > & | included,
|  | const std::string & | searchPath,
|  | std::ostream & | m = `std::cout` |
| ) |  |  |

Constructor from directories list for search files in.

Definition at line 64 of file Parser.cpp.

References Gaudi::Parsers::Utils::extractPath().

    00068   : m_isPrint(true)
    00069   , m_isPrintOptions(false)
    00070   , m_catalogue(catalogue)
    00071   , m_included(included)
    00072   , m_stream ( m )
    00073 {
    00074   m_searchPath = Gaudi::Parsers::Utils::extractPath(searchPath);
    00075   initUnits();
    00076 }

## Member Function Documentation

StatusCode Gaudi::Parsers::Parser::parse | ( | const std::string & | fileName | ) |

Start parse file.

Returns:
  StatusCode::SUCCESS if no errors

Parameters:

  | fileName | File to parse

Definition at line 78 of file Parser.cpp.

References std::endl(), errorsCount(), StatusCode::FAILURE, GPP_COMMENT, StatusCode::ignore(), m_isPrintOptions, m_stream, parseFile(), printOptions(), resolveReferences(), and StatusCode::SUCCESS.

Referenced by Gaudi::Parsers::parse().

    00079 {
    00080   m_stream << GPP_COMMENT + std::string(80,'=') << std::endl;
    00081   parseFile(fileName,Position()).ignore();
    00082   resolveReferences();
    00083   if ( m_isPrintOptions ){ printOptions(); }
    00084   m_stream << GPP_COMMENT + std::string(80,'=') << std::endl;
    00085   return errorsCount()==0?StatusCode::SUCCESS:StatusCode::FAILURE;
    00086 }

const std::vector<Message>& Gaudi::Parsers::Parser::messages | ( |  | ) | `[inline]`

Return parser messages.

Definition at line 128 of file ParserUtils.h.

References m_messages.

Referenced by Gaudi::Parsers::parse().

    00128 {return m_messages;}

int Gaudi::Parsers::Parser::errorsCount | ( |  | ) |

Count of errors.

Definition at line 88 of file Parser.cpp.

References std::vector< _Tp, _Alloc >::begin(), Gaudi::Parsers::Message::E_ERROR, std::vector< _Tp, _Alloc >::end(), and m_messages.

Referenced by parse().

    00089 {
    00090         int result=0;
    00091         for ( MessagesStoreT::const_iterator cur=m_messages.begin();
    00092         cur!=m_messages.end() ; ++cur)
    00093   { if ( cur->severity() == Message::E_ERROR){ ++result; } }
    00094         return result;
    00095 }

UnitsStoreT& Gaudi::Parsers::Parser::units | ( | void |  | ) | `[inline]`

Definition at line 131 of file ParserUtils.h.

References m_units.

    00131 {return m_units;}

void Gaudi::Parsers::Parser::matchInclude | ( | const std::string & | fileName,
|  | const Position & | pos |
| ) |  |  |

Do actions when include file is matched.

Parameters:

  | fileName | File to include

Definition at line 98 of file Parser.cpp.

Referenced by Gaudi::Parsers::ParserGrammar::matchInclude().

    00099 { parseFile(fileName,pos).ignore(); }

void Gaudi::Parsers::Parser::matchUnits | ( | const std::string & | fileName,
|  | const Position & | pos |
| ) |  |  |

Do actions when units file is matched.

Parameters:

  | fileName | File to include

Definition at line 102 of file Parser.cpp.

Referenced by Gaudi::Parsers::ParserGrammar::matchUnits().

    00103 { parseFile(fileName,pos,true).ignore(); }

long double Gaudi::Parsers::Parser::matchUnit | ( | const std::string & | unit,
|  | const Position & | pos |
| ) |  |  |

Do actions when we match unit.

Returns:
  Value of unit (if unit recognized), 1 if not recognized

Parameters:

  | unit | Unit name

Definition at line 107 of file Parser.cpp.

References Gaudi::Parsers::Message::C_UNITNOTFOUND, Gaudi::Parsers::Message::E_ERROR, and format().

Referenced by Gaudi::Parsers::RealUnitsGrammar::matchUnit().

    00109 {
    00110   UnitsStoreT::const_iterator u = m_units.find(unit);
    00111   if ( u==m_units.end())
    00112   {
    00113     addMessage
    00114       ( Message::E_ERROR ,
    00115         Message::C_UNITNOTFOUND,
    00116         boost::str(boost::format("Cann't find unit \"%1%\"")%unit),pos);
    00117     return 1;
    00118   }
    00119   return u->second;
    00120 }

void Gaudi::Parsers::Parser::matchUnitEntry | ( | const std::string & | newUnit,
|  | double | value,
|  | const Position & | pos |
| ) |  |  |

Do actions when we match unit entry in units file.

Parameters:

  | newUnit | New unit
  | value | value of new unit
  | pos | Position of entry

Definition at line 123 of file Parser.cpp.

References Gaudi::Parsers::Position::column(), std::endl(), format(), GPP_COMMENT, and Gaudi::Parsers::Position::line().

Referenced by Gaudi::Parsers::UnitsFileGrammar::matchUnit().

    00126 {
    00127   if(isPrint())
    00128   {
    00129     m_stream
    00130       << boost::format("%4% %2%  = %3%; %|78t|%1%")
    00131       % posString(pos.line(), pos.column())
    00132       % newUnit
    00133       % value
    00134       % GPP_COMMENT
    00135       << std::endl ;
    00136   }
    00137   m_units[newUnit] = value ;
    00138 }

void Gaudi::Parsers::Parser::matchAssign | ( | const std::string & | objName,
|  | const std::string & | propName,
|  | const Sign & | oper,
|  | const std::vector< std::string > & | vectorValues,
|  | const Position & | pos,
|  | bool | isVector |
| ) |  |  |

Do actions when we match property.

Parameters:

  | objName | Object name
  | propName | Property name
  | oper | Operation ("=","+=","-=")
  | value | String value
  | vectorValues | Vector values

Definition at line 141 of file Parser.cpp.

References Gaudi::Parsers::PropertyEntry::addValues(), Gaudi::Parsers::Message::C_CANNOTADDTONOTVECTOR, Gaudi::Parsers::Message::C_CANNOTREMOVEFROMNOTVECTOR, Gaudi::Parsers::Message::C_ZEROREMOVED, Gaudi::Parsers::Position::column(), count(), Gaudi::Parsers::Message::E_ERROR, Gaudi::Parsers::Message::E_WARNING, std::endl(), format(), GPP_COMMENT, StatusCode::isFailure(), Gaudi::Parsers::Position::line(), and Gaudi::Parsers::PropertyEntry::removeValues().

Referenced by Gaudi::Parsers::ParserGrammar::matchAssign().

    00146 {
    00147   // --------------------------------------------------------------------------
    00148   if(isPrint())
    00149   {
    00150     m_stream
    00151       << boost::format("%2% %3% %4%;%|72t|%5% %1%")
    00152       % posString(pos.line(),pos.column())
    00153       % (objName+"."+propName)
    00154       % sign(oper)
    00155       % valueToString(vectorValue , isVector)
    00156       % GPP_COMMENT
    00157       << std::endl ;
    00158   }
    00159   // --------------------------------------------------------------------------
    00160   // --------------------------------------------------------------------------
    00161   if (oper == S_ASSIGN)
    00162   {
    00163     // ------------------------------------------------------------------------
    00164     PropertyEntry* assignProp;
    00165     if(isVector){
    00166       assignProp = new PropertyEntry(propName,vectorValue,pos);
    00167     }else{
    00168       assignProp = new PropertyEntry(propName,vectorValue[0],pos);
    00169     }
    00170     m_catalogue.addProperty(objName,*assignProp);
    00171     delete assignProp;
    00172     // ------------------------------------------------------------------------
    00173   }
    00174   else
    00175   {
    00176     // += or -=
    00177     // ------------------------------------------------------------------------
    00178     PropertyEntry foundProp;
    00179     StatusCode ok;
    00180     ok = m_catalogue.findProperty(objName,propName,foundProp);
    00181     if (ok.isFailure())
    00182     {
    00183       foundProp = PropertyEntry(propName,std::vector<std::string>());
    00184     }
    00185     if(oper == S_PLUSASSIGN)
    00186     {
    00187       ok = foundProp.addValues(vectorValue);
    00188       if(ok.isFailure()){
    00189         addMessage
    00190           ( Message::E_ERROR,
    00191             Message::C_CANNOTADDTONOTVECTOR,
    00192             boost::str
    00193             ( boost::format
    00194               ("Cannot add values to not vector property \"%1%.%2%\"")
    00195               %  objName % propName),pos);
    00196         return;
    00197       }
    00198       m_catalogue.addProperty(objName,foundProp);
    00199     }
    00200     // ------------------------------------------------------------------------
    00201     if(oper == S_MINUSASSIGN)
    00202     {
    00203       int count=0;
    00204       ok = foundProp.removeValues(vectorValue,count);
    00205       if(ok.isFailure()){
    00206         addMessage
    00207           ( Message::E_ERROR,
    00208             Message::C_CANNOTREMOVEFROMNOTVECTOR,
    00209             boost::str
    00210             ( boost::format
    00211               ( "Cannot remove values from not vector property \"%1%.%2%\"" )
    00212               %  objName % propName),pos);
    00213         return;
    00214       }
    00215       // ----------------------------------------------------------------------
    00216       if (count == 0)
    00217       {
    00218         addMessage
    00219           ( Message::E_WARNING,
    00220             Message::C_ZEROREMOVED,
    00221             boost::str
    00222             ( boost::format
    00223               ( "Nothing removed from property \"%1%.%2%\"" )
    00224               %  objName % propName),pos);
    00225       }
    00226       else
    00227       {
    00228         m_catalogue.addProperty(objName,foundProp);
    00229       }
    00230
    00231     }
    00232     // ------------------------------------------------------------------------
    00233   }
    00234 }

void Gaudi::Parsers::Parser::setIsPrint | ( | bool | on,
|  | const Position & | pos |
| ) |  |  |

Control printing.

Definition at line 237 of file Parser.cpp.

References Gaudi::Parsers::Position::column(), std::endl(), format(), GPP_COMMENT, Gaudi::Parsers::Position::line(), and return.

Referenced by Gaudi::Parsers::ParserGrammar::matchPrint().

    00238 {
    00239   // ignore the printout if the full print is activated
    00240   if ( on && m_isPrintOptions ) { return ; }
    00241   m_isPrint = on;
    00242   m_stream
    00243     << boost::format("%3% printing is %2% %|78t|%1%")
    00244     % posString(pos.line(),pos.column())
    00245     % (on?"ON":"OFF")
    00246     % GPP_COMMENT
    00247     << std::endl ;
    00248 }

void Gaudi::Parsers::Parser::setIsPrintOptions | ( | bool | on,
|  | const Position & | pos |
| ) |  |  |

Control printing options.

Definition at line 251 of file Parser.cpp.

References Gaudi::Parsers::Position::column(), std::endl(), format(), GPP_COMMENT, and Gaudi::Parsers::Position::line().

Referenced by Gaudi::Parsers::ParserGrammar::matchPrintOptions().

    00252 {
    00253   m_isPrintOptions = on;
    00254   m_stream
    00255     << boost::format ("%3% printing options is %2% %|78t|%1%")
    00256     % posString(pos.line(),pos.column())
    00257     % (on?"ON":"OFF")
    00258     % GPP_COMMENT
    00259     << std::endl ;
    00260   // deactivate the printout if the print of all options is activated
    00261   if ( m_isPrintOptions && m_isPrint ) { setIsPrint ( false , pos ) ; }
    00262 }

void Gaudi::Parsers::Parser::initUnits | ( |  | ) | `[private]`

Init units.

Definition at line 264 of file Parser.cpp.

References Gaudi::Units::cm, Gaudi::Units::cm2, Gaudi::Units::GeV, Gaudi::Units::keV, Gaudi::Units::m, Gaudi::Units::m2, m_units, Gaudi::Units::MeV, Gaudi::Units::mm, Gaudi::Units::nanosecond, and Gaudi::Units::picosecond.

    00265 {
    00266   m_units[ "mm"   ] = Gaudi::Units::mm  ;
    00267   m_units[ "cm"   ] = Gaudi::Units::cm  ;
    00268   m_units[ "cm2"  ] = Gaudi::Units::cm2 ;
    00269   m_units[ "m"    ] = Gaudi::Units::m   ;
    00270   m_units[ "m2"   ] = Gaudi::Units::m2  ;
    00271   //
    00272   m_units[ "ns"   ] = Gaudi::Units::nanosecond ;
    00273   m_units[ "ps"   ] = Gaudi::Units::picosecond ;
    00274   m_units[ "fs"   ] = Gaudi::Units::picosecond * 0.001 ;
    00275   //
    00276   m_units[ "MeV"  ] = Gaudi::Units::MeV ;
    00277   m_units[ "GeV"  ] = Gaudi::Units::GeV ;
    00278   m_units[ "keV"  ] = Gaudi::Units::keV ;
    00279 }

StatusCode Gaudi::Parsers::Parser::parseFile | ( | const std::string & | fileName,
|  | const Position & | pos,
|  | bool | isUnitFile = `false` |
| ) |  |  | `[private]`

Parse file from another file.

Returns:
  StatusCode::SUCCESS if no *syntax* errors appears

Parameters:

  | fileName | File to parse Information about from what file we call parsing of file

Definition at line 282 of file Parser.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::begin(), std::vector< _Tp, _Alloc >::begin(), Gaudi::Parsers::Message::C_FILENOTFOUND, Gaudi::Parsers::Message::C_FILENOTOPENED, Gaudi::Parsers::Message::C_OK, Gaudi::Parsers::Message::C_SYNTAXERROR, Gaudi::Parsers::Position::column(), Gaudi::Parsers::Message::E_ERROR, Gaudi::Parsers::Message::E_VERBOSE, Gaudi::Parsers::Message::E_WARNING, std::basic_string< _CharT, _Traits, _Alloc >::end(), std::endl(), StatusCode::FAILURE, Gaudi::Parsers::Position::fileName(), format(), GPP_COMMENT, std::vector< _Tp, _Alloc >::insert(), StatusCode::isFailure(), StatusCode::isSuccess(), std::basic_string< _CharT, _Traits, _Alloc >::length(), Gaudi::Parsers::Position::line(), Gaudi::Parsers::parse(), Gaudi::Utils::Histos::path(), Gaudi::Parsers::Utils::readFile(), Gaudi::Parsers::Utils::searchFile(), and StatusCode::SUCCESS.

Referenced by parse().

    00285 {
    00286   StatusCode  ok;
    00287   std::vector<std::string> sp = m_searchPath;
    00288   if(pos.fileName().length()>0){
    00289     // Add current file directory to search path
    00290     sp.insert(sp.begin(),
    00291               fs::path(pos.fileName(),fs::native).branch_path()
    00292               .native_directory_string());
    00293   }
    00294   std::string fileToParse;
    00295   ok = Gaudi::Parsers::Utils::searchFile(fileName,true,sp,fileToParse);
    00296   if(ok.isFailure()){
    00297     addMessage( Message::E_ERROR, Message::C_FILENOTFOUND,
    00298                boost::str(boost::format("Couldn't find file \"%1%\"") % fileName),pos);
    00299     return StatusCode::FAILURE;
    00300   }
    00301
    00302   ok = isIncluded(fileToParse);
    00303   if(ok.isSuccess())
    00304   {
    00305     const std::string _msg =
    00306       ( boost::format("Skip already included file  \"%1%\"") % fileToParse ).str() ;
    00307     addMessage ( Message::E_WARNING , Message::C_OK , _msg , pos ) ;
    00308     if ( isPrint() )
    00309     {
    00310       m_stream
    00311         << boost::format("%3% skip already included file  \"%2%\" %|78t|%1%")
    00312         % posString(pos.line(), pos.column())
    00313         % fileToParse
    00314         % GPP_COMMENT
    00315         << std::endl ;
    00316     }
    00317     return StatusCode::SUCCESS;
    00318   }
    00319   std::string input;
    00320   ok = Gaudi::Parsers::Utils::readFile(fileToParse,input);
    00321   if(ok.isFailure())
    00322   {
    00323     addMessage
    00324       ( Message::E_ERROR, Message::C_FILENOTOPENED,
    00325        boost::str
    00326        (boost::format("Couldn't open file \"%1%\"") % fileToParse),pos);
    00327     return StatusCode::FAILURE;
    00328   }
    00329   m_included.push_back(fileToParse);
    00330
    00331
    00332   IteratorT beginpos(input.begin(), input.end(), fileToParse);
    00333   IteratorT endpos;
    00334
    00335   boost::spirit::parse_info<IteratorT> info;
    00336   SkipperGrammar grSkipper;
    00337
    00338   if(!isUnitsFile){
    00339     m_stream
    00340       << boost::format("%3% include \"%2%\" %|78t|%1%")
    00341       % posString(pos.line(), pos.column())
    00342       % fileToParse
    00343       % GPP_COMMENT
    00344       << std::endl ;
    00345     ParserGrammar grParser(this);
    00346     info = boost::spirit::parse(beginpos, endpos, grParser >> end_p,grSkipper);
    00347   }else{
    00348     m_stream
    00349       << boost::format("#units \"%3%\" %|72t|%2% %1%")
    00350       % posString(pos.line(), pos.column())
    00351       % GPP_COMMENT
    00352       % fileToParse
    00353       << std::endl ;
    00354     UnitsFileGrammar grParser(this);
    00355     info = boost::spirit::parse(beginpos, endpos, grParser >> end_p,grSkipper);
    00356   }
    00357   boost::spirit::file_position stoppos = info.stop.get_position();
    00358   if (!info.full) {
    00359     addMessage(Message::E_ERROR, Message::C_SYNTAXERROR,
    00360                "Syntax error",Position(stoppos.file,stoppos.line,stoppos.column));
    00361     return StatusCode::FAILURE;
    00362   }
    00363   {
    00364     std::string _msg =
    00365       ( boost::format("Parsed file \"%2%\" %|78t|%1%")
    00366         % posString(stoppos.line, stoppos.column)
    00367         % fileToParse ) .str() ;
    00368     addMessage ( Message::E_VERBOSE ,
    00369                  Message::C_OK ,
    00370                  _msg ,
    00371                  Position(stoppos.file,stoppos.line,stoppos.column) ) ;
    00372     if ( isPrint() )
    00373     {
    00374       m_stream
    00375         << boost::format("%3% end  \"%2%\" %|78t|%1%")
    00376         % posString(stoppos.line, stoppos.column)
    00377         % fileToParse
    00378         % GPP_COMMENT
    00379         << std::endl ;
    00380     }
    00381   }
    00382   return StatusCode::SUCCESS;
    00383 }

void Gaudi::Parsers::Parser::resolveReferences | ( |  | ) | `[private]`

Resolve references.

Definition at line 434 of file Parser.cpp.

References addMessage(), Gaudi::Parsers::Catalogue::addProperty(), Gaudi::Parsers::Message::C_BADREFERENCE, Gaudi::Parsers::Message::C_PROPERTYNOTFOUND, Gaudi::Parsers::Catalogue::catalogue(), Gaudi::Parsers::Message::E_ERROR, Gaudi::Parsers::Catalogue::findProperty(), format(), StatusCode::isFailure(), m_catalogue, and Gaudi::Parsers::PropertyEntry::setName().

Referenced by parse().

    00435 {
    00436   Catalogue::CatalogueT cat = m_catalogue.catalogue();
    00437   // ----------------------------------------------------------------------------
    00438   for( Catalogue::CatalogueT::const_iterator curObj = cat.begin();
    00439        curObj!=cat.end();curObj++)
    00440   {
    00441     std::string objName = curObj->first;
    00442     // ------------------------------------------------------------------------
    00443     for( std::vector<PropertyEntry>::const_iterator curProp =
    00444            curObj->second.begin();curProp != curObj->second.end(); curProp++)
    00445     {
    00446       std::string value = curProp->value();
    00447       if ( (value.length()>0) && (value[0]=='@'))
    00448       {
    00449         // --------------------------------------------------------------------
    00450         std::vector<std::string> objAndProp;
    00451         std::string refprop(value.begin()+1,value.end());
    00452         ba::split(objAndProp,
    00453                   refprop,
    00454                   ba::is_any_of("."));
    00455         PropertyEntry foundProperty;
    00456         StatusCode ok;
    00457         ok = m_catalogue.findProperty(objAndProp[0],objAndProp[1],
    00458                                       foundProperty);
    00459         if(ok.isFailure())
    00460         {
    00461           addMessage
    00462             ( Message::E_ERROR,
    00463               Message::C_PROPERTYNOTFOUND,
    00464               boost::str(boost::format("Cannot find property \"%1%.%2%\"")
    00465                          % objAndProp[0] % objAndProp[1]),curProp->position());
    00466         }
    00467         else
    00468         {
    00469           // -------------------------------------------------------------------
    00470           if((ba::to_lower_copy(objAndProp[0]) == objName)
    00471              &&
    00472              (ba::to_lower_copy(objAndProp[1])
    00473               == curProp->name()))
    00474           {
    00475             // ----------------------------------------------------------------
    00476             addMessage
    00477               ( Message::E_ERROR,
    00478                 Message::C_BADREFERENCE,
    00479                 boost::str(boost::format("Reference to self \"%1%.%2%\"")
    00480                            % objAndProp[0] % objAndProp[1]),curProp->position());
    00481             // ----------------------------------------------------------------
    00482           }
    00483           else
    00484           {
    00485             PropertyEntry property = foundProperty;
    00486             property.setName(curProp->name());
    00487             m_catalogue.addProperty(objName,property);
    00488           }
    00489           // ------------------------------------------------------------------
    00490         }
    00491         // --------------------------------------------------------------------
    00492       }
    00493     }
    00494     // ------------------------------------------------------------------------
    00495   }
    00496 }

void Gaudi::Parsers::Parser::addMessage | ( | const Message::Severity & | severity,
|  | const Message::Code & | code,
|  | const std::string & | message,
|  | const Position & | pos |
| ) |  |  | `[private]`

Add message.

Parameters:

  | severity | Message severity
  | code | Code of message
  | message | Message
  | pos | File position

Definition at line 403 of file Parser.cpp.

References Gaudi::Parsers::Position::column(), Gaudi::Parsers::Position::fileName(), format(), and Gaudi::Parsers::Position::line().

Referenced by resolveReferences().

    00407 {
    00408   Message result
    00409     ( severity , code,
    00410       boost::str(boost::format("%1%(%2%,%3%) : %4% #%5% : %6%") % pos.fileName()
    00411                  % pos.line() % pos.column() % severityName(severity) % code
    00412                  % message));
    00413   m_messages.push_back(result);
    00414 }

std::string Gaudi::Parsers::Parser::severityName | ( | Message::Severity | severity | ) | `[private]`

String representation of severity.

Returns:
  Representation of severity

Parameters:

  | severity | Severity

Definition at line 386 of file Parser.cpp.

References Gaudi::Parsers::Message::E_ERROR, Gaudi::Parsers::Message::E_NOTICE, Gaudi::Parsers::Message::E_VERBOSE, and Gaudi::Parsers::Message::E_WARNING.

    00386                           {
    00387   switch(severity)
    00388   {
    00389   case Message::E_ERROR   :
    00390     return "ERROR"     ;
    00391   case Message::E_WARNING :
    00392     return "WARNING"   ;
    00393   case Message::E_NOTICE  :
    00394     return "NOTICE"    ;
    00395   case Message::E_VERBOSE :
    00396     return "VERBOSE"   ;
    00397   default:
    00398     return "UNDEFINED" ;
    00399   }
    00400 }

bool Gaudi::Parsers::Parser::isIncluded | ( | const std::string & | fileName | ) | `[private]`

Test if file already included.

Returns:
  true if file already included

Parameters:

  | fileName | File name

Definition at line 422 of file Parser.cpp.

References m_included.

    00423 {
    00424   for(std::vector<std::string>::const_iterator cur=m_included.begin();
    00425       cur!=m_included.end();cur++)
    00426   { if(fileName==*cur){ return true; } }
    00427   return false;
    00428 }

std::string Gaudi::Parsers::Parser::sign | ( | Sign | aSign | ) | `[private]`

String representation of sign.

Definition at line 500 of file Parser.cpp.

References S_ASSIGN, S_MINUSASSIGN, and S_PLUSASSIGN.

    00501 {
    00502   switch(aSign)
    00503   {
    00504   case S_ASSIGN:
    00505     return "=";
    00506   case S_PLUSASSIGN:
    00507     return "+=";
    00508   case S_MINUSASSIGN:
    00509     return "-=";
    00510   default:
    00511     return "unknown_operation";
    00512   }
    00513 }

std::string Gaudi::Parsers::Parser::valueToString | ( | std::vector< std::string > | value,
|  | bool | isVector |
| ) |  |  | `[private]`

String representation of value vector.

Definition at line 518 of file Parser.cpp.

References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::end().

    00519 {
    00520   if ( !isVector){ return value[0]; }
    00521   //
    00522   std::string result;
    00523   std::string delim;
    00524   result+=" [ ";
    00525   for ( std::vector<std::string>::const_iterator cur = value.begin();
    00526         cur != value.end(); cur++ )
    00527   {
    00528     result += delim + *cur;
    00529     delim = " , ";
    00530   }
    00531   return result + " ] ";
    00532 }

bool Gaudi::Parsers::Parser::isPrint | ( |  | ) | `[inline, private]`

Print information or not.

Definition at line 225 of file ParserUtils.h.

References m_isPrint.

    00225 { return m_isPrint;}

void Gaudi::Parsers::Parser::printOptions | ( |  | ) | `[private]`

Print options.

Definition at line 536 of file Parser.cpp.

References m_catalogue, and m_stream.

Referenced by parse().

    00536 { m_stream << m_catalogue ; }

std::string Gaudi::Parsers::Parser::posString | ( | int | line,
|  | int | column |
| ) |  |  | `[private]`

Convert position to string.

Returns:
  string representation of position

Parameters:

  | line | Line
  | column | Column

Definition at line 545 of file Parser.cpp.

References format().

    00546 { return boost::str(boost::format("(%1%,%2%)") % line % column); }

## Member Data Documentation

bool Gaudi::Parsers::Parser::m_isPrint`[private]`

Definition at line 175 of file ParserUtils.h.

Referenced by isPrint().

bool Gaudi::Parsers::Parser::m_isPrintOptions`[private]`

Definition at line 176 of file ParserUtils.h.

Referenced by parse().

std::vector<std::string> Gaudi::Parsers::Parser::m_searchPath`[private]`

Definition at line 177 of file ParserUtils.h.

Catalogue& Gaudi::Parsers::Parser::m_catalogue`[private]`

Definition at line 178 of file ParserUtils.h.

Referenced by printOptions(), and resolveReferences().

std::vector<std::string>& Gaudi::Parsers::Parser::m_included`[private]`

Definition at line 179 of file ParserUtils.h.

Referenced by isIncluded().

MessagesStoreT Gaudi::Parsers::Parser::m_messages`[private]`

Definition at line 180 of file ParserUtils.h.

Referenced by errorsCount(), and messages().

UnitsStoreT Gaudi::Parsers::Parser::m_units`[private]`

Definition at line 181 of file ParserUtils.h.

Referenced by initUnits(), and units().

std::ostream& Gaudi::Parsers::Parser::m_stream`[private]`

Definition at line 182 of file ParserUtils.h.

Referenced by parse(), and printOptions().

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/JobOptionsSvc/ParserUtils.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/JobOptionsSvc/Parser.cpp