libMesh::Parallel::MessageTag Class Reference

#include <message_tag.h>

Public Member Functions

 MessageTag (int tagvalue=invalid_tag)
 
 MessageTag (const MessageTag &other)
 
 MessageTag (MessageTag &&other)
 
MessageTagoperator= (const MessageTag &other)
 
MessageTagoperator= (MessageTag &&other)
 
 ~MessageTag ()
 
int value () const
 

Static Public Attributes

static const int invalid_tag = INT_MIN
 

Private Member Functions

 MessageTag (int tagvalue, const Communicator *comm)
 

Private Attributes

int _tagvalue
 
const Communicator_comm
 

Friends

class Communicator
 

Detailed Description

Encapsulates the MPI tag integers.

Definition at line 47 of file message_tag.h.

Constructor & Destructor Documentation

◆ MessageTag() [1/4]

libMesh::Parallel::MessageTag::MessageTag ( int  tagvalue = invalid_tag)
inlineexplicit

Explicit constructor, to discourage using "magic numbers" as tags. Communicator::get_unique_tag is recommended instead.

Definition at line 60 of file message_tag.h.

61  : _tagvalue(tagvalue), _comm(nullptr) {}
const Communicator * _comm
Definition: message_tag.h:99

◆ MessageTag() [2/4]

libMesh::Parallel::MessageTag::MessageTag ( const MessageTag other)

Copy constructor. Helps Communicator do reference counting on unique tags

Definition at line 41 of file message_tag.C.

References _comm, _tagvalue, and libMesh::Parallel::Communicator::reference_unique_tag().

42  : _tagvalue(other._tagvalue), _comm(other._comm)
43 {
44  if (_comm)
46 }
void reference_unique_tag(int tagvalue) const
Definition: communicator.C:35
const Communicator * _comm
Definition: message_tag.h:99

◆ MessageTag() [3/4]

libMesh::Parallel::MessageTag::MessageTag ( MessageTag &&  other)

Move constructor. Helps Communicator do reference counting on unique tags

Definition at line 49 of file message_tag.C.

50  : _tagvalue(other._tagvalue), _comm(other._comm)
51 {
52  // I stole your tag reference!
53  other._comm = nullptr;
54 }
const Communicator * _comm
Definition: message_tag.h:99

◆ ~MessageTag()

libMesh::Parallel::MessageTag::~MessageTag ( )

Destructor. Helps Communicator do reference counting on unique tags

Definition at line 34 of file message_tag.C.

References _comm, _tagvalue, and libMesh::Parallel::Communicator::dereference_unique_tag().

35 {
36  if (_comm)
38 }
void dereference_unique_tag(int tagvalue) const
Definition: communicator.C:44
const Communicator * _comm
Definition: message_tag.h:99

◆ MessageTag() [4/4]

libMesh::Parallel::MessageTag::MessageTag ( int  tagvalue,
const Communicator comm 
)
inlineprivate

Definition at line 102 of file message_tag.h.

103  : _tagvalue(tagvalue), _comm(comm) {}
const Communicator * _comm
Definition: message_tag.h:99

Member Function Documentation

◆ operator=() [1/2]

MessageTag & libMesh::Parallel::MessageTag::operator= ( const MessageTag other)

Copy assignment operator. Helps Communicator do reference counting on unique tags

Definition at line 57 of file message_tag.C.

References _comm, _tagvalue, libMesh::Parallel::Communicator::dereference_unique_tag(), and libMesh::Parallel::Communicator::reference_unique_tag().

58 {
59  if (_comm)
61 
62  _tagvalue = other._tagvalue;
63  _comm = other._comm;
64 
65  if (_comm)
67 
68  return *this;
69 }
void dereference_unique_tag(int tagvalue) const
Definition: communicator.C:44
void reference_unique_tag(int tagvalue) const
Definition: communicator.C:35
const Communicator * _comm
Definition: message_tag.h:99

◆ operator=() [2/2]

MessageTag & libMesh::Parallel::MessageTag::operator= ( MessageTag &&  other)

Move assignment operator. Helps Communicator do reference counting on unique tags

Definition at line 72 of file message_tag.C.

References _comm, _tagvalue, and libMesh::Parallel::Communicator::dereference_unique_tag().

73 {
74  if (_comm)
76 
77  _tagvalue = other._tagvalue;
78  _comm = other._comm;
79 
80  // I stole your tag reference!
81  other._comm = nullptr;
82 
83  return *this;
84 }
void dereference_unique_tag(int tagvalue) const
Definition: communicator.C:44
const Communicator * _comm
Definition: message_tag.h:99

◆ value()

Friends And Related Function Documentation

◆ Communicator

friend class Communicator
friend

Definition at line 106 of file message_tag.h.

Member Data Documentation

◆ _comm

const Communicator* libMesh::Parallel::MessageTag::_comm
private

Definition at line 99 of file message_tag.h.

Referenced by MessageTag(), operator=(), and ~MessageTag().

◆ _tagvalue

int libMesh::Parallel::MessageTag::_tagvalue
private

Definition at line 98 of file message_tag.h.

Referenced by MessageTag(), operator=(), value(), and ~MessageTag().

◆ invalid_tag

const int libMesh::Parallel::MessageTag::invalid_tag = INT_MIN
static

Invalid tag, to allow for default construction.

Definition at line 54 of file message_tag.h.


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