| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RuleParser Namespace Reference

PrescaleRule Nathaniel Tagg (tagg@minos.phy.tufts.edu) Example of a custom rule and factory that can do prescaling. More...


Classes

class  ParameterDescription
class  ParameterList
class  PrescaleRule
 Example of a custom rule and factory that can do prescaling. More...
class  PrescaleRuleFactory
 Example of a custom rule and factory that can do prescaling. More...
class  Queriable
class  RuleFactory
 (non)virtual base class for a user-creatable class that makes a rule. More...
class  Rule
 Base class for a generic rule. More...
class  AnyRule
 Always returns true, for any input. More...
class  NoneRule
 Always returns false, for any input. More...
class  AndRule
 Logical AND of two owned rules. More...
class  OrRule
 Logical OR of two owned rules. More...
class  NotRule
 negates owned rules. More...
class  LT_Rule
 Less than rule - is parameter less than cut? More...
class  LE_Rule
 Less-than or equal-to than rule - is parameter less than cut? More...
class  GT_Rule
 Less than rule - is parameter less than cut? More...
class  GE_Rule
 Greater-than or equal-to than rule - is parameter less than cut? More...
class  EQ_Rule
 equal-to rule More...
class  NEQ_Rule
 not-equal-to rule More...

Functions

bool CreateRules (const std::string &inString, const ParameterList &inParameters, Rule *&outRule)
 CreateRules This function will parse the string given, and return a created tree of Rules that can be used to evaluate whatever object the user wants. The parameter list provided will define the rules. The returned Rule object is owned by the caller. Deleteing this object will destroy the calling tree. Returns true for success, false for parsing failure. Will print to cout any parsing problems.

Detailed Description

PrescaleRule Nathaniel Tagg (tagg@minos.phy.tufts.edu) Example of a custom rule and factory that can do prescaling.

To use: Declare a parameter: ParameterDescription("prescale",0,typeid(int),std::vector<std::string>(1,"by"),PrescaleRuleFactory)


Function Documentation

bool RuleParser::CreateRules ( const std::string &  inString,
const ParameterList inParameters,
Rule *&  outRule 
)

CreateRules This function will parse the string given, and return a created tree of Rules that can be used to evaluate whatever object the user wants. The parameter list provided will define the rules. The returned Rule object is owned by the caller. Deleteing this object will destroy the calling tree. Returns true for success, false for parsing failure. Will print to cout any parsing problems.

Author:
Nathaniel Tagg

Definition at line 522 of file CreateRules.cc.

00527 {
00532   
00533   ParserStore store;  //mustn't delete until ruleparser is dead.
00534   ruleparser rp(store,inParameters);    //  Our parser
00535 
00536   // Default.
00537   outRule = 0; // Failure.
00538 
00539   if(inString.empty()) {
00540     // In the case of no selection, default to selecting nothing.
00541     outRule = new NoneRule;
00542   }
00543   
00544   store.clear();
00545   
00546   // Fix for a bug in Spirit.. this is the recommended workaround.
00547   parse_info<> info = parse(inString.c_str(), rp, space_p);
00548 
00549   if (info.full)
00550   {
00551     outRule = store.mStackRules.top();
00552     return true;
00553   }
00554   cerr << "-------------------------\n";
00555   cerr << "Parsing failed\n";
00556   cerr << "stopped at: \"" << info.stop << "\"\n";
00557   cerr << "-------------------------\n";
00558   return false;
00559 }

| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:09:15 2011 for RuleParser by doxygen 1.4.7