// src/backend/resource.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 3 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, see http://www.gnu.org/licenses/.


#ifndef RESOURCE_HH
#define RESOURCE_HH 1

#include <sgpemv2/sgpemv2-visibility.hh>
#include "glibmm/ustring.h"

namespace sgpem
{
  class Resource;
  class SerializeVisitor;

  /** \brief An abstract class representing a resource 
   *
   * A resource in a real operating system could be a printer,
   * a socket, a chunk of memory, or a simple file.
   */
  class SG_DLLEXPORT Resource
  {
  public:
    virtual ~Resource();

    /** \brief See if two different states point to the same resource */
    virtual bool operator==(const Resource& op2) const = 0;

    /** \brief Returns the resource name */
    virtual Glib::ustring get_name() const = 0;

    /** \brief Return the number of places this resource has available
     * before becoming unavailable
     *
     * E.g. if a resource has two places, it can fulfill only two
     * ::SubRequests at each instant 
     */
    virtual unsigned int get_places() const = 0;

    /** \brief Used to serialize the informations of this entity */
    virtual void serialize(SerializeVisitor& translator) const = 0;
  };

}

#endif

