14template <
typename Channel>
20 typedef typename Channel::Buffer
Buffer;
21 typedef typename Channel::Address
Address;
22 typedef typename Channel::Port
Port;
51 void update(
typename Channel::Observed*
obs,
typename Channel::Observer::Observing_Condition
c,
Buffer*
buf);
59template <
typename Channel>
62 throw std::invalid_argument(
"Channel cannot be null");
65 _channel->attach(
this,
address);
66 _running.store(
true, std::memory_order_release);
69template <
typename Channel>
71 db<Communicator>(
TRC) <<
"Communicator<Channel>::~Communicator() called for address: " << _address.to_string() <<
"\n";
73 _channel->detach(
this, _address);
74 db<Communicator>(
INF) <<
"[Communicator] Channel detached from address: " << _address.to_string() <<
"\n";
77template <
typename Channel>
81 if (!_running.load(std::memory_order_acquire)) {
92template <
typename Channel>
96 if (!_running.load(std::memory_order_acquire)) {
107 std::uint8_t
temp_data[MAX_MESSAGE_SIZE];
122template <
typename Channel>
124 _running.store(
false, std::memory_order_release);
125 update(
nullptr, this->rank(),
nullptr);
128template <
typename Channel>
130 Observer::update(
c,
buf);
133template <
typename Channel>
Definition communicator.h:16
Communicator(const Communicator &)=delete
bool receive(Message_T *message)
Definition communicator.h:93
Channel::Buffer Buffer
Definition communicator.h:20
~Communicator()
Definition communicator.h:70
const Address & address() const
Definition communicator.h:134
bool send(const Message_T *message)
Definition communicator.h:78
static constexpr const unsigned int MAX_MESSAGE_SIZE
Definition communicator.h:24
Channel::Port Port
Definition communicator.h:22
Message< Channel > Message_T
Definition communicator.h:23
Communicator(Channel *channel, Address address)
Definition communicator.h:60
void release()
Definition communicator.h:123
Concurrent_Observer< typename Channel::Observer::Observed_Data, typename Channel::Observer::Observing_Condition > Observer
Definition communicator.h:19
std::atomic< bool > _running
Definition communicator.h:41
Communicator & operator=(const Communicator &)=delete
Channel::Address Address
Definition communicator.h:21
void update(C c, D *d) override
Definition observer.h:116
Template class for network messages with Clock integration.
Definition message.h:31
@ INF
Definition debug.h:208
Select_Debug<(Traits< T >::debugged &&Traits< Debug >::error)> db(Debug_Error l)
Definition debug.h:166
@ TRC
Definition debug.h:231
@ WRN
Definition debug.h:185