Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
MessageSourceInfo.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MessageSourceInfo.h (C) 2000-2025 */
9/* */
10/* Information about the source of a message. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_MESSAGEPASSING_MESSAGESOURCEINFO_H
13#define ARCCORE_MESSAGEPASSING_MESSAGESOURCEINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/message_passing/MessageTag.h"
18#include "arccore/message_passing/MessageRank.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29/*!
30 * \brief Information about the source of a message.
31 *
32 * This information is used to retrieve message information following a call
33 * to mpProbe() or mpLegacyProbe().
34 * The returned instance can be used to perform a reception via mpReceive().
35 */
36class ARCCORE_MESSAGEPASSING_EXPORT MessageSourceInfo
37{
38 public:
39
40 //! Creates a source corresponding to no message (isValid()==false)
41 MessageSourceInfo() = default;
42
43 /*!
44 * \brief Creates a source corresponding to rank \a rank and tag \a tag.
45 *
46 * If \a rank.isNull() or tag.isNull(), then isValid() will be \a false.
47 */
49 : m_rank(rank)
50 , m_tag(tag)
51 , m_size(size)
52 {}
53
54 public:
55
56 //! Source rank
57 MessageRank rank() const { return m_rank; }
58
59 //! Sets the source rank
60 void setRank(MessageRank rank) { m_rank = rank; }
61
62 //! Message tag
63 MessageTag tag() const { return m_tag; }
64
65 //! Sets the message tag
66 void setTag(MessageTag tag) { m_tag = tag; }
67
68 //! Message size
69 Int64 size() const { return m_size; }
70
71 //! Sets the message size
72 void setSize(Int64 size) { m_size = size; }
73
74 //! Indicates if the source is valid
75 bool isValid() const { return !m_rank.isNull() && !m_tag.isNull(); }
76
77 private:
78
79 MessageRank m_rank;
80 MessageTag m_tag;
81 Int64 m_size = 0;
82};
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87} // namespace Arcane::MessagePassing
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
91
92#endif
MessageSourceInfo()=default
Creates a source corresponding to no message (isValid()==false).
void setTag(MessageTag tag)
Sets the message tag.
MessageSourceInfo(MessageRank rank, MessageTag tag, Int64 size)
Creates a source corresponding to rank rank and tag tag.
void setSize(Int64 size)
Sets the message size.
MessageRank rank() const
Source rank.
bool isValid() const
Indicates if the source is valid.
void setRank(MessageRank rank)
Sets the source rank.
Declarations of types and methods used by message exchange mechanisms.
std::int64_t Int64
Signed integer type of 64 bits.