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

XSBPool.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_XSBPOOL_H
00004 #define DEV_W3_ORG__2001_BLINDFOLD_SRC_XSBPOOL_H
00005 // $Id: XSBPool_8h-source.html,v 1.2 2001/10/10 20:40:58 sandro Exp $
00006 #include "config.h"
00007 #include "XSBAgent.h"
00008 #include "DeductivePool.h"
00009 
00024 class XSBPool : public DeductivePool {
00025       
00026 public:
00027 
00028     // STANDARD MEMBER FUNCTIONS
00029     XSBPool(XSBAgent& agent, VariableScope* scope = 0);
00030     XSBPool(const XSBPool& other);
00031     const XSBPool& operator=(const XSBPool& other);
00032     bool operator==(const XSBPool& other) const;
00033     bool operator<(const XSBPool& other) const;
00034     size_t hash() const;
00035     friend std::ostream& operator<<(std::ostream& s, const XSBPool& me);
00036     std::ostream& print_to(std::ostream& stream) const; 
00037     ~XSBPool();       
00038 
00039     // (RE)IMPLEMENTATION OF INHERITED MEMBERS
00040 
00041     void add(Triple t) { cache.add(t); maybeChanged = true;}
00042 
00043     Triple fetch(Triple simplePattern, LoopState &loopState, 
00044          unsigned long max_results=0) const {
00045     return cache.fetch(simplePattern, loopState, max_results);
00046     }
00047     
00048     Query* query(const TripleSource &pattern) {
00049     return new XSBQuery(agent, *this, pattern);
00050     }
00051 
00052     void remove(Triple t) {
00053     maybeChanged = true;
00054     cache.remove(t);
00055     }
00056 
00057     void replace(Symbol old, Symbol replacement) {
00058     maybeChanged = true;
00059     cache.replace(old, replacement);
00060     }
00061 
00062     VariableScope* getScope() const { return cache.getScope(); }
00063 
00064 
00065     // CLASS-SPECIFIC PUBLIC INTERFACE
00066 
00067     void sync();
00068 
00069 private:
00070     XSBAgent& agent;
00071     char* fileName;
00072     std::ostream* file;
00073     friend class XSBQuery;
00074     std::string predicate;
00075     InMemoryPool cache;
00076     bool maybeChanged;
00077 };     
00078 
00079 STANDARD_EXTERNAL(XSBPool)
00080 
00081 #endif  /* DEV_W3_ORG__2001_BLINDFOLD_SRC_XSBPOOL_H */   // -*-C++-*-

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