/*
* Author:          Patrick-Christopher Mattulat
 * Co-Author:       Claude Sonnet 4.6 (LLM)
* Company:         Lynar Studios
* E-Mail:          webmaster@lynarstudios.com
* Created:         2023-02-08
* Changed:         2026-06-23
*
* */

#include <ls-std/core/evaluator/NullPointerEvaluator.hpp>
#include <ls-std/core/exception/NullPointerException.hpp>

using ls::standard::core::NullPointerEvaluator;
using ls::standard::core::NullPointerException;
using std::make_shared;
using std::move;
using std::shared_ptr;
using std::string;

NullPointerEvaluator::NullPointerEvaluator(const shared_ptr<void> &_argument) : argument(_argument)
{}

NullPointerEvaluator::NullPointerEvaluator(const shared_ptr<void> &_argument, string _message) : argument(_argument), message(::move(_message))
{}

NullPointerEvaluator::~NullPointerEvaluator() noexcept = default;

void NullPointerEvaluator::evaluate()
{
  if (this->argument == nullptr)
  {
    if (this->message.empty())
    {
      throw NullPointerException{"reference in use is null!"};
    }
    else
    {
      throw NullPointerException{this->message};
    }
  }
}
