#pragma once
//===-- rosa/delux/CrossReliability_helper_file.h ----------------*- C++
//-*-===//
//
//                                 The RoSA Framework
//
//===----------------------------------------------------------------------===//
///
/// \file rosa/delux/CrossReliability_helper_file.h
///
/// \author Daniel Schnoell
///
/// \date 2019
///
/// \brief This file shouldn't exist when everything is finished. It is only a
/// temporary part to hava all needed references and it also contains source
/// code for test compiling
//===----------------------------------------------------------------------===//

#ifdef __fake__LinearFunction
namespace rosa {
namespace agent {
template <typename A, typename B> class LinearFunction {
public:
  virtual A operator()(B val) = 0;
};
template <typename A, typename B>
class testFunction : public LinearFunction<A, B> {
public:
  virtual A operator()(B val) { return val; }
};
} // namespace agent
} // namespace rosa
#endif

template <typename Type> class ReliableAgent {
  //------------------------------------------------------------------------------
  // Reliability or Confidence
public:
  // at=0 should be the most reliable score
  Type getReliability(std::size_t at) { return PossibleScores.at(at)->second; }
  void setReliability(std::size_t at, Type Reliability) {
    this->Reliability = PossibleScores.at(at)->second;
  }

  Type getScore(std::size_t at) { return PossibleScores.at(at)->first; }
  void setScore(std::size_t at, Type Score) {
    this->Reliability = PossibleScores.at(at)->first;
  }

  void createPossibleScore(Type Score, Type Reliability) {
    PossibleScores.push_back(new std::pair<Type, Type>(Score, Reliability));
  }
  std::size_t getNumberOfPossibleScores() { return PossibleScores.size(); }
  void setName(std::string nam) { Name = nam; }
  std::string getName() { return Name; }

protected:
  Type crossReliabilityParameter = 1;

private:
  std::string Name;
  std::vector<std::pair<Type, Type> *>
      PossibleScores; // first: Score second: Reliability or Confidence
  //--------------------------------------------------------------------------------
  // ReliableAgent
public:
  std::vector<ReliableAgent *> Slaves;
  ReliableAgent *Master;

private:
};

/*
//test file include correct path

#define __fake__LinearFunction
#include "CrossReliability.h"
#include <iostream>

class tester :public ReliableAgent<double>, public
CrossReliabilityModule<double>
{
public:
        // pure testmethod
        void makeReliability(
                double Method(std::vector<double> values)) {
                std::cout << "score"
                        << "\tCR\t";
                for (std::size_t tmp = 0; tmp < 10; tmp++)
                        std::cout << "\t" << ((double)tmp) / 10;
                std::cout << "\n";
                for ( auto mainagent : Slaves) {
                        std::cout << mainagent->getScore(0) << "\t" // carefull
not fale save
                                << CrossReliability(mainagent, Slaves, Method)
<< "\t"; for (std::size_t tmp = 0; tmp < 10; tmp++) std::cout << "\t"
                                << CrossConfidence(mainagent, Slaves, Method,
((double)tmp) / 10); std::cout << "\n";
                }
        }


};

int main(void)
{
        std::vector<tester* > Slaves;
        std::size_t size = 20;
        for (std::size_t a = 0; a < size; a++)
        {
                auto tmp = new tester();
                tmp->createPossibleScore(((double)a) / size,
                        ((double)a) / size);
                tmp->setName(std::to_string(a));
                Slaves.push_back(tmp);
        }

        tester Master;
        Master.Slaves.insert(Master.Slaves.begin(), Slaves.begin(),
                Slaves.end());

        for (std::size_t a = 0; a < size; a++)
        {
                for (std::size_t b = 0; b < size; b++)
                {
                        Master.addCrossReliabilityProfile(std::to_string(a),
std::to_string(b),new rosa::agent::testFunction<double,double>());
                }
        }

        Master.makeReliability(tester::AVERAGE);





        //cleanup
        for (auto tmp : Slaves)
                delete tmp;
        Slaves.clear();
        Master.Slaves.clear();

        Master.~Master();

        long q;
        std::cin >> q;

        return 0;
}

*/