Generated on Mon Aug 25 11:35:40 2008 for Gecode by doxygen 1.5.6

reflection.icc

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2007
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-07-11 09:39:08 +0200 (Fri, 11 Jul 2008) $ by $Author: tack $
00011  *     $Revision: 7297 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *  Permission is hereby granted, free of charge, to any person obtaining
00018  *  a copy of this software and associated documentation files (the
00019  *  "Software"), to deal in the Software without restriction, including
00020  *  without limitation the rights to use, copy, modify, merge, publish,
00021  *  distribute, sublicense, and/or sell copies of the Software, and to
00022  *  permit persons to whom the Software is furnished to do so, subject to
00023  *  the following conditions:
00024  *
00025  *  The above copyright notice and this permission notice shall be
00026  *  included in all copies or substantial portions of the Software.
00027  *
00028  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #include <iostream>
00039 #include <cstring>
00040 
00046 namespace Gecode { namespace Reflection {
00047   
00052 
00053   class GECODE_VTABLE_EXPORT ReflectionException : public Exception {
00054   public:
00056     ReflectionException(const char* what) : Exception("Reflection", what) {}
00057   };
00058 
00060   class GECODE_VTABLE_EXPORT NoReflectionDefinedException
00061   : public ReflectionException {
00062   public:
00063     NoReflectionDefinedException(void)
00064     : ReflectionException("No reflection defined") {}
00065   };
00066 
00068   
00069   class ArrayArg;
00070   class IntArrayArg;
00071   
00084   class GECODE_KERNEL_EXPORT Arg {
00085   protected:
00087     enum argtype {
00088       INT_ARG,           
00089       VAR_ARG,           
00090       ARRAY_ARG,         
00091       INT_ARRAY_ARG,     
00092       STRING_ARG,        
00093       PAIR_ARG,          
00094       SHARED_OBJECT_ARG, 
00095       SHARED_REF_ARG     
00096     };
00097 
00099     argtype t;
00100     
00101     union {
00103       int i;
00105       char* s;
00107       Arg* first;
00108     } arg1;
00109 
00110     union {
00112       Arg* second;
00114       Arg** aa;
00116       int* ia;
00117     } arg2;
00119     Arg(argtype t);
00120     
00121   public:
00123     bool         isInt(void) const;
00125     int          toInt(void) const;
00127     static Arg*  newInt(int i);
00129     void         initInt(int i);
00130     
00132     bool         isVar(void) const;
00134     int          toVar(void) const;
00136     static Arg*  newVar(int i);
00138     void         initVar(int i);
00139     
00141     bool             isArray(void) const;
00143     ArrayArg*        toArray(void);
00145     const ArrayArg*  toArray(void) const;
00147     static ArrayArg* newArray(int n);
00149     void         initArray(int n);
00150     
00152     bool                isIntArray(void) const;
00154     IntArrayArg*        toIntArray(void);
00156     const IntArrayArg*  toIntArray(void) const;
00158     static IntArrayArg* newIntArray(int n);
00160     template <class A>
00161     static IntArrayArg* newIntArray(const A& a);
00163     void         initIntArray(int n);
00164 
00166     bool         isString(void) const;
00168     const char*  toString(void) const;
00170     static Arg*  newString(const char* s);
00172     void         initString(const char* s);
00173     
00175     bool         isPair(void) const;
00177     Arg*         first(void);
00179     const Arg*   first(void) const;
00181     Arg*         second(void);
00183     const Arg*   second(void) const;
00185     static Arg*  newPair(Arg* a, Arg* b);
00187     void         initPair(Arg* a, Arg* b);
00188     
00190     bool         isSharedObject(void) const;
00192     Arg*         toSharedObject(void);
00194     const Arg*   toSharedObject(void) const;
00196     static Arg*  newSharedObject(Arg* a);
00198     void         initSharedObject(Arg* a);
00199     
00201     bool         isSharedReference(void) const;
00203     int          toSharedReference(void) const;
00205     static Arg*  newSharedReference(int ref);
00207     void         initSharedReference(int ref);
00208     
00210     GECODE_MSC_VIRTUAL ~Arg(void);
00211   };
00212   
00213 
00222   class GECODE_KERNEL_EXPORT ArrayArg : public Arg {
00223   private:
00225     ArrayArg(void);
00226   public:
00228     const Arg* operator[](int i) const;
00230     Arg*& operator[](int i);
00232     int size(void) const;
00233   };
00234 
00243   class GECODE_KERNEL_EXPORT IntArrayArg : public Arg {
00244   private:
00246     IntArrayArg(void);
00247   public:
00249     const int& operator[](int i) const;
00251     int& operator[](int i);
00253     int size(void) const;
00254   };
00255 
00262   class GECODE_KERNEL_EXPORT IntArrayArgRanges {
00263   private:
00265     Reflection::IntArrayArg* a;
00267     int n;
00268   public:
00270     IntArrayArgRanges(Reflection::IntArrayArg* a0);
00272     bool operator()(void);
00274     void operator++(void);
00276     int min(void) const;
00278     int max(void) const;
00280     unsigned int width(void) const;
00281   };
00282   
00299   class GECODE_KERNEL_EXPORT VarSpec {
00300   private:
00301     class Domain;
00303     Domain* _dom;
00304   public:
00306     VarSpec(void);
00308     VarSpec(Support::Symbol vti, Arg* domain, bool assigned=false);
00310     VarSpec(const VarSpec& s);
00312     const VarSpec& operator=(const VarSpec& s);
00314     GECODE_MSC_VIRTUAL ~VarSpec(void);
00316     void name(const Support::Symbol& n0);
00318     Support::Symbol name(void) const;
00320     bool hasName(void) const;
00322     Arg* dom(void) const;
00324     bool assigned(void) const;
00325     // Get the variable type identifier for this variable
00326     Support::Symbol vti(void) const;
00327   };
00328   
00350   class GECODE_KERNEL_EXPORT ActorSpec {
00351     friend class BranchingSpec;
00352   private:
00353     class Arguments;
00355     Arguments* _args;
00357     void resize(void);
00358     friend class ActorSpecIter;
00360     void queue(int q);
00364     unsigned int branchingId(void) const;
00365   public:
00367     ActorSpec(void);
00369     ActorSpec(const Support::Symbol& name);
00371     ActorSpec(const ActorSpec& s);
00373     const ActorSpec& operator=(const ActorSpec& s);
00375     GECODE_MSC_VIRTUAL ~ActorSpec(void);
00376     
00378 
00379 
00380     Support::Symbol ati(void) const;
00382     int noOfArgs(void) const;
00384     void checkArity(int n) const;
00386     Arg* operator[](int i) const;
00387 
00389     bool isBranching(void) const;
00393     int queue(void) const;
00395     
00397 
00398 
00399     void add(Arg* arg);
00401   };
00402 
00403 }}
00404 
00408 Gecode::Reflection::ActorSpec
00409 operator<<(Gecode::Reflection::ActorSpec s, Gecode::Reflection::Arg* arg);
00410 
00411 
00415 Gecode::Reflection::ActorSpec
00416 operator<<(Gecode::Reflection::ActorSpec s, int i);
00417 
00421 Gecode::Reflection::ActorSpec
00422 operator<<(Gecode::Reflection::ActorSpec s, unsigned int i);
00423 
00427 Gecode::Reflection::ActorSpec
00428 operator<<(Gecode::Reflection::ActorSpec s, double i);
00429 
00430 /* Implementation of ActorSpec operators */
00431 
00432 forceinline Gecode::Reflection::ActorSpec
00433 operator<<(Gecode::Reflection::ActorSpec s, Gecode::Reflection::Arg* arg) {
00434   s.add(arg);
00435   return s;
00436 }
00437 forceinline Gecode::Reflection::ActorSpec
00438 operator<<(Gecode::Reflection::ActorSpec s, int i) {
00439   return s << Gecode::Reflection::Arg::newInt(i);
00440 }
00441 forceinline Gecode::Reflection::ActorSpec
00442 operator<<(Gecode::Reflection::ActorSpec s, unsigned int i) {
00443   return s << Gecode::Reflection::Arg::newInt(static_cast<int>(i));
00444 }
00445 forceinline Gecode::Reflection::ActorSpec
00446 operator<<(Gecode::Reflection::ActorSpec s, double i) {
00447   return s << Gecode::Reflection::Arg::newInt(static_cast<int>(i));
00448 }
00449 
00450 namespace Gecode { namespace Reflection {
00451 
00466   class GECODE_KERNEL_EXPORT BranchingSpec {
00467   private:
00468     class Arguments;
00470     Arguments* _args;
00471   public:
00473     BranchingSpec(void);
00481     BranchingSpec(const BranchingDesc* d);
00483     BranchingSpec(const BranchingSpec& s);
00485     const BranchingSpec& operator=(const BranchingSpec& s);
00487     GECODE_MSC_VIRTUAL ~BranchingSpec(void);
00488     
00490 
00491 
00492     bool createdBy(const ActorSpec& b) const;
00494     unsigned int alternatives(void) const;
00496     Arg* operator[](int i) const;
00497     
00499     Arg*& operator[](int i);
00501   };
00502   
00503   class VarMap;
00504 
00514   class GECODE_KERNEL_EXPORT ActorSpecIter {
00515   private:
00517     VarMap*      m;
00519     const Space* s;
00521     const ActorLink *active;
00523     const ActorLink *cur;
00525     bool       isBranching;
00526   public:
00528     ActorSpecIter(const Space*, VarMap&);
00530     bool operator()(void) const;
00532     void operator++(void);
00534     ActorSpec actor(void) const;
00535   };
00536 
00541   class Registry {
00542   private:
00543     class RegistryObject;
00544     RegistryObject* ro;
00545   public:
00547     typedef void (*poster) (Space*, VarMap&, const ActorSpec&);
00549     typedef VarImpBase* (*varCreator) (Space*, VarSpec&);
00551     typedef void (*varConstrainer) (Space*, VarImpBase*, VarSpec&);
00553     typedef VarImpBase* (*varUpdater) (Space*, bool, VarImpBase*);
00555     typedef std::ostream& (*varPrinter) (std::ostream&, VarImpBase*);
00557     typedef Arg* (*varSpec) (const Space* home, VarMap& m, VarImpBase*);
00558 
00560     GECODE_KERNEL_EXPORT Registry(void);
00562     GECODE_KERNEL_EXPORT GECODE_MSC_VIRTUAL ~Registry(void);
00563 
00565     GECODE_KERNEL_EXPORT VarImpBase*
00566     createVar(Space* home, VarSpec& spec) const;
00567 
00569     GECODE_KERNEL_EXPORT void
00570     constrainVar(Space* home, VarImpBase* v, VarSpec& spec) const;
00571 
00573     GECODE_KERNEL_EXPORT VarImpBase*
00574     updateVariable(Space* home, bool share, VarImpBase* v,
00575                    const Support::Symbol& vti) const;
00576 
00578     GECODE_KERNEL_EXPORT std::ostream&
00579     printVariable(std::ostream& os, VarImpBase* v,
00580                   const Support::Symbol& vti) const;
00581 
00583     GECODE_KERNEL_EXPORT Arg*
00584     spec(const Space* home, VarMap& vm,
00585          VarImpBase* v, const Support::Symbol& vti) const;
00586 
00588     GECODE_KERNEL_EXPORT void
00589     post(Space* home, VarMap& vm, const ActorSpec& spec) const;
00590 
00592     GECODE_KERNEL_EXPORT void add(Support::Symbol vti, varCreator vc);
00594     GECODE_KERNEL_EXPORT void add(Support::Symbol vti, varConstrainer vc);
00596     GECODE_KERNEL_EXPORT void add(Support::Symbol vti, varUpdater vu);
00598     GECODE_KERNEL_EXPORT void add(Support::Symbol vti, varPrinter vp);
00600     GECODE_KERNEL_EXPORT void add(Support::Symbol vti, varSpec vp);
00602     GECODE_KERNEL_EXPORT void add(const Support::Symbol& ati, poster p);
00604     GECODE_KERNEL_EXPORT void print(std::ostream& out);
00605   private:
00607     Registry(const Registry&);
00609     Registry& operator=(const Registry&);
00610   };
00611   
00613   GECODE_KERNEL_EXPORT Registry& registry(void);
00614 
00623   template <class P>
00624   class ActorRegistrar {
00625   public:
00627     ActorRegistrar(void);
00628   };
00629 
00630   template <class P>
00631   ActorRegistrar<P>::ActorRegistrar(void) {
00632     registry().add(P::ati(), &P::post);
00633   }
00634 
00644   template <class V>
00645   class VarImpRegistrar {
00646   private:
00647     static VarImpBase* updateVar(Space* home, bool share, VarImpBase* v);
00648     static std::ostream& printVar(std::ostream& os, VarImpBase* v);
00649     static Reflection::Arg* spec(const Space* home, Reflection::VarMap& m,
00650                                  VarImpBase* v);
00651   public:
00653     VarImpRegistrar(void);
00654   };
00655 
00656   template <class V>
00657   VarImpBase*
00658   VarImpRegistrar<V>::updateVar(Space* home, bool share, VarImpBase* v) {
00659     typedef typename VarImpVarTraits<V>::Var Var;
00660     typedef typename VarViewTraits<Var>::View View;
00661     View view(static_cast<V*>(v));
00662     Var var(view);
00663     Var varCopy;
00664     varCopy.update(home, share, var);
00665     View viewCopy(varCopy);
00666     return viewCopy.var();
00667   }
00668 
00669   template <class V>
00670   std::ostream&
00671   VarImpRegistrar<V>::printVar(std::ostream& os, VarImpBase* v) {
00672     typedef typename VarImpVarTraits<V>::Var Var;
00673     typedef typename VarViewTraits<Var>::View View;
00674     View view(static_cast<V*>(v));
00675     Var var(view);
00676     return os << var;
00677   }
00678 
00679   template <class V>
00680   Reflection::Arg*
00681   VarImpRegistrar<V>::spec(const Space* home, Reflection::VarMap& m,
00682                            VarImpBase* v) {
00683     typedef typename VarImpVarTraits<V>::Var Var;
00684     typedef typename VarViewTraits<Var>::View View;
00685     View view(static_cast<V*>(v));
00686     return view.spec(home, m);
00687   }
00688 
00689   template <class V>
00690   VarImpRegistrar<V>::VarImpRegistrar(void) {
00691     registry().add(V::vti, &V::create);
00692     registry().add(V::vti, &V::constrain);
00693     registry().add(V::vti, &VarImpRegistrar<V>::updateVar);
00694     registry().add(V::vti, &VarImpRegistrar<V>::printVar);
00695     registry().add(V::vti, &VarImpRegistrar<V>::spec);
00696   }
00697 
00707   class Var {
00708   private:
00710     VarImpBase* _var;
00712     Support::Symbol _vti;
00713   public:
00715     Var(void);
00717     template <class VarImp> explicit Var(const VarBase<VarImp>& v);
00719     Var(const Var& v);
00721     Var(VarImpBase* var, const Support::Symbol& vti);
00723     GECODE_KERNEL_EXPORT void update(Space* home, bool share, Var& v);
00725     GECODE_KERNEL_EXPORT std::ostream& print(std::ostream& os) const;
00727     GECODE_KERNEL_EXPORT Arg* spec(const Space* home, VarMap& vm) const;
00729     VarImpBase* varImpBase(void) const;
00731     template <class VarImp>
00732     VarImp* var(void) const;
00733   };
00734 
00743   class GECODE_KERNEL_EXPORT Unreflector {
00744   private:
00746     Space* home;
00748     Reflection::VarMap& m;
00749     
00750   public:
00752     Unreflector(Space* home0, Reflection::VarMap& m0);
00753 
00755     GECODE_MSC_VIRTUAL ~Unreflector(void);
00756     
00758     Reflection::VarMap& varMap(void) const;
00759     
00761     void var(Reflection::VarSpec& spec);
00762 
00764     void post(Reflection::ActorSpec& spec);
00765   };
00766 
00767   forceinline
00768   Var::Var(void) {}
00769     
00770   template <class VarImp>
00771   forceinline
00772   Var::Var(const VarBase<VarImp>& v) {
00773     _var = v.var();
00774     _vti = v.var()->vti;
00775   }
00776 
00777   forceinline
00778   Var::Var(const Var& v) : _var(v._var), _vti(v._vti) {}
00779   
00780   forceinline
00781   Var::Var(VarImpBase* var, const Support::Symbol& vti)
00782     : _var(var), _vti(vti) {}
00783 
00784   forceinline VarImpBase*
00785   Var::varImpBase(void) const {
00786     return static_cast<VarImpBase*>(_var);    
00787   }
00788 
00789   template <class VarImp>
00790   inline VarImp*
00791   Var::var(void) const {
00792     if (! (VarImp::vti == _vti))
00793       throw ReflectionException("VTI mismatch");
00794     return static_cast<VarImp*>(_var);
00795   }
00796 
00801 
00802 #define GECODE_REGISTER1(P) \
00803   ::Gecode::Reflection::ActorRegistrar< P > GECODE_FRESH(r)
00805 #define GECODE_REGISTER2(P1,P2) \
00806   ::Gecode::Reflection::ActorRegistrar< P1,P2 > GECODE_FRESH(r)
00808 #define GECODE_REGISTER3(P1,P2,P3) \
00809   ::Gecode::Reflection::ActorRegistrar< P1,P2,P3 > GECODE_FRESH(r)
00811 #define GECODE_REGISTER4(P1,P2,P3,P4) \
00812   ::Gecode::Reflection::ActorRegistrar< P1,P2,P3,P4 > GECODE_FRESH(r)
00814 #define GECODE_REGISTER5(P1,P2,P3,P4,P5) \
00815   ::Gecode::Reflection::ActorRegistrar< P1,P2,P3,P4,P5 > GECODE_FRESH(r)
00817 #define GECODE_REGISTER6(P1,P2,P3,P4,P5,P6) \
00818   ::Gecode::Reflection::ActorRegistrar< P1,P2,P3,P4,P5,P6 > GECODE_FRESH(r)
00819 
00821 
00822   /**************************************
00823    * Implementations
00824    **************************************/
00825 
00826   template <class A>
00827   IntArrayArg*
00828   Arg::newIntArray(const A& a) {
00829     IntArrayArg* ret = Arg::newIntArray(a.size());
00830     for (int i=a.size(); i--;)
00831       (*ret)[i] = a[i];
00832     return ret;
00833   }
00834   
00841   template <class View>
00842   class TypeOf {
00843   public:
00845     static Support::Symbol t(void) { return View::type(); }
00846   };
00847   
00850   template <>
00851   class TypeOf<bool> {
00852   public:
00854     static Support::Symbol t(void) { return Support::Symbol("bool"); }
00855   };
00856 
00859   template <>
00860   class TypeOf<int> {
00861   public:
00863     static Support::Symbol t(void) { return Support::Symbol("int"); }
00864   };
00865 
00868   template <>
00869   class TypeOf<double> {
00870   public:
00872     static Support::Symbol t(void) { return Support::Symbol("double"); }
00873   };
00874 
00876 
00877 }
00878   class IntSet;
00879 namespace Reflection {
00880 
00887   template <>
00888   class TypeOf<const IntSet> {
00889   public:
00891     static Support::Symbol t(void) { return Support::Symbol("IntSet"); }    
00892   };
00893 
00895   template <class View0>
00896   Support::Symbol
00897   mangle(const Support::Symbol& ati) {
00898     Support::Symbol mangled = ati.copy();
00899     mangled += "<";
00900     mangled += TypeOf<View0>::t();
00901     mangled += ">";
00902     return mangled;
00903   }
00905   template <class View0>
00906   Support::Symbol
00907   mangle(const Support::Symbol& ati, bool b) {
00908     Support::Symbol mangled = ati.copy();
00909     mangled += "<";
00910     mangled += TypeOf<View0>::t();
00911     mangled += ",";
00912     mangled += Support::Symbol(b);
00913     mangled += ">";
00914     return mangled;
00915   }
00917   template <class View0>
00918   Support::Symbol
00919   mangle(const Support::Symbol& ati, int i) {
00920     Support::Symbol mangled = ati.copy();
00921     mangled += "<";
00922     mangled += TypeOf<View0>::t();
00923     mangled += ",";
00924     mangled += Support::Symbol(i);
00925     mangled += ">";
00926     return mangled;
00927   }
00929   template <class View0>
00930   Support::Symbol
00931   mangle(const Support::Symbol& ati, unsigned int i) {
00932     Support::Symbol mangled = ati.copy();
00933     mangled += "<";
00934     mangled += TypeOf<View0>::t();
00935     mangled += ",";
00936     mangled += Support::Symbol(i);
00937     mangled += ">";
00938     return mangled;
00939   }
00941   template <class View0, class View1>
00942   Support::Symbol
00943   mangle(const Support::Symbol& ati) {
00944     Support::Symbol mangled = ati.copy();
00945     mangled += "<";
00946     mangled += TypeOf<View0>::t();
00947     mangled += ",";
00948     mangled += TypeOf<View1>::t();
00949     mangled += ">";
00950     return mangled;
00951   }
00953   template <class View0, class View1>
00954   Support::Symbol
00955   mangle(const Support::Symbol& ati, bool b) {
00956     Support::Symbol mangled = ati.copy();
00957     mangled += "<";
00958     mangled += TypeOf<View0>::t();
00959     mangled += ",";
00960     mangled += TypeOf<View1>::t();
00961     mangled += ",";
00962     mangled += Support::Symbol(b);
00963     mangled += ">";
00964     return mangled;
00965   }
00967   template <class View0, class View1>
00968   Support::Symbol
00969   mangle(const Support::Symbol& ati, int i) {
00970     Support::Symbol mangled = ati.copy();
00971     mangled += "<";
00972     mangled += TypeOf<View0>::t();
00973     mangled += ",";
00974     mangled += TypeOf<View1>::t();
00975     mangled += ",";
00976     mangled += Support::Symbol(i);
00977     mangled += ">";
00978     return mangled;
00979   }
00981   template <class View0, class View1>
00982   Support::Symbol
00983   mangle(const Support::Symbol& ati, unsigned int i) {
00984     Support::Symbol mangled = ati.copy();
00985     mangled += "<";
00986     mangled += TypeOf<View0>::t();
00987     mangled += ",";
00988     mangled += TypeOf<View1>::t();
00989     mangled += ",";
00990     mangled += Support::Symbol(i);
00991     mangled += ">";
00992     return mangled;
00993   }
00995   template <class View0, class View1, class View2>
00996   Support::Symbol
00997   mangle(const Support::Symbol& ati) {
00998     Support::Symbol mangled = ati.copy();
00999     mangled += "<";
01000     mangled += TypeOf<View0>::t();
01001     mangled += ",";
01002     mangled += TypeOf<View1>::t();
01003     mangled += ",";
01004     mangled += TypeOf<View2>::t();
01005     mangled += ">";
01006     return mangled;
01007   }
01009   template <class View0, class View1, class View2>
01010   Support::Symbol
01011   mangle(const Support::Symbol& ati, bool b) {
01012     Support::Symbol mangled = ati.copy();
01013     mangled += "<";
01014     mangled += TypeOf<View0>::t();
01015     mangled += ",";
01016     mangled += TypeOf<View1>::t();
01017     mangled += ",";
01018     mangled += TypeOf<View2>::t();
01019     mangled += ",";
01020     mangled += Support::Symbol(b);
01021     mangled += ">";
01022     return mangled;
01023   }
01025   template <class View0, class View1, class View2>
01026   Support::Symbol
01027   mangle(const Support::Symbol& ati, int i) {
01028     Support::Symbol mangled = ati.copy();
01029     mangled += "<";
01030     mangled += TypeOf<View0>::t();
01031     mangled += ",";
01032     mangled += TypeOf<View1>::t();
01033     mangled += ",";
01034     mangled += TypeOf<View2>::t();
01035     mangled += ",";
01036     mangled += Support::Symbol(i);
01037     mangled += ">";
01038     return mangled;
01039   }
01041   template <class View0, class View1, class View2>
01042   Support::Symbol
01043   mangle(const Support::Symbol& ati, unsigned int i) {
01044     Support::Symbol mangled = ati.copy();
01045     mangled += "<";
01046     mangled += TypeOf<View0>::t();
01047     mangled += ",";
01048     mangled += TypeOf<View1>::t();
01049     mangled += ",";
01050     mangled += TypeOf<View2>::t();
01051     mangled += ",";
01052     mangled += Support::Symbol(i);
01053     mangled += ">";
01054     return mangled;
01055   }
01057   template <class View0, class View1, class View2, class View3>
01058   Support::Symbol
01059   mangle(const Support::Symbol& ati) {
01060     Support::Symbol mangled = ati.copy();
01061     mangled += "<";
01062     mangled += TypeOf<View0>::t();
01063     mangled += ",";
01064     mangled += TypeOf<View1>::t();
01065     mangled += ",";
01066     mangled += TypeOf<View2>::t();
01067     mangled += ",";
01068     mangled += TypeOf<View3>::t();
01069     mangled += ">";
01070     return mangled;
01071   }
01073   template <class View0, class View1, class View2, class View3>
01074   Support::Symbol
01075   mangle(const Support::Symbol& ati, bool b) {
01076     Support::Symbol mangled = ati.copy();
01077     mangled += "<";
01078     mangled += TypeOf<View0>::t();
01079     mangled += ",";
01080     mangled += TypeOf<View1>::t();
01081     mangled += ",";
01082     mangled += TypeOf<View2>::t();
01083     mangled += ",";
01084     mangled += TypeOf<View3>::t();
01085     mangled += ",";
01086     mangled += Support::Symbol(b);
01087     mangled += ">";
01088     return mangled;
01089   }
01091   template <class View0, class View1, class View2, class View3>
01092   Support::Symbol
01093   mangle(const Support::Symbol& ati, int i) {
01094     Support::Symbol mangled = ati.copy();
01095     mangled += "<";
01096     mangled += TypeOf<View0>::t();
01097     mangled += ",";
01098     mangled += TypeOf<View1>::t();
01099     mangled += ",";
01100     mangled += TypeOf<View2>::t();
01101     mangled += ",";
01102     mangled += TypeOf<View3>::t();
01103     mangled += ",";
01104     mangled += Support::Symbol(i);
01105     mangled += ">";
01106     return mangled;
01107   }
01109   template <class View0, class View1, class View2, class View3>
01110   Support::Symbol
01111   mangle(const Support::Symbol& ati, unsigned int i) {
01112     Support::Symbol mangled = ati.copy();
01113     mangled += "<";
01114     mangled += TypeOf<View0>::t();
01115     mangled += ",";
01116     mangled += TypeOf<View1>::t();
01117     mangled += ",";
01118     mangled += TypeOf<View2>::t();
01119     mangled += ",";
01120     mangled += TypeOf<View3>::t();
01121     mangled += ",";
01122     mangled += Support::Symbol(i);
01123     mangled += ">";
01124     return mangled;
01125   }
01126   
01128   template <class View0, class View1, class View2, class View3, class View4>
01129   Support::Symbol
01130   mangle(const Support::Symbol& ati) {
01131     Support::Symbol mangled = ati.copy();
01132     mangled += "<";
01133     mangled += TypeOf<View0>::t();
01134     mangled += ",";
01135     mangled += TypeOf<View1>::t();
01136     mangled += ",";
01137     mangled += TypeOf<View2>::t();
01138     mangled += ",";
01139     mangled += TypeOf<View3>::t();
01140     mangled += ",";
01141     mangled += TypeOf<View4>::t();
01142     mangled += ">";
01143     return mangled;
01144   }
01146   template <class View0, class View1, class View2, class View3, class View4>
01147   Support::Symbol
01148   mangle(const Support::Symbol& ati, bool b) {
01149     Support::Symbol mangled = ati.copy();
01150     mangled += "<";
01151     mangled += TypeOf<View0>::t();
01152     mangled += ",";
01153     mangled += TypeOf<View1>::t();
01154     mangled += ",";
01155     mangled += TypeOf<View2>::t();
01156     mangled += ",";
01157     mangled += TypeOf<View3>::t();
01158     mangled += ",";
01159     mangled += TypeOf<View4>::t();
01160     mangled += ",";
01161     mangled += Support::Symbol(b);
01162     mangled += ">";
01163     return mangled;
01164   }
01166   template <class View0, class View1, class View2, class View3, class View4>
01167   Support::Symbol
01168   mangle(const Support::Symbol& ati, int i) {
01169     Support::Symbol mangled = ati.copy();
01170     mangled += "<";
01171     mangled += TypeOf<View0>::t();
01172     mangled += ",";
01173     mangled += TypeOf<View1>::t();
01174     mangled += ",";
01175     mangled += TypeOf<View2>::t();
01176     mangled += ",";
01177     mangled += TypeOf<View3>::t();
01178     mangled += ",";
01179     mangled += TypeOf<View4>::t();
01180     mangled += ",";
01181     mangled += Support::Symbol(i);
01182     mangled += ">";
01183     return mangled;
01184   }
01186   template <class View0, class View1, class View2, class View3, class View4>
01187   Support::Symbol
01188   mangle(const Support::Symbol& ati, unsigned int i) {
01189     Support::Symbol mangled = ati.copy();
01190     mangled += "<";
01191     mangled += TypeOf<View0>::t();
01192     mangled += ",";
01193     mangled += TypeOf<View1>::t();
01194     mangled += ",";
01195     mangled += TypeOf<View2>::t();
01196     mangled += ",";
01197     mangled += TypeOf<View3>::t();
01198     mangled += ",";
01199     mangled += TypeOf<View4>::t();
01200     mangled += ",";
01201     mangled += Support::Symbol(i);
01202     mangled += ">";
01203     return mangled;
01204   }
01206 
01207 }}
01208 
01210 GECODE_KERNEL_EXPORT std::ostream&
01211 operator<<(std::ostream& os, const Gecode::Reflection::Var& v);
01212 
01213 // STATISTICS: kernel-other