TIMPI
Loading...
Searching...
No Matches
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.
 
 MessageTag (const MessageTag &other)
 Copy constructor.
 
 MessageTag (MessageTag &&other)
 Move constructor.
 
MessageTagoperator= (const MessageTag &other)
 Copy assignment operator.
 
MessageTagoperator= (MessageTag &&other)
 Move assignment operator.
 
 ~MessageTag ()
 Destructor.
 
int value () const
 

Static Public Attributes

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

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
Tnew cast_int(Told oldvar)

◆ 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.

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...

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

◆ 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}

References TIMPI::cast_int().

◆ ~MessageTag()

TIMPI::MessageTag::~MessageTag ( )

Destructor.

Helps Communicator do reference counting on unique tags

Definition at line 32 of file message_tag.C.

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.

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

◆ 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) {}

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.

56{
57 if (_comm)
59
60 _tagvalue = other._tagvalue;
61 _comm = other._comm;
62
63 if (_comm)
65
66 return *this;
67}

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

◆ 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.

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}

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

◆ value()

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

Friends And Related Symbol Documentation

◆ Communicator

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=(), operator=(), and ~MessageTag().

◆ _tagvalue

int TIMPI::MessageTag::_tagvalue
private

Definition at line 97 of file message_tag.h.

Referenced by MessageTag(), operator=(), 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: