SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit

Categories::Set represents a single category constraint used by the Categories class. More...
#include <Categories.h>
Public Types  
using  CombinationMode = Categories::CombinationMode 
Public Member Functions  
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.  
void  reset () 
Remove all names from both inclusion and exclusion sets.  
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.  
int  compare (const Set &rhs) const 
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 
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.  
bool  passes (const std::set< std::string > &cats) const 
Return true if the input set of categories satisfies the Set's constraints. More...  
bool  passes (const std::string &cat) const 
Return true if the input set of categories satisfies the Set's constraints. More...  
Static Public Member Functions  
static bool  passesCheck (const std::set< std::string > &cats, const std::set< std::string > &testSet, Set::CombinationMode comboMode) 
Categories::Set represents a single category constraint used by the Categories class.
A Set consists of two sets of category names representing the categories that should exist (inclusion) and the categories that should not exist (exclusion). Each set also has a combination mode associated with it. For example if the inclusion mode is Or then the inclusion set's constraint is satisfied if any of its categories names exists in a input set of category names. Else the inclusion mode is And, then all of the inclusion set's names must exist in the input set. In the case of the exclusion set , the result is the complement. So exclusion mode = Or means the exclusion test fails if any of the excluded names are in the input while And means that only if all of the names in the exclusion set are in the input will the test fail.
There is also a top level combination mode that determines how the inclusion and exclusion results are combined. If the top mode is And then both the inclusion and exclusion checks must pass while Or means only one of the checks need to pass.
Special notes: If the top combination mode is And and the inclusion set is empty, then the passes check will always fail. If the top combination mode is Or and the exclusion set is empty, then the passes check will always succeed.
bool Categories::Set::passes  (  const std::set< std::string > &  cats  )  const 
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.
bool Categories::Set::passes  (  const std::string &  cat  )  const 
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.