// src/backend/static_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 STATIC_RESOURCE_HH
#define STATIC_RESOURCE_HH 1

#include <sgpemv2/sgpemv2-visibility.hh>

#include "glibmm/ustring.h"

namespace sgpem
{
  class SerializeVisitor;

  /// StaticResource is an object that act for a system resource.
  /// It has a name, and a number of places.
  /// 
  /// The attributes stored in a static entity are static in the sense that 
  /// they are user-set and no inner mechanism of the Backend component may 
  /// change these attributes without the user having explicitly asked it.
  /// 
  /// This is enforced by not providing any setter method, and by making the 
  /// copy constructor private. This makes clear that if you want to edit a 
  /// static entity, you should reset the ::History, remove the old static 
  /// entity, and create a new dynamic entity for the new static one.
  class SG_DLLLOCAL StaticResource
  {
  public:
    /// \brief Constructor taking a defined name and a number of places.
    ///
    /// \param name the name of the resource
    /// \param places the number of places of the resource
    StaticResource(const Glib::ustring& name, unsigned int places = 1);

    /// \brief Returns the name of the Resource.
    ///
    /// Returns the name of the Resource.
    /// \return the name of the Resource.
    Glib::ustring get_name() const;

    /// \brief Modifies the name of the Resource.
    ///
    /// Modifies the name of the Resource.
    /// \param name the new name for the Resource.
    /// \return the old name of the Resource.
    Glib::ustring set_name(Glib::ustring name);

    /// \brief Returns the number of places of the Resource.
    ///
    /// Returns the number of places of the Resource.
    /// \return the number of places of the Resource.
    unsigned int get_places() const;

    /// \brief Modifies the number of places of the Resource.
    ///
    /// Modifies the number of places of the Resource.
    /// \param name the new number of places for the Resource.
    /// \return the old number of places of the Resource.
    unsigned int set_places(unsigned int places);

  private:
    /// \brief Private standard copy constructor.
    StaticResource(const StaticResource&);

    Glib::ustring _name;
    unsigned int _places;
  };

}

#endif

