1 /*
2 
3     This file is part of the Maude 2 interpreter.
4 
5     Copyright 1997-2006 SRI International, Menlo Park, CA 94025, USA.
6 
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20 
21 */
22 
23 //
24 //	Class for a process that tries to decompose a strategy to reach a leaf.
25 //
26 #ifndef _decompositionProcess_hh_
27 #define _decompositionProcess_hh_
28 #include "strategicProcess.hh"
29 #include "strategyStackManager.hh"
30 
31 class DecompositionProcess : public StrategicProcess
32 {
33 public:
34   DecompositionProcess(int dagIndex,
35 		       StrategyStackManager::StackId pending,
36 		       StrategicExecution* taskSibling,
37 		       StrategicProcess* other);
38   //
39   //	We can't pass const here because we need to touch original to
40   //	handle double linking both on the task list and the process queue.
41   //
42   DecompositionProcess(DecompositionProcess* original);
43 
44   Survival run(StrategicSearch& searchObject);
45   void pushStrategy(StrategyStackManager& stackManager, StrategyExpression* strategy);
46   StrategyStackManager::StackId getPending() const;
47   int getDagIndex() const;
48 
49 private:
50   int dagIndex;
51   StrategyStackManager::StackId pending;
52 };
53 
54 inline void
pushStrategy(StrategyStackManager & stackManager,StrategyExpression * strategy)55 DecompositionProcess::pushStrategy(StrategyStackManager& stackManager, StrategyExpression* strategy)
56 {
57   pending = stackManager.push(pending, strategy);
58 }
59 
60 inline StrategyStackManager::StackId
getPending() const61 DecompositionProcess::getPending() const
62 {
63   return pending;
64 }
65 
66 inline int
getDagIndex() const67 DecompositionProcess::getDagIndex() const
68 {
69   return dagIndex;
70 }
71 
72 #endif
73