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

#include <Attributes.h>

Inheritance diagram for AttribInterfaces:
[legend]

Public Member Functions

 AttribInterfaces (TheWarehouse &w, Interfaces mask)
 
 AttribInterfaces (TheWarehouse &w, unsigned int mask)
 
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 (_val)
 
 clonefunc (AttribInterfaces)
 
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

uint64_t _val = 0
 

Detailed Description

Definition at line 226 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttribInterfaces() [1/2]

AttribInterfaces::AttribInterfaces ( TheWarehouse w,
Interfaces  mask 
)
inline

Definition at line 229 of file Attributes.h.

230  : Attribute(w, "interfaces"), _val(static_cast<uint64_t>(mask))
231  {
232  }
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

◆ AttribInterfaces() [2/2]

AttribInterfaces::AttribInterfaces ( TheWarehouse w,
unsigned int  mask 
)
inline

Definition at line 233 of file Attributes.h.

233 : Attribute(w, "interfaces"), _val(mask) {}
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

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()

AttribInterfaces::clonefunc ( AttribInterfaces  )

◆ 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()

AttribInterfaces::hashfunc ( _val  )

◆ 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 AttribInterfaces::initFrom ( const MooseObject obj)
overridevirtual

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

Implements Attribute.

Definition at line 320 of file Attributes.C.

321 {
322  _val = 0;
323  // clang-format off
324  _val |= (unsigned int)Interfaces::UserObject * (dynamic_cast<const UserObject *>(obj) != nullptr);
325  _val |= (unsigned int)Interfaces::ElementUserObject * (dynamic_cast<const ElementUserObject *>(obj) != nullptr);
326  _val |= (unsigned int)Interfaces::SideUserObject * (dynamic_cast<const SideUserObject *>(obj) != nullptr);
327  _val |= (unsigned int)Interfaces::InternalSideUserObject * (dynamic_cast<const InternalSideUserObject *>(obj) != nullptr);
328  _val |= (unsigned int)Interfaces::InterfaceUserObject * (dynamic_cast<const InterfaceUserObject *>(obj) != nullptr);
329  _val |= (unsigned int)Interfaces::NodalUserObject * (dynamic_cast<const NodalUserObject *>(obj) != nullptr);
330  _val |= (unsigned int)Interfaces::GeneralUserObject * (dynamic_cast<const GeneralUserObject *>(obj) != nullptr);
331  _val |= (unsigned int)Interfaces::ThreadedGeneralUserObject * (dynamic_cast<const ThreadedGeneralUserObject *>(obj) != nullptr);
332  _val |= (unsigned int)Interfaces::ShapeElementUserObject * (dynamic_cast<const ShapeElementUserObject *>(obj) != nullptr);
333  _val |= (unsigned int)Interfaces::ShapeSideUserObject * (dynamic_cast<const ShapeSideUserObject *>(obj) != nullptr);
334  _val |= (unsigned int)Interfaces::Postprocessor * (dynamic_cast<const Postprocessor *>(obj) != nullptr);
335  _val |= (unsigned int)Interfaces::VectorPostprocessor * (dynamic_cast<const VectorPostprocessor *>(obj) != nullptr);
336  // clang-format on
337 }

◆ isEqual()

bool AttribInterfaces::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 347 of file Attributes.C.

348 {
349  auto a = dynamic_cast<const AttribInterfaces *>(&other);
350  return a && (a->_val == _val);
351 }

◆ isMatch()

bool AttribInterfaces::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 340 of file Attributes.C.

341 {
342  auto a = dynamic_cast<const AttribInterfaces *>(&other);
343  return a && (a->_val & _val);
344 }

◆ 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

◆ _val

uint64_t AttribInterfaces::_val = 0
private

Definition at line 241 of file Attributes.h.

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


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