/// 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_VISITINGFUNCTIONS_H
#define X3DTK_VISITINGFUNCTIONS_H

#include "EnterFunction.h"
#include "WalkOnFunction.h"
#include "LeaveFunction.h"

namespace X3DTK {

/*! \brief Class declared in <b><X3DTK/kernel.h></b> defining the concept of visiting functions.
 *
 *  \ingroup processor
 */

class VisitingFunctions
{
public:
  /// Constructor.
  VisitingFunctions(const EnterFunction *enter, const WalkOnFunction *walkon, const LeaveFunction *leave);
  /// Destructor.
  ~VisitingFunctions();
  
  /// Sets the enter function.
  void setEnterFunction(const EnterFunction *enter);
  /// Sets the walkOn function.
  void setWalkOnFunction(const WalkOnFunction *walkon);
  /// Sets the leave function.
  void setLeaveFunction(const LeaveFunction *leave);

  /// Enter the node.
  inline void enter(SFNode N) const {enter_->enter(N);};
  /// continue the node.
  inline bool walkOn(SFNode N, SFNode child = 0) const {return walkon_->walkOn(N, child);};  
  /// leave the node.
  inline void leave(SFNode N) const  {leave_->leave(N);};

private:
  EnterFunction *enter_;
  WalkOnFunction *walkon_;
  LeaveFunction *leave_;
};

}

#endif
