// src/backend/request.hh - Copyright 2005, 2006, University
//               of Padova, dept. of Pure and Applied
//               Mathematics
//
// This file is part of SGPEMv2.
//
// This 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.
//
// SGPEMv2 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 SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef REQUEST_HH
#define REQUEST_HH 1

#include "config.h"
#include <vector>

namespace sgpem
{
  class Request;
  class SerializeVisitor;
  class SubRequest;
  class Thread;

  class SG_DLLEXPORT Request
  {
  public:
    enum state
    {
      state_unallocable  =  1 << 0,
      state_allocated    =  1 << 1,
      state_future       =  1 << 2,
      state_exhausted    =  1 << 3,
      state_allocable    =  1 << 4
    };

    virtual ~Request();

    virtual Thread& get_thread() = 0;

    virtual bool operator==(const Request& op2) const = 0;

    virtual std::vector<SubRequest*> get_subrequests() = 0;
    virtual unsigned int get_instant() const = 0;

    virtual state get_state() const = 0;

    virtual void serialize(SerializeVisitor& translator) const = 0;
  };

}

#endif

