X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c67fa2b51e1d608113457720eb9292cd75c0941c..33aec8491c4c337352f570c24f8a76298e3a319c:/src/mc/Checker.hpp diff --git a/src/mc/Checker.hpp b/src/mc/Checker.hpp new file mode 100644 index 0000000000..478665a8f9 --- /dev/null +++ b/src/mc/Checker.hpp @@ -0,0 +1,58 @@ +/* Copyright (c) 2016. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef SIMGRID_MC_CHECKER_HPP +#define SIMGRID_MC_CHECKER_HPP + +#include +#include + +#include "src/mc/mc_forward.hpp" + +namespace simgrid { +namespace mc { + +/** A model-checking algorithm + * + * The goal is to move the data/state/configuration of a model-checking + * algorihms in subclasses. Implementing this interface will probably + * not be really mandatory, you might be able to write your + * model-checking algorithm as plain imperative code instead. + * + * It works by manipulating a model-checking Session. + */ +// abstract +class Checker { + Session* session_; +public: + Checker(Session& session) : session_(&session) {} + + // No copy: + Checker(Checker const&) = delete; + Checker& operator=(Checker const&) = delete; + + virtual ~Checker(); + virtual int run() = 0; + +protected: + Session& getSession() { return *session_; } +}; + +/** Adapt a std::function to a checker */ +class FunctionalChecker : public Checker { + Session* session_; + std::function function_; +public: + FunctionalChecker(Session& session, std::function f) + : Checker(session), function_(std::move(f)) {} + ~FunctionalChecker(); + int run() override; +}; + +} +} + +#endif