www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ExpressionBuilder::EBTermSubstitution Class Reference

Generic Substitution rule to replace all occurences of a given symbol node term with a user defined term. More...

#include <ExpressionBuilder.h>

Inheritance diagram for ExpressionBuilder::EBTermSubstitution:
[legend]

Public Member Functions

 EBTermSubstitution (const EBTerm &find, const EBTerm &replace)
 
virtual ~EBTermSubstitution ()
 
virtual EBTermNodeapply (const EBTermNode *) const
 

Protected Member Functions

virtual EBTermNodesubstitute (const EBSymbolNode &) const
 

Protected Attributes

std::string _find
 
EBTermNode_replace
 

Detailed Description

Generic Substitution rule to replace all occurences of a given symbol node term with a user defined term.

This is used by EBFunction.

Definition at line 321 of file ExpressionBuilder.h.

Constructor & Destructor Documentation

ExpressionBuilder::EBTermSubstitution::EBTermSubstitution ( const EBTerm find,
const EBTerm replace 
)

Definition at line 440 of file ExpressionBuilder.C.

442 {
443  // the expression we want to substitute (has to be a symbol node)
444  const EBSymbolNode * find_root = dynamic_cast<const EBSymbolNode *>(find.getRoot());
445  if (find_root == NULL)
446  mooseError("Function arguments must be pure symbols.");
447  _find = find_root->stringify();
448 
449  // the term we want to substitute with
450  if (replace.getRoot() != NULL)
451  _replace = replace.cloneRoot();
452  else
453  mooseError("Trying to substitute in an empty term for ", _find);
454 }
virtual ExpressionBuilder::EBTermSubstitution::~EBTermSubstitution ( )
inlinevirtual

Definition at line 325 of file ExpressionBuilder.h.

325 { delete _replace; }

Member Function Documentation

virtual EBTermNode* ExpressionBuilder::EBSubstitutionRuleTyped< EBSymbolNode >::apply ( const EBTermNode ) const
virtualinherited
ExpressionBuilder::EBTermNode * ExpressionBuilder::EBTermSubstitution::substitute ( const EBSymbolNode node) const
protectedvirtual

Implements ExpressionBuilder::EBSubstitutionRuleTyped< EBSymbolNode >.

Definition at line 457 of file ExpressionBuilder.C.

458 {
459  if (node.stringify() == _find)
460  return _replace->clone();
461  else
462  return NULL;
463 }
virtual EBTermNode * clone() const =0

Member Data Documentation

std::string ExpressionBuilder::EBTermSubstitution::_find
protected

Definition at line 328 of file ExpressionBuilder.h.

EBTermNode* ExpressionBuilder::EBTermSubstitution::_replace
protected

Definition at line 329 of file ExpressionBuilder.h.


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