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

#include "rosa/deluxe/DeluxeSystem.hpp"

#include "DeluxeSystemImpl.hpp"

namespace rosa {
namespace deluxe {

std::unique_ptr<DeluxeSystem>
DeluxeSystem::createSystem(const std::string &Name) noexcept {
  return std::unique_ptr<DeluxeSystem>(new DeluxeSystemImpl(Name));
}

Optional<const DeluxeSensor &>
DeluxeSystem::getDeluxeSensor(const AgentHandle &H) const noexcept {
  if (isDeluxeSensor(H)) {
    return {static_cast<const DeluxeSensor &>(unwrapAgent(H))};
  } else {
    return {};
  }
}

Optional<DeluxeSensor &> DeluxeSystem::getDeluxeSensor(AgentHandle &H) const
    noexcept {
  if (isDeluxeSensor(H)) {
    return {static_cast<DeluxeSensor &>(unwrapAgent(H))};
  } else {
    return {};
  }
}

Optional<const DeluxeAgent &>
DeluxeSystem::getDeluxeAgent(const AgentHandle &H) const noexcept {
  if (isDeluxeAgent(H)) {
    return {static_cast<const DeluxeAgent &>(unwrapAgent(H))};
  } else {
    return {};
  }
}

Optional<DeluxeAgent &> DeluxeSystem::getDeluxeAgent(AgentHandle &H) const
    noexcept {
  if (isDeluxeAgent(H)) {
    return {static_cast<DeluxeAgent &>(unwrapAgent(H))};
  } else {
    return {};
  }
}

} // End namespace deluxe
} // End namespace rosa
