//===-- core/MessageingSystemImpl.cpp ---------------------------*- C++ -*-===//
//
//                                 The RoSA Framework
//
//===----------------------------------------------------------------------===//
///
/// \file core/MessagingSystemImpl.cpp
///
/// \author David Juhasz (david.juhasz@tuwien.ac.at)
///
/// \date 2017
///
/// \brief Implementation of core/MessagingSystemImpl.hpp.
///
//===----------------------------------------------------------------------===//

#include "MessagingSystemImpl.hpp"

#include "rosa/core/Agent.hpp"

namespace rosa {

MessagingSystemImpl::MessagingSystemImpl(const std::string &Name) noexcept
    : MessagingSystem(),
      SystemImpl(Name) {
  LOG_TRACE("System '" + Name + "' is a MessagingSystem");
}

void MessagingSystemImpl::send(const AgentHandle &H, message_t &&M) noexcept {
  ASSERT(*this == unwrapSystem(H) && isUnitRegistered(unwrapAgent(H)));
  unwrapAgent(H)(*M);
}

} // End namespace rosa
