Last change
on this file since 86b917 was 86b917, checked in by Tillmann Crueger <crueger@…>, 16 years ago |
Added descriptors that allow multiple kinds of access to atoms
|
-
Property mode
set to
100644
|
File size:
836 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * AtomDescriptor.hpp
|
---|
3 | *
|
---|
4 | * Created on: Feb 5, 2010
|
---|
5 | * Author: crueger
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef ATOMDESCRIPTOR_HPP_
|
---|
9 | #define ATOMDESCRIPTOR_HPP_
|
---|
10 |
|
---|
11 | #include<vector>
|
---|
12 | #include<map>
|
---|
13 | #include "World.hpp"
|
---|
14 |
|
---|
15 | class atom;
|
---|
16 |
|
---|
17 | class AtomDescriptor
|
---|
18 | {
|
---|
19 | public:
|
---|
20 | friend atom* World::getAtom(AtomDescriptor& descriptor);
|
---|
21 | friend std::vector<atom*> World::getAllAtoms(AtomDescriptor& descriptor);
|
---|
22 |
|
---|
23 | AtomDescriptor();
|
---|
24 | virtual ~AtomDescriptor();
|
---|
25 |
|
---|
26 | protected:
|
---|
27 | virtual atom* find()=0;
|
---|
28 | virtual std::vector<atom*> findAll()=0;
|
---|
29 | std::map<int,atom*>& getAtoms();
|
---|
30 | };
|
---|
31 |
|
---|
32 | class AtomPredicateDescriptor : public AtomDescriptor{
|
---|
33 | public:
|
---|
34 | AtomPredicateDescriptor();
|
---|
35 | virtual ~AtomPredicateDescriptor();
|
---|
36 |
|
---|
37 | protected:
|
---|
38 | virtual atom *find();
|
---|
39 | virtual std::vector<atom*> findAll();
|
---|
40 | virtual bool predicate(std::pair<int,atom*>)=0;
|
---|
41 | };
|
---|
42 |
|
---|
43 | #endif /* ATOMDESCRIPTOR_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.