https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
AttribExecOns Class Referenceabstract

#include <Attributes.h>

Inheritance diagram for AttribExecOns:
[legend]

Public Types

typedef int Key
 

Public Member Functions

void setFrom (Key k)
 
 AttribExecOns (TheWarehouse &w)
 
 AttribExecOns (TheWarehouse &w, const int id)
 
 AttribExecOns (TheWarehouse &w, const ExecFlagType &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 std::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...
 

Static Public Attributes

static const ExecFlagType EXEC_ALL = registerExecFlag("ALL")
 Execute flag that is used to represent all flags when querying AttribExecOns. More...
 

Private Attributes

std::vector< Key_vals
 

Detailed Description

Definition at line 132 of file Attributes.h.

Member Typedef Documentation

◆ Key

Definition at line 138 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttribExecOns() [1/3]

AttribExecOns::AttribExecOns ( TheWarehouse w)
inline

Definition at line 145 of file Attributes.h.

145 : Attribute(w, "exec_ons") {}
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

◆ AttribExecOns() [2/3]

AttribExecOns::AttribExecOns ( TheWarehouse w,
const int  id 
)
inline

Definition at line 146 of file Attributes.h.

146 : Attribute(w, "exec_ons"), _vals({id}) {}
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< Key > _vals
Definition: Attributes.h:158

◆ AttribExecOns() [3/3]

AttribExecOns::AttribExecOns ( TheWarehouse w,
const ExecFlagType exec_flag 
)
inline

Definition at line 147 of file Attributes.h.

148  : Attribute(w, "exec_ons"), _vals({exec_flag.id()})
149  {
150  }
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< Key > _vals
Definition: Attributes.h:158
const int & id() const
Return the numeric, name, or raw name.
Definition: MooseEnumItem.h:34

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 std::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 68 of file TheWarehouse.h.

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

68 { 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 133 of file Attributes.C.

134 {
135  _vals.clear();
136  if (const auto sup = dynamic_cast<const SetupInterface *>(obj))
137  {
138  const auto & current_items = sup->getExecuteOnEnum();
139  _vals.reserve(current_items.size());
140  for (auto & on : current_items)
141  _vals.push_back(on);
142  }
143 }
std::vector< Key > _vals
Definition: Attributes.h:158

◆ 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 162 of file Attributes.C.

163 {
164  auto a = dynamic_cast<const AttribExecOns *>(&other);
165  if (!a || a->_vals.size() != _vals.size())
166  return false;
167 
168  for (size_t i = 0; i < a->_vals.size(); i++)
169  if (a->_vals[i] != _vals[i])
170  return false;
171  return true;
172 }
std::vector< Key > _vals
Definition: Attributes.h:158

◆ 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 146 of file Attributes.C.

147 {
148  auto a = dynamic_cast<const AttribExecOns *>(&other);
149  if (!a || a->_vals.empty())
150  return false;
151  auto cond = a->_vals[0];
152  if (cond == EXEC_ALL)
153  return true;
154 
155  for (const auto val : _vals)
156  if (val == EXEC_ALL || val == cond)
157  return true;
158  return false;
159 }
std::vector< Key > _vals
Definition: Attributes.h:158
static const ExecFlagType EXEC_ALL
Execute flag that is used to represent all flags when querying AttribExecOns.
Definition: Attributes.h:136

◆ operator!=()

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

Definition at line 63 of file TheWarehouse.h.

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

◆ operator==()

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

Definition at line 59 of file TheWarehouse.h.

60  {
61  return _id == other._id && isEqual(other);
62  }
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...

◆ setFrom()

void AttribExecOns::setFrom ( Key  k)
inline

Definition at line 139 of file Attributes.h.

140  {
141  _vals.clear();
142  _vals.push_back(k);
143  }
std::vector< Key > _vals
Definition: Attributes.h:158

Member Data Documentation

◆ _vals

std::vector<Key> AttribExecOns::_vals
private

Definition at line 158 of file Attributes.h.

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

◆ EXEC_ALL

const ExecFlagType AttribExecOns::EXEC_ALL = registerExecFlag("ALL")
static

Execute flag that is used to represent all flags when querying AttribExecOns.

Definition at line 136 of file Attributes.h.

Referenced by isMatch().


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