Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ListSubstitution.hpp

Go to the documentation of this file.
00001 
00027 //
00028 //  file ListSubstitution.hpp
00029 //  defines class ListSubstitution of substitutions which can be popped
00030 //  and in which the order in which the bindings are inserted matters
00031 //  not a very fast implementation
00032 //
00033 
00034 #ifndef __ListSubstitution__
00035 #define __ListSubstitution__
00036 
00037 
00038 #include "Term.hpp"
00039 
00040 
00041 class ListSubstitution
00042 {
00043  public:
00044   ListSubstitution ();
00045   ~ListSubstitution ();
00046   void push (Var v, Term t);
00047   bool get (Var v, Term& t) const;
00048   void pop (Var v);
00049   //void originalVars (VarList& vs) const 
00050   //  { return originalVars (vs, _bindings); }
00051   void terms (TermList& ts) const { terms (_bindings, ts); }
00052 
00053  private:
00054   class Binding;
00055   typedef List<Binding*, CID_BINDING_LIST> BindingList;
00056 
00057   // structure
00058   BindingList* _bindings;
00059 
00060   // auxiliary
00061   static void originalVars (VarList& vs, const BindingList*);
00062   static void terms (const BindingList*, TermList& ts);
00063 
00064  friend ostream& operator << (ostream& str, ListSubstitution&);
00065 }; // class ListSubstitution
00066 
00067 
00068 class ListSubstitution::Binding {
00069  public:
00070   Binding (Var v, Term t) 
00071     :
00072     _var (v),
00073     _term (t)
00074     {}
00075   Var var () const { return _var; }
00076   const Term& term () const { return _term; }
00077  private:
00078   // structure
00079   Var _var;
00080   const Term _term;
00081 }; // class ListSubstitution::Binding
00082 
00083 
00084 ostream& operator << (ostream& str, ListSubstitution&);
00085 
00086 
00087 #endif // __ListSubstitution__
00088 

Generated on Sat Jun 28 15:08:57 2003 for Vampire by doxygen 1.3.2