main page
modules
namespaces
classes
files
Gecode home
Generated on Sat Feb 7 2015 02:01:18 for Gecode by
doxygen
1.8.9.1
gecode
gist
nodevisitor.hh
Go to the documentation of this file.
1
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
/*
3
* Main authors:
4
* Guido Tack <tack@gecode.org>
5
*
6
* Copyright:
7
* Guido Tack, 2006
8
*
9
* Last modified:
10
* $Date: 2010-07-30 10:30:16 +0200 (Fri, 30 Jul 2010) $ by $Author: tack $
11
* $Revision: 11306 $
12
*
13
* This file is part of Gecode, the generic constraint
14
* development environment:
15
* http://www.gecode.org
16
*
17
* Permission is hereby granted, free of charge, to any person obtaining
18
* a copy of this software and associated documentation files (the
19
* "Software"), to deal in the Software without restriction, including
20
* without limitation the rights to use, copy, modify, merge, publish,
21
* distribute, sublicense, and/or sell copies of the Software, and to
22
* permit persons to whom the Software is furnished to do so, subject to
23
* the following conditions:
24
*
25
* The above copyright notice and this permission notice shall be
26
* included in all copies or substantial portions of the Software.
27
*
28
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
*
36
*/
37
38
#ifndef GECODE_GIST_NODEVISITOR_HH
39
#define GECODE_GIST_NODEVISITOR_HH
40
41
namespace
Gecode
{
namespace
Gist {
42
44
template
<
class
Cursor>
45
class
NodeVisitor
{
46
protected
:
48
Cursor
c
;
49
public
:
51
NodeVisitor
(
const
Cursor& c0);
53
void
setCursor
(
const
Cursor& c0);
55
Cursor&
getCursor
(
void
);
56
};
57
59
template
<
class
Cursor>
60
class
PostorderNodeVisitor
:
public
NodeVisitor
<Cursor> {
61
protected
:
62
using
NodeVisitor<Cursor>::c
;
64
void
moveToLeaf
(
void
);
65
public
:
67
PostorderNodeVisitor
(
const
Cursor&
c
);
69
bool
next
(
void
);
71
void
run
(
void
);
72
};
73
75
template
<
class
Cursor>
76
class
PreorderNodeVisitor
:
public
NodeVisitor
<Cursor> {
77
protected
:
78
using
NodeVisitor<Cursor>::c
;
80
bool
backtrack
(
void
);
81
public
:
83
PreorderNodeVisitor
(
const
Cursor&
c
);
85
bool
next
(
void
);
87
void
run
(
void
);
88
};
89
90
}}
91
92
#include <
gecode/gist/nodevisitor.hpp
>
93
94
#endif
95
96
// STATISTICS: gist-any
Gecode::Gist::PostorderNodeVisitor::next
bool next(void)
Move cursor to next node, return true if succeeded.
Definition:
nodevisitor.hpp:68
Gecode::Gist::PreorderNodeVisitor::next
bool next(void)
Move cursor to the next node, return true if succeeded.
Definition:
nodevisitor.hpp:107
Gecode::Gist::NodeVisitor::setCursor
void setCursor(const Cursor &c0)
Reset the cursor object to c0.
Definition:
nodevisitor.hpp:46
Gecode::Gist::PostorderNodeVisitor::run
void run(void)
Execute visitor.
Definition:
nodevisitor.hpp:83
Gecode::Gist::PostorderNodeVisitor::PostorderNodeVisitor
PostorderNodeVisitor(const Cursor &c)
Constructor.
Definition:
nodevisitor.hpp:61
Gecode::Gist::PostorderNodeVisitor
Run a cursor over a tree, processing nodes in post-order.
Definition:
nodevisitor.hh:60
Gecode::Gist::PreorderNodeVisitor::PreorderNodeVisitor
PreorderNodeVisitor(const Cursor &c)
Constructor.
Definition:
nodevisitor.hpp:102
Gecode::Gist::NodeVisitor::getCursor
Cursor & getCursor(void)
Return the cursor.
Definition:
nodevisitor.hpp:50
Gecode::Gist::NodeVisitor::c
Cursor c
The cursor.
Definition:
nodevisitor.hh:48
Gecode::Gist::PreorderNodeVisitor::run
void run(void)
Execute visitor.
Definition:
nodevisitor.hpp:121
Gecode::Gist::PreorderNodeVisitor
Run a cursor over a tree, processing nodes in pre-order.
Definition:
nodevisitor.hh:76
Gecode::Gist::PreorderNodeVisitor::backtrack
bool backtrack(void)
Move cursor to next node from a leaf.
Definition:
nodevisitor.hpp:89
Gecode::Gist::PostorderNodeVisitor::moveToLeaf
void moveToLeaf(void)
Move the cursor to the left-most leaf.
Definition:
nodevisitor.hpp:54
Gecode::Gist::NodeVisitor
Base class for a visitor that runs a cursor over a tree.
Definition:
nodevisitor.hh:45
Gecode
Gecode toplevel namespace
nodevisitor.hpp
Gecode::Gist::NodeVisitor::NodeVisitor
NodeVisitor(const Cursor &c0)
Constructor.
Definition:
nodevisitor.hpp:42