00001 /**** , [ bobocheTree.hh ], 00002 Copyright (c) 2008 Universite d'Orleans - Jeremie Vautard 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to deal 00006 in the Software without restriction, including without limitation the rights 00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 THE SOFTWARE. 00021 *************************************************************************/ 00022 00023 #ifndef __BOBOCHE_TREE__ 00024 #define __BOBOCHE_TREE__ 00025 #include <vector> 00026 #include <iostream> 00027 #include <string> 00028 #include "StrategyNode.hh" 00029 #include "qecode.hh" 00030 00031 using namespace std; 00032 class Strategy; 00033 00034 class StrategyImp { 00035 friend class Strategy; 00036 private: 00037 unsigned int pointers; 00038 StrategyNode zetag; 00039 vector<Strategy> nodes; 00040 public: 00041 StrategyImp(StrategyNode tag); 00042 ~StrategyImp(); 00043 }; 00044 00051 class QECODE_VTABLE_EXPORT Strategy { 00052 friend class StrategyImp; 00053 private: 00054 StrategyImp* imp; 00055 public: 00056 QECODE_EXPORT Strategy(); 00057 QECODE_EXPORT Strategy(StrategyNode tag); 00058 00059 /* \brief builds a one node (sub)strategy 00060 * 00061 * this method builds a one-node strategy that will typically be attached as child of another strategy. A strategy node embeds informations about quantification, 00062 * scope and values of variables that must be provided 00063 * @param qt quantifier of the scope this node represents 00064 * @param VMin index of the first variable of the scope this node represents 00065 * @param VMax index of the last variable of the scope this node represents 00066 * @param values values taken by the variables between VMin and VMax in this part of the strategy 00067 */ 00068 QECODE_EXPORT Strategy(bool qt,int VMin, int VMax, int scope,vector<int> values); 00069 QECODE_EXPORT Strategy(const Strategy& tree); 00070 QECODE_EXPORT Strategy& operator = (const Strategy& rvalue); 00071 QECODE_EXPORT ~Strategy(); 00072 QECODE_EXPORT StrategyNode getTag(); 00073 QECODE_EXPORT int degree(); 00074 QECODE_EXPORT Strategy getChild(int i); 00075 QECODE_EXPORT void attach(Strategy child); 00076 00077 QECODE_EXPORT bool isFalse() {return imp->zetag.isFalse();} 00078 QECODE_EXPORT bool isTrue() {return imp->zetag.isTrue();} 00079 QECODE_EXPORT bool isDummy() {return imp->zetag.isDummy();} 00080 QECODE_EXPORT static Strategy STrue(); 00081 QECODE_EXPORT static Strategy SFalse(); 00082 QECODE_EXPORT static Strategy Dummy(); 00083 00084 QECODE_EXPORT bool quantifier() {return imp->zetag.quantifier;} 00085 QECODE_EXPORT int VMin() {return imp->zetag.Vmin;} 00086 QECODE_EXPORT int VMax() {return imp->zetag.Vmax;} 00087 QECODE_EXPORT int scope() {return imp->zetag.scope;} 00088 QECODE_EXPORT vector<int> values() {return imp->zetag.valeurs;} 00089 QECODE_EXPORT int value(int var) {return imp->zetag.valeurs[var];} 00090 }; 00091 #endif