14#include "arccore/message_passing/PointToPointSerializerMng.h"
16#include "arccore/message_passing/BasicSerializeMessage.h"
18#include "arccore/message_passing/ISerializeMessageList.h"
19#include "arccore/base/NotImplementedException.h"
20#include "arccore/base/FatalErrorException.h"
37 : m_message_passing_mng(mpm)
47 message->setStrategy(m_strategy);
48 m_pending_messages.add(message);
52 for (
auto& x : m_pending_messages) {
53 m_message_list->addMessage(x.get());
54 m_waiting_messages.add(x);
56 m_pending_messages.clear();
61 Integer n = m_message_list->waitMessages(wt);
63 for (
auto& x : m_waiting_messages) {
68 new_waiting_messages.
add(x);
70 m_waiting_messages.
clear();
71 m_waiting_messages.copy(new_waiting_messages);
74 bool hasMessages()
const {
return !m_pending_messages.empty() || !m_waiting_messages.empty(); }
93PointToPointSerializerMng::
102PointToPointSerializerMng::
103~PointToPointSerializerMng()
114 return m_p->m_message_passing_mng;
123 m_p->processPendingMessages();
132 return m_p->waitMessages(wt, functor);
141 return m_p->hasMessages();
151 ARCCORE_FATAL(
"Can not call setDefaultTag() if hasMessages()==true");
152 m_p->m_tag = default_tag;
162 ARCCORE_FATAL(
"Can not call setStrategy() if hasMessages()==true");
163 m_p->m_strategy = strategy;
172 auto x = BasicSerializeMessage::create(m_p->m_rank, receiver_rank, m_p->m_tag, MsgSend);
183 auto x = BasicSerializeMessage::create(m_p->m_rank, sender_rank, m_p->m_tag, MsgReceive);
194 auto x = BasicSerializeMessage::create(m_p->m_rank, message_id);
#define ARCCORE_FATAL(...)
Macro throwing a FatalErrorException.
Brief list of message exchange functions.
void clear()
Removes the elements from the array.
void add(ConstReferenceType val)
Adds element val to the end of the array.
Interface of the message passing manager.
virtual Int32 commRank() const =0
Rank of this instance in the communicator.
Interface for a serialization message between IMessagePassingMng.
eStrategy
Sending/receiving strategy.
@ Default
Default strategy.
IMessagePassingMng * messagePassingMng() const
Associated message manager.
bool hasMessages() const
Indicates if there are remaining messages that have not yet finished.
void setStrategy(ISerializeMessage::eStrategy strategy)
Strategy used for messages.
Integer waitMessages(eWaitType wt, std::function< void(ISerializeMessage *)> functor)
Waits for the messages to finish execution.
Ref< ISerializeMessage > addSendMessage(MessageRank receiver_rank)
Creates a sending serialization message.
void setDefaultTag(MessageTag default_tag)
Default tag used for messages.
Ref< ISerializeMessage > addReceiveMessage(MessageRank sender_rank)
Creates a receiving serialization message.
void processPendingMessages()
Sends the messages from the list that have not yet been processed.
Serializing message using a BasicSerializer.
static MessageTag defaultTag()
Default tag for serialization messages.
Reference to an instance.
1D data vector with value semantics (STL style).
Declarations of types and methods used by message exchange mechanisms.
Ref< ISerializeMessageList > mpCreateSerializeMessageListRef(IMessagePassingMng *pm)
Creates a serialization message list.
Int32 Integer
Type representing an integer.