summaryrefslogtreecommitdiff
path: root/project2/common/cache.h
blob: 2c438b892f4c4bcf6eb4374546b8560e686aae0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef CACHE_H
#define CACHE_H

#include "sourceObject.h"
#include "presenter.h"
#include "iHaveParameters.h"

class RowProcessor;
class RowSet;
class RowState;
typedef boost::intrusive_ptr<const RowSet> RowSetCPtr;

class Cache : public IHaveParameters, public SourceObject {
	public:
		Cache(ScriptNodePtr p);

		bool checkAndExecute(const Glib::ustring &, const Glib::ustring &, const RowProcessor *);
		virtual RowSetPresenterPtr openFor(const Glib::ustring &, const Glib::ustring &, const IHaveParameters *) = 0;
		virtual void save(const Glib::ustring &, const Glib::ustring &, const IHaveParameters *) = 0;
		virtual void discard(const Glib::ustring &, const Glib::ustring &, const IHaveParameters *) = 0;

	protected:
		virtual RowSetCPtr getCachedRowSet(const Glib::ustring &, const Glib::ustring &, const IHaveParameters *) const = 0;
		void applyKeys(const boost::function2<void, const std::string &, const VariableType &> & f, const IHaveParameters *) const;
		const bool inherit;
};
typedef boost::intrusive_ptr<Cache> CachePtr;

#endif