Program Listing for File embodied_entity.hpp

Return to documentation for file (cosm/repr/embodied_entity.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <memory>
#include <utility>

#include "cosm/cosm.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::repr {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
template <typename TEmbodimentType>
class embodied_entity {
 public:
  explicit embodied_entity(std::unique_ptr<TEmbodimentType> e)
      : m_embodiment(std::move(e)) {}

  embodied_entity(void) = default;
  virtual ~embodied_entity(void) = default;

  /* Not move/copy constructable/assignable by default */
  embodied_entity(const embodied_entity&) = delete;
  embodied_entity& operator=(const embodied_entity&) = delete;
  embodied_entity(embodied_entity&&) = delete;
  embodied_entity& operator=(embodied_entity&&) = delete;

  const TEmbodimentType* embodiment(void) const { return m_embodiment.get(); }
  void embodiment(std::unique_ptr<TEmbodimentType> e) {
    m_embodiment = std::move(e);
  }

 private:
  /* clang-format off */
  std::unique_ptr<TEmbodimentType> m_embodiment{};
  /* clang-format on */
};

} /* namespace cosm::repr */