www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
AttribExecOns Class Referenceabstract

#include <Attributes.h>

Inheritance diagram for AttribExecOns:
[legend]

Public Member Functions

 AttribExecOns (TheWarehouse &w, unsigned int exec_flag)
 
virtual void initFrom (const MooseObject *obj) override
 initFrom reads and stores the desired meta-data from obj for later matching comparisons. More...
 
virtual bool isMatch (const Attribute &other) const override
 isMatch returns true if the meta-data stored in this attribute is equivalent to that stored in other. More...
 
virtual bool isEqual (const Attribute &other) const override
 isEqual returns true if the meta-data stored in this attribute is identical to that stored in other. More...
 
 hashfunc (_vals)
 
 clonefunc (AttribExecOns)
 
bool operator== (const Attribute &other) const
 
bool operator!= (const Attribute &other) const
 
unsigned int id () const
 returns the unique attribute ID associated with all attributes that have the same (mose derived) class as this object. More...
 
virtual size_t hash () const =0
 This function must return a deterministic value that is uniquely determined by the data the attribute holds (i.e. More...
 
virtual std::unique_ptr< Attributeclone () const =0
 clone creates and returns and identical (deep) copy of this attribute - i.e. More...
 

Private Attributes

std::vector< unsigned int > _vals
 

Detailed Description

Definition at line 84 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttribExecOns()

AttribExecOns::AttribExecOns ( TheWarehouse w,
unsigned int  exec_flag 
)
inline

Definition at line 87 of file Attributes.h.

87  : Attribute(w, "exec_ons")
88  {
89  _vals.push_back(exec_flag);
90  }
Attribute(TheWarehouse &w, const std::string name)
Constructs/initializes a new attribute with the specified name for use in warehouse w...
Definition: TheWarehouse.C:36
std::vector< unsigned int > _vals
Definition: Attributes.h:98

Member Function Documentation

◆ clone()

virtual std::unique_ptr<Attribute> Attribute::clone ( ) const
pure virtualinherited

clone creates and returns and identical (deep) copy of this attribute - i.e.

the result of clone should return true if passed into isMatch.

Referenced by TheWarehouse::update().

◆ clonefunc()

AttribExecOns::clonefunc ( AttribExecOns  )

◆ hash()

virtual size_t Attribute::hash ( ) const
pure virtualinherited

This function must return a deterministic value that is uniquely determined by the data the attribute holds (i.e.

is initialized with). Ideally, the data should be uniformly and randomly distributed across the domain of size_t values - e.g. 1 and 2 should hash to completely unrelated values. Use of std::hash for POD is encouraged. A convenience hash_combine function is also provided to combine the results an existing hash with one or more other values.

Referenced by std::hash< Attribute >::operator()().

◆ hashfunc()

AttribExecOns::hashfunc ( _vals  )

◆ id()

unsigned int Attribute::id ( ) const
inlineinherited

returns the unique attribute ID associated with all attributes that have the same (mose derived) class as this object.

This ID is determined at construction time this

Definition at line 48 of file TheWarehouse.h.

Referenced by std::hash< Attribute >::operator()().

48 { return _id; }

◆ initFrom()

void AttribExecOns::initFrom ( const MooseObject obj)
overridevirtual

initFrom reads and stores the desired meta-data from obj for later matching comparisons.

Implements Attribute.

Definition at line 80 of file Attributes.C.

81 {
82  _vals.clear();
83  auto sup = dynamic_cast<const SetupInterface *>(obj);
84  if (sup)
85  {
86  auto e = sup->getExecuteOnEnum();
87  for (auto & on : e.items())
88  if (e.contains(on))
89  _vals.push_back(on);
90  }
91 }
std::vector< unsigned int > _vals
Definition: Attributes.h:98
const ExecFlagEnum & getExecuteOnEnum() const
Return the execute on MultiMooseEnum for this object.

◆ isEqual()

bool AttribExecOns::isEqual ( const Attribute other) const
overridevirtual

isEqual returns true if the meta-data stored in this attribute is identical to that stored in other.

isEqual does not need to check/compare the values from the instances' id() functions.

Implements Attribute.

Definition at line 110 of file Attributes.C.

111 {
112  auto a = dynamic_cast<const AttribExecOns *>(&other);
113  if (!a || a->_vals.size() != _vals.size())
114  return false;
115 
116  for (size_t i = 0; i < a->_vals.size(); i++)
117  if (a->_vals[i] != _vals[i])
118  return false;
119  return true;
120 }
std::vector< unsigned int > _vals
Definition: Attributes.h:98

◆ isMatch()

bool AttribExecOns::isMatch ( const Attribute other) const
overridevirtual

isMatch returns true if the meta-data stored in this attribute is equivalent to that stored in other.

This is is for query matching - not exact equivalence. isMatch does not need to check/compare the values from the instances' id() functions.

Implements Attribute.

Definition at line 94 of file Attributes.C.

95 {
96  auto a = dynamic_cast<const AttribExecOns *>(&other);
97  if (!a || a->_vals.size() < 1)
98  return false;
99  auto cond = a->_vals[0];
100  if (cond == Moose::ALL)
101  return true;
102 
103  for (auto val : _vals)
104  if (val == Moose::ALL || val == cond)
105  return true;
106  return false;
107 }
std::vector< unsigned int > _vals
Definition: Attributes.h:98

◆ operator!=()

bool Attribute::operator!= ( const Attribute other) const
inlineinherited

Definition at line 43 of file TheWarehouse.h.

43 { return !(*this == other); }

◆ operator==()

bool Attribute::operator== ( const Attribute other) const
inlineinherited

Definition at line 39 of file TheWarehouse.h.

40  {
41  return _id == other._id && isEqual(other);
42  }
virtual bool isEqual(const Attribute &other) const =0
isEqual returns true if the meta-data stored in this attribute is identical to that stored in other...

Member Data Documentation

◆ _vals

std::vector<unsigned int> AttribExecOns::_vals
private

Definition at line 98 of file Attributes.h.

Referenced by AttribExecOns(), initFrom(), isEqual(), and isMatch().


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