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

Query.h

00001 // See the file LICENSE in the some directory as this file for legal
00002 // notices about this software.
00003 #ifndef DEV_W3_ORG__2001_BLINDFOLD_SRC_MATCH_H
00004 #define DEV_W3_ORG__2001_BLINDFOLD_SRC_MATCH_H
00005 // $Id: Query_8h-source.html,v 1.2 2001/10/10 20:40:58 sandro Exp $
00006 #include "config.h"
00007 #include "Triple.h"
00008 #include "TripleSource.h"
00009 #include "SymbolMap.h"
00010 
00018 class Query {
00019       
00020 public:
00021 
00022     // STANDARD MEMBER FUNCTIONS
00023     Query(const TripleSource& goal) 
00024     : bindings(/*goal.getScope()*/), 
00025     beforeFirstFetch(true), 
00026     moreResultsPossible(true) { }
00027     Query(const Query& other);
00028     const Query& operator=(const Query& other);
00029     bool operator==(const Query& other) const;
00030     bool operator<(const Query& other) const;
00031     size_t hash() const;
00032     friend std::ostream& operator<<(std::ostream& s, const Query& me);
00033     std::ostream& print_to(std::ostream& stream) const; 
00034     virtual ~Query();       
00035 
00036     // (RE)IMPLEMENTATION OF INHERITED MEMBERS
00037 
00038     // CLASS-SPECIFIC PUBLIC INTERFACE
00039 
00045     bool fetch() {
00046     assert(moreResultsPossible);
00047     if (beforeFirstFetch) {
00048         moreResultsPossible = advanceToFirst();
00049         beforeFirstFetch = false;
00050     } else {
00051         moreResultsPossible = advanceToNext();
00052     }
00053     if (moreResultsPossible) moreResultsPossible = getResults();
00054     return moreResultsPossible;
00055     }
00056 
00064     Symbol binding(Symbol var) {
00065     return bindings.get(var);
00066     }
00067 
00072     virtual Triple getFailurePoint()  { NOT_IMPLEMENTED; }
00073 
00074 
00075 // OBSOLETE
00079     virtual bool found() { NOT_IMPLEMENTED; }
00080 
00091     virtual void advance() { NOT_IMPLEMENTED; }
00092 
00093     virtual void close() { }
00094 
00095 protected:
00096     // seems to me one usually implements these totally differently
00097     virtual bool advanceToFirst() { NOT_IMPLEMENTED; }
00098     virtual bool advanceToNext() { NOT_IMPLEMENTED; }
00099     virtual bool getResults() { NOT_IMPLEMENTED; }
00100     SymbolMap bindings;
00101     bool beforeFirstFetch;
00102     bool moreResultsPossible;
00103 
00104 private:
00105 
00106 };     
00107 
00108 STANDARD_EXTERNAL(Query)
00109 
00110 #endif  /* DEV_W3_ORG__2001_BLINDFOLD_SRC_MATCH_H */   // -*-C++-*-

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.