Page MenuHomePhorge

AgentHandle.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

AgentHandle.cpp

/***************************************************************************//**
*
* \file core/AgentHandle.cpp
*
* \author David Juhasz (david.juhasz@tuwien.ac.at)
*
* \date 2017
*
* \brief Implementation for rosa/core/AgentHandle.hpp.
*
******************************************************************************/
#include "rosa/core/AgentHandle.hpp"
#include "rosa/core/Agent.hpp"
namespace rosa {
AgentHandle::AgentHandle(Agent &A, bool) : A(A), S(A.system()) {}
AgentHandle::AgentHandle(Agent &A) : A(A), S(A.system()) {
ASSERT(S.isUnitRegistered(A));
}
AgentHandle::operator bool(void) const noexcept {
// \note The referred `rosa::MessageSystem` is supposed to be still alive.
return S.isUnitRegistered(A);
}
bool AgentHandle::operator==(const AgentHandle &H) const noexcept {
// Return if the referred `rosa::Agent` is the same object in both
// `rosa::AgentHandler` instances.
return &A == &H.A;
}
AgentHandle AgentHandle::self(void) noexcept {
// Return a copy of `this` object.
return *this;
}
void AgentHandle::sendMessage(message_t &&M) noexcept {
ASSERT(bool(*this));
S.send(*this, std::move(M));
}
} // End namespace rosa

File Metadata

Mime Type
text/x-c++
Expires
Sun, Apr 12, 11:47 AM (4 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
303001
Default Alt Text
AgentHandle.cpp (1 KB)

Event Timeline