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

#include <Attributes.h>

Inheritance diagram for AttribThread:
[legend]

Public Types

typedef THREAD_ID Key
 

Public Member Functions

void setFrom (Key k)
 
 AttribThread (TheWarehouse &w)
 
 AttribThread (TheWarehouse &w, THREAD_ID t)
 
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 (AttribThread)
 
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...
 

Private Attributes

THREAD_ID _val = 0
 

Detailed Description

Definition at line 233 of file Attributes.h.

Member Typedef Documentation

◆ Key

Definition at line 236 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttribThread() [1/2]

AttribThread::AttribThread ( TheWarehouse w)
inline

Definition at line 239 of file Attributes.h.

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

◆ AttribThread() [2/2]

AttribThread::AttribThread ( TheWarehouse w,
THREAD_ID  t 
)
inline

Definition at line 240 of file Attributes.h.

240 : Attribute(w, "thread"), _val(t) {}
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
THREAD_ID _val
Definition: Attributes.h:248

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

AttribThread::clonefunc ( AttribThread  )

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

AttribThread::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 67 of file TheWarehouse.h.

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

67 { return _id; }

◆ initFrom()

void AttribThread::initFrom ( const MooseObject obj)
overridevirtual

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

Implements Attribute.

Definition at line 267 of file Attributes.C.

268 {
269  _val = obj->getParam<THREAD_ID>("_tid");
270 }
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
unsigned int THREAD_ID
Definition: MooseTypes.h:198
THREAD_ID _val
Definition: Attributes.h:248

◆ isEqual()

bool AttribThread::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 278 of file Attributes.C.

279 {
280  return isMatch(other);
281 }
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...
Definition: Attributes.C:272

◆ isMatch()

bool AttribThread::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 272 of file Attributes.C.

Referenced by isEqual().

273 {
274  auto a = dynamic_cast<const AttribThread *>(&other);
275  return a && (a->_val == _val);
276 }
THREAD_ID _val
Definition: Attributes.h:248

◆ operator!=()

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

Definition at line 62 of file TheWarehouse.h.

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

◆ operator==()

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

Definition at line 58 of file TheWarehouse.h.

59  {
60  return _id == other._id && isEqual(other);
61  }
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 AttribThread::setFrom ( Key  k)
inline

Definition at line 237 of file Attributes.h.

237 { _val = k; }
THREAD_ID _val
Definition: Attributes.h:248

Member Data Documentation

◆ _val

THREAD_ID AttribThread::_val = 0
private

Definition at line 248 of file Attributes.h.

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


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