/*
 * Project: MoleCuilder
 * Description: creates and alters molecular systems
 * Copyright (C)  2014 Frederik Heber. All rights reserved.
 * 
 *
 *   This file is part of MoleCuilder.
 *
 *    MoleCuilder is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    MoleCuilder is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with MoleCuilder.  If not, see .
 */
/*
 * FragmentResult.cpp
 *
 * Originally taken from my JobMarket project at 1.1.4.
 *
 *  Created on: Oct 19, 2011
 *      Author: heber
 */
// include config.h
#ifdef HAVE_CONFIG_H
#include 
#endif
#include "CodePatterns/MemDebug.hpp"
#ifdef HAVE_JOBMARKET
#include "JobMarket/Results/FragmentResult.hpp"
#else
#include "Jobs/JobMarket/FragmentResult.hpp"
#endif
/** Private default Constructor of class FragmentResult.
 *
 * This cstor is for serialization of this class inside a vector
 * only. Without it, we would not need it.
 */
FragmentResult::FragmentResult() :
  JobId(JobId::NoJob),
  result(std::string("NoJob")),
  exitflag(0),
  time_Work(0.)
{}
/** Constructor of class FragmentResult.
 *
 * \param _id id of FragmntJob associated to this FragmentResult.
 */
FragmentResult::FragmentResult(const JobId_t _id) :
  JobId(_id),
  result(std::string("Nothing")),
  exitflag(0),
  time_Work(0.)
{}
/** Constructor of class FragmentResult.
 */
FragmentResult::FragmentResult(const JobId_t _id, const std::string &_result) :
  JobId(_id),
  result(_result),
  exitflag(0),
  time_Work(0.)
{}
/** Copy constructor of class FragmentResult.
 *
 */
FragmentResult::FragmentResult(const FragmentResult &other) :
  JobId(other.getId()),
  result(other.result),
  exitflag(other.exitflag),
  time_Work(other.time_Work)
{}
/** Destructor of class FragmentResult.
 *
 */
FragmentResult::~FragmentResult()
{}
/** Equality operator: Equal if both JobIds are the same
 *
 * \param other instance to check against
 * \return true - both JobIds are the same, false - JobIds are not the same.
 */
bool FragmentResult::operator==(const FragmentResult &other) const
{
  return getId() == other.getId();
}
/** Assigment operator.
 *
 * \note We can't use default assigment because of const member FragmentResult::JobId.
 *
 * \param other instance to make equal to
 */
FragmentResult& FragmentResult::operator=(const FragmentResult &other)
{
  /// check self-assignment
  if (this != &other) {
    setId(other.getId());
    result = other.result;
    exitflag = other.exitflag;
    time_Work = other.time_Work;
  }
  return *this;
}