/// This file is part of the X3DToolKit library
/// Copyright (C) 2002-2004  Yannick Le Goc (legoc@imag.fr)

/// http://artis.imag.fr/Members/Yannick.Legoc/X3D/

/// This library is free software; you can redistribute it and/or
/// modify it under the terms of the GNU Lesser General Public
/// License as published by the Free Software Foundation; either
/// version 2.1 of the License, or (at your option) any later version.

/// This library 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
/// Lesser General Public License for more details.

/// You should have received a copy of the GNU Lesser General Public
/// License along with this library; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#ifndef MESH_INFO_H
#define MESH_INFO_H

#include <X3DTK/kernel.h>
#include <X3DTK/MESH/scenegraph.h>
#include <list>

namespace X3DTK {
namespace MESH {

template<class MData, class VData, class EData, class FData, bool RW>
class TemplateMeshInfo
{
public:
  /// Constructor.
  TemplateMeshInfo();
  /// Destructor.
  ~TemplateMeshInfo();

  /// Initializes the attributes.
  void init();

  /// Adds the number of faces.
  void addFaces(unsigned int faces);
  /// Adds the number of edges.
  void addEdges(unsigned int edges);
  /// Sets the number of instances.
  void setInstances(unsigned int instances);
  
  /// Gets the number of faces.
  unsigned int getFaces() const;
  /// Gets the number of edges.
  unsigned int getEdges() const;
  /// Gets the number of instances.
  unsigned int getInstances() const;
  
private:
  unsigned int _nFaces;
  unsigned int _nEdges;
  unsigned int _nInstances;
};

template<class MData, class VData, class EData, class FData, bool RW>
class TemplateVertexInfo
{
public:
  /// Constructor.
  TemplateVertexInfo();
  /// Destructor.
  ~TemplateVertexInfo();

  /// Initializes the attributes.
  void init();

  /// Adds the number of vertices.
  void addVertices(unsigned int vertices);
  /// Sets the number of instances.
  void setInstances(unsigned int instances);
  
  /// Gets the number of vertices.
  unsigned int getVertices() const;
  /// Gets the number of instances.
  unsigned int getInstances() const;
  
private:
  unsigned int _nVertices;
  unsigned int _nInstances;
};

/// ault Info.
typedef TemplateMeshInfo<MeshData, VertexData, EdgeData, FaceData, true> MeshInfo;
typedef std::list<std::pair<SFNode, TemplateMeshInfo<MeshData, VertexData, EdgeData, FaceData, true> > > MeshInfoList;

typedef TemplateVertexInfo<MeshData, VertexData, EdgeData, FaceData, true> VertexInfo;
typedef std::list<std::pair<SFNode, TemplateVertexInfo<MeshData, VertexData, EdgeData, FaceData, true> > > VertexInfoList;

}
}

#include "MESH_Info.inl"

#endif
