/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Classes | Functions
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

Detailed Description

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

This file describes the basic Rules provided by the RuleParser system.

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

These rules can be composed by the user, or they can be built intperetively by the parser.


Function Documentation

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

CreateRules

Author:
Nathaniel Tagg 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.

Main parser function. Takes the selection string and returns a set of rules. This bit is fairly intensive and shouldn't be done except at initialization time.

Definition at line 522 of file CreateRules.cc.

{
  
  ParserStore store;  //mustn't delete until ruleparser is dead.
  ruleparser rp(store,inParameters);    //  Our parser

  // Default.
  outRule = 0; // Failure.

  if(inString.empty()) {
    // In the case of no selection, default to selecting nothing.
    outRule = new NoneRule;
  }
  
  store.clear();
  
  // Fix for a bug in Spirit.. this is the recommended workaround.
  parse_info<> info = parse(inString.c_str(), rp, space_p);

  if (info.full)
  {
    outRule = store.mStackRules.top();
    return true;
  }
  cerr << "-------------------------\n";
  cerr << "Parsing failed\n";
  cerr << "stopped at: \"" << info.stop << "\"\n";
  cerr << "-------------------------\n";
  return false;
}
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:53:45 for RuleParser by doxygen 1.7.4