summaryrefslogtreecommitdiff
path: root/project2/common/rowProcessor.h
blob: 990b22898134dff86b8a6223f950ae6088437a32 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef ROWPROCESSOR_H
#define ROWPROCESSOR_H

#include <glibmm/ustring.h>
#include "sourceObject.h"
#include "iHaveParameters.h"
#include "rowSet.h"
#include "rowSetCache.h"
#include "test.h"
#include "scriptStorage.h"
#include <visibility.h>

class Presenter;
class ExecContext;

/// Base class for Project2 components that work with row sets
class DLL_PUBLIC RowProcessor : public IHaveParameters {
	public:
		enum EventIDs { Complete };
		RowProcessor(ScriptNodePtr);
		void loadComplete(const CommonObjects *);

		const std::string recordSource;
		const Glib::ustring filter;
		const bool CROE;
		const bool IRSE;

	protected:
		std::shared_ptr<RowSet> source;
		void execute(ExecContext *, const RowProcessorCallback &) const;

	private:
		friend class RowState;
		void rowReadyInternal(const RowState *, const RowProcessorCallback &, ExecContext *) const;
		typedef ANONSTORAGEOF(Test) Tests;
		Tests tests;
		typedef ANONORDEREDSTORAGEOF(RowSetCache) Caches;
		Caches caches;
		typedef boost::tuple<RowSetPresenterPtr, RowSetCachePtr> TargetCache;
		typedef boost::shared_ptr<TargetCache> TargetCachePtr;
		typedef std::set<TargetCachePtr> TargetCaches;
		mutable TargetCaches tc;

		void saveCaches(ExecContext *) const;
		void discardCaches(ExecContext *) const;
};

#endif