/// 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 X3DTK_X3DONEPASSPROCESSOR_H
#define X3DTK_X3DONEPASSPROCESSOR_H

#include "X3DProcessor.h"
#include "GraphTraversal.h"

namespace X3DTK {

/*! \brief Abstract class declared in <b><X3DTK/kernel.h></b> defining the concept of one pass processor.
 *
 *  A one pass processor is made up of a single walker and visitor. Only one traversal
 *  of the scene graph is made. For more details about how to define a processor, see 
 *  the <a href="Processor.html">processor</a> page.
 * 
 *  \ingroup processor
 */

class X3DOnePassProcessor : public X3DProcessor
{
public:
  /// Constructor.
  X3DOnePassProcessor();
  /// Destructor. Deletes the graph traversal.
  virtual ~X3DOnePassProcessor() = 0;
  
  /// Sets the Walker.
  virtual void setWalker(Walker *walker);
  /// Sets a component visitor. If there is already a visitor recorded for this 
  /// component, then it is deleted and replaced by the new one.
  virtual void setComponentVisitor(X3DComponentVisitor *component);

  /// Sets the GraphTraversal. Notice that it will be deleted in the destructor.
  /// For a Depth First Search traversal, use X3DTK::DFSGraphTraversal.
  void setGraphTraversal(GraphTraversal *graphTraversal);
  /// Gets the GraphTraversal.
  inline GraphTraversal *getGraphTraversal() const {return _graphTraversal;};  
  /// Traverses the scene graph.
  void traverse(X3DAbstractNode *N) const;

private:
  GraphTraversal *_graphTraversal;  
};

}

#endif
