/*
 * This file is part of the Owl Positioning System (OwlPS) project.
 * It is subject to the copyright notice and license terms in the
 * COPYRIGHT.t2t file found in the top-level directory of this
 * distribution and at
 *   https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
 * No part of the OwlPS Project, including this file, may be copied,
 * modified, propagated, or distributed except according to the terms
 * contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
 * distributed along with this file, either separately or by replacing
 * this notice by the COPYRIGHT.t2t file's contents.
 */


#include "calibrationrequest.hh"



/* *** Constructors *** */


CalibrationRequest::CalibrationRequest(const uint_fast8_t _type):
  reference_point(nullptr), direction(Direction())
{
  type = _type ;
}


CalibrationRequest::
CalibrationRequest(const Request &source,
                   ReferencePoint *const _reference_point,
                   const Direction &_direction,
                   const uint_fast8_t _type):
  Request(source), reference_point(_reference_point),
  direction(_direction)
{
  type = _type ;
}



/* *** Write accessors *** */


void CalibrationRequest::reference_point_delete_requests() const
{
  reference_point->delete_requests() ;
}


void CalibrationRequest::reference_point_backward_link() const
{
  reference_point->add_request(this) ;
}


void CalibrationRequest::clear()
{
  Request::clear() ;
  reference_point = nullptr ;
  direction.clear() ;
}



/* *** Operators *** */


CalibrationRequest& CalibrationRequest::
operator=(const CalibrationRequest &source)
{
  if (this == &source)
    return *this ;

  this->Request::operator=(source) ;
  direction = source.direction ;
  reference_point = source.reference_point ;

  return *this ;
}


bool CalibrationRequest::
operator==(const CalibrationRequest &source) const
{
  if (this == &source)
    return true ;

  return
    this->Request::operator==(source) &&
    direction == source.direction &&
    reference_point == source.reference_point ;
}
