SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::common::Categories::Expression Class Reference
Inheritance diagram for smtk::common::Categories::Expression:
[legend]
Collaboration diagram for smtk::common::Categories::Expression:
[legend]

Public Member Functions

void setAllPass ()
 Set the expression to pass all sets of categories.
 
void setAllReject ()
 Set the expression to reject any set of categories.
 
bool allPass () const
 Indicates that the expression is set to pass all sets of categories.
 
bool allReject () const
 Indicates that the expression is set to reject all sets of categories.
 
void reset () override
 Resets the expression to its unset condition and sets the default evaluator to reject all.
 
bool isSet () const
 Indicates that the expression has been set.
 
int compare (const Set &rhs) const override
 Compares with other set - returns -1 if this < rhs, 0 if they are equal, and 1 if this > rhs.
 
std::string convertToString (const std::string &prefix="") const override
 
const std::set< std::string > & categoryNames () const
 
bool setExpression (const std::string &expString)
 Set/Get the expression string. More...
 
const std::string & expression () const
 Set/Get the expression string. More...
 
bool passes (const std::set< std::string > &cats) const override
 Return true if the input set of categories satisfies the Set's constraints. More...
 
bool passes (const std::string &cat) const override
 Return true if the input set of categories satisfies the Set's constraints. More...
 
- Public Member Functions inherited from smtk::common::Categories::Set
const std::set< std::string > & includedCategoryNames () const
 Return the set of category names associated with the inclusion set.
 
void setInclusions (const std::set< std::string > &values, Set::CombinationMode mode)
 Set the mode and category names of the inclusion set.
 
const std::set< std::string > & excludedCategoryNames () const
 Return the set of category names associated with the exclusion set.
 
void setExclusions (const std::set< std::string > &values, Set::CombinationMode mode)
 Set the mode and category names of the exclusion set.
 
void insertInclusion (const std::string &val)
 Add a category name to the inclusion set.
 
void insertExclusion (const std::string &val)
 Add a category name to the exclusion set.
 
void eraseInclusion (const std::string &val)
 Remove a category name from the inclusion set.
 
void eraseExclusion (const std::string &val)
 Remove a category name from the exclusion set.
 
bool empty () const
 Returns true if both the inclusion and exclusion sets are empty and the combination mode is set to And since this would represent a set that matches nothing.
 
std::size_t inclusionSize () const
 Returns the number of category names in the inclusion set.
 
std::size_t exclusionSize () const
 Returns the number of category names in the exclusion set.
 
Set::CombinationMode combinationMode () const
 Set/Get the how the sets of included and excluded categories are combined.
 
bool setCombinationMode (const Set::CombinationMode &newMode)
 Set/Get the how the sets of included and excluded categories are combined.
 
Set::CombinationMode inclusionMode () const
 Set/Get the CombinationMode associated with the included categories.
 
void setInclusionMode (const Set::CombinationMode &newMode)
 Set/Get the CombinationMode associated with the included categories.
 
Set::CombinationMode exclusionMode () const
 Set/Get the CombinationMode associated with the excluded categories.
 
void setExclusionMode (const Set::CombinationMode &newMode)
 Set/Get the CombinationMode associated with the excluded categories.
 

Protected Member Functions

void updatedSetInfo () override
 
bool buildEvaluator ()
 

Protected Attributes

std::string m_expression
 
categories::Evaluators::Eval m_evaluator
 
bool m_allPass = false
 
bool m_isSet = false
 
std::set< std::string > m_categoryNames
 
- Protected Attributes inherited from smtk::common::Categories::Set
Set::CombinationMode m_includeMode { Set::CombinationMode::Or }
 
Set::CombinationMode m_excludeMode { Set::CombinationMode::Or }
 
Set::CombinationMode m_combinationMode { Set::CombinationMode::And }
 
std::set< std::string > m_includedCategories
 
std::set< std::string > m_excludedCategories
 

Additional Inherited Members

- Public Types inherited from smtk::common::Categories::Set
using CombinationMode = Categories::CombinationMode
 
- Static Public Member Functions inherited from smtk::common::Categories::Set
static bool passesCheck (const std::set< std::string > &cats, const std::set< std::string > &testSet, Set::CombinationMode comboMode)
 

Member Function Documentation

◆ expression()

const std::string & Categories::Expression::expression ( ) const

Set/Get the expression string.

Setting the expression will return true if the string represented a valid expression and will construct an appropriate evaluator. If not, no changes are made and false is returned.

◆ passes() [1/2]

bool Categories::Expression::passes ( const std::set< std::string > &  cats) const
overridevirtual

Return true if the input set of categories satisfies the Set's constraints.

If the input set is empty then the method will return true. Else if the instance's mode is Or then at least one of its category names must be in the input set. If the mode is And then all of the instance's names must be in the input set.

Reimplemented from smtk::common::Categories::Set.

◆ passes() [2/2]

bool Categories::Expression::passes ( const std::string &  cat) const
overridevirtual

Return true if the input set of categories satisfies the Set's constraints.

If the input set is empty then the method will return true. Else if the instance's mode is Or then at least one of its category names must be in the input set. If the mode is And then all of the instance's names must be in the input set.

Reimplemented from smtk::common::Categories::Set.

◆ setExpression()

bool Categories::Expression::setExpression ( const std::string &  expString)

Set/Get the expression string.

Setting the expression will return true if the string represented a valid expression and will construct an appropriate evaluator. If not, no changes are made and false is returned.


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