TIMPI
Loading...
Searching...
No Matches
message_tag.C
Go to the documentation of this file.
1// The TIMPI Message-Passing Parallelism Library.
2// Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18// Local includes
19#include "timpi/message_tag.h"
20
21// TIMPI includes
22#include "timpi/communicator.h"
23
24
25
26namespace TIMPI
27{
28
29// ------------------------------------------------------------
30// MessageTag member functions
31
37
38
40 : _tagvalue(other._tagvalue), _comm(other._comm)
41{
42 if (_comm)
44}
45
46
48 : _tagvalue(other._tagvalue), _comm(other._comm)
49{
50 // I stole your tag reference!
51 other._comm = nullptr;
52}
53
54
56{
57 if (_comm)
59
60 _tagvalue = other._tagvalue;
61 _comm = other._comm;
62
63 if (_comm)
65
66 return *this;
67}
68
69
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}
83
84
85} // namespace TIMPI
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...
void dereference_unique_tag(int tagvalue) const
Dereference an already-acquired tag, and see if we can re-release it.
Encapsulates the MPI tag integers.
Definition message_tag.h:47
const Communicator * _comm
Definition message_tag.h:98
MessageTag(int tagvalue=invalid_tag)
Explicit constructor, to discourage using "magic numbers" as tags.
Definition message_tag.h:59
~MessageTag()
Destructor.
Definition message_tag.C:32
MessageTag & operator=(const MessageTag &other)
Copy assignment operator.
Definition message_tag.C:55
Tnew cast_int(Told oldvar)