TIMPI
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
TIMPI::MessageTag Class Reference

Encapsulates the MPI tag integers. More...

#include <message_tag.h>

Public Member Functions

 MessageTag (int tagvalue=invalid_tag)
 Explicit constructor, to discourage using "magic numbers" as tags. More...
 
 MessageTag (const MessageTag &other)
 Copy constructor. More...
 
 MessageTag (MessageTag &&other)
 Move constructor. More...
 
MessageTagoperator= (const MessageTag &other)
 Copy assignment operator. More...
 
MessageTagoperator= (MessageTag &&other)
 Move assignment operator. More...
 
 ~MessageTag ()
 Destructor. More...
 
int value () const
 

Static Public Attributes

static const int invalid_tag = INT_MIN
 Invalid tag, to allow for default construction. More...
 

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 46 of file message_tag.h.

Constructor & Destructor Documentation

◆ MessageTag() [1/4]

TIMPI::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 59 of file message_tag.h.

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

◆ MessageTag() [2/4]

TIMPI::MessageTag::MessageTag ( const MessageTag other)

Copy constructor.

Helps Communicator do reference counting on unique tags

Definition at line 39 of file message_tag.C.

References _comm, _tagvalue, and TIMPI::Communicator::reference_unique_tag().

40  : _tagvalue(other._tagvalue), _comm(other._comm)
41 {
42  if (_comm)
44 }
void reference_unique_tag(int tagvalue) const
Reference an already-acquired tag, so that we know it will be dereferenced multiple times before we c...
Definition: communicator.C:37
const Communicator * _comm
Definition: message_tag.h:98

◆ MessageTag() [3/4]

TIMPI::MessageTag::MessageTag ( MessageTag &&  other)

Move constructor.

Helps Communicator do reference counting on unique tags

Definition at line 47 of file message_tag.C.

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

◆ ~MessageTag()

TIMPI::MessageTag::~MessageTag ( )

Destructor.

Helps Communicator do reference counting on unique tags

Definition at line 32 of file message_tag.C.

References _comm, _tagvalue, and TIMPI::Communicator::dereference_unique_tag().

33 {
34  if (_comm)
36 }
void dereference_unique_tag(int tagvalue) const
Dereference an already-acquired tag, and see if we can re-release it.
Definition: communicator.C:46
const Communicator * _comm
Definition: message_tag.h:98

◆ MessageTag() [4/4]

TIMPI::MessageTag::MessageTag ( int  tagvalue,
const Communicator comm 
)
inlineprivate

Definition at line 101 of file message_tag.h.

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

Member Function Documentation

◆ operator=() [1/2]

MessageTag & TIMPI::MessageTag::operator= ( const MessageTag other)

Copy assignment operator.

Helps Communicator do reference counting on unique tags

Definition at line 55 of file message_tag.C.

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

56 {
57  if (_comm)
59 
60  _tagvalue = other._tagvalue;
61  _comm = other._comm;
62 
63  if (_comm)
65 
66  return *this;
67 }
void dereference_unique_tag(int tagvalue) const
Dereference an already-acquired tag, and see if we can re-release it.
Definition: communicator.C:46
void reference_unique_tag(int tagvalue) const
Reference an already-acquired tag, so that we know it will be dereferenced multiple times before we c...
Definition: communicator.C:37
const Communicator * _comm
Definition: message_tag.h:98

◆ operator=() [2/2]

MessageTag & TIMPI::MessageTag::operator= ( MessageTag &&  other)

Move assignment operator.

Helps Communicator do reference counting on unique tags

Definition at line 70 of file message_tag.C.

References _comm, _tagvalue, and TIMPI::Communicator::dereference_unique_tag().

71 {
72  if (_comm)
74 
75  _tagvalue = other._tagvalue;
76  _comm = other._comm;
77 
78  // I stole your tag reference!
79  other._comm = nullptr;
80 
81  return *this;
82 }
void dereference_unique_tag(int tagvalue) const
Dereference an already-acquired tag, and see if we can re-release it.
Definition: communicator.C:46
const Communicator * _comm
Definition: message_tag.h:98

◆ value()

int TIMPI::MessageTag::value ( ) const
inline

Friends And Related Function Documentation

◆ Communicator

friend class Communicator
friend

Definition at line 105 of file message_tag.h.

Member Data Documentation

◆ _comm

const Communicator* TIMPI::MessageTag::_comm
private

Definition at line 98 of file message_tag.h.

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

◆ _tagvalue

int TIMPI::MessageTag::_tagvalue
private

Definition at line 97 of file message_tag.h.

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

◆ invalid_tag

const int TIMPI::MessageTag::invalid_tag = INT_MIN
static

Invalid tag, to allow for default construction.

Definition at line 53 of file message_tag.h.

Referenced by TIMPI::Communicator::get_unique_tag().


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