| [86b917] | 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 |
|
|---|
| [973c03] | 11 |
|
|---|
| 12 | #include <vector>
|
|---|
| 13 | #include <map>
|
|---|
| 14 | #include <boost/shared_ptr.hpp>
|
|---|
| [86b917] | 15 | #include "World.hpp"
|
|---|
| 16 |
|
|---|
| 17 | class atom;
|
|---|
| 18 |
|
|---|
| [323177] | 19 | // internal implementation, allows assignment, copying etc
|
|---|
| 20 | class AtomDescripter_impl;
|
|---|
| [86b917] | 21 |
|
|---|
| [323177] | 22 | class AtomDescriptor {
|
|---|
| 23 | friend atom* World::getAtom(AtomDescriptor descriptor);
|
|---|
| 24 | friend std::vector<atom*> World::getAllAtoms(AtomDescriptor descriptor);
|
|---|
| [973c03] | 25 |
|
|---|
| [323177] | 26 | friend AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
|
|---|
| 27 | friend AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
|
|---|
| 28 | friend AtomDescriptor operator!(const AtomDescriptor &arg);
|
|---|
| [86b917] | 29 |
|
|---|
| 30 | public:
|
|---|
| [323177] | 31 | typedef boost::shared_ptr<AtomDescriptor_impl> impl_ptr;
|
|---|
| [973c03] | 32 |
|
|---|
| [323177] | 33 | AtomDescriptor(impl_ptr);
|
|---|
| 34 | AtomDescriptor(const AtomDescriptor&);
|
|---|
| 35 | ~AtomDescriptor();
|
|---|
| [86b917] | 36 |
|
|---|
| [323177] | 37 | AtomDescriptor &operator=(AtomDescriptor &);
|
|---|
| [973c03] | 38 |
|
|---|
| [323177] | 39 | protected:
|
|---|
| 40 | atom* find();
|
|---|
| 41 | std::vector<atom*> findAll();
|
|---|
| 42 | impl_ptr get_impl() const;
|
|---|
| [973c03] | 43 |
|
|---|
| 44 | private:
|
|---|
| [323177] | 45 | impl_ptr impl;
|
|---|
| [973c03] | 46 | };
|
|---|
| 47 |
|
|---|
| [323177] | 48 | // Functions to construct actual descriptors
|
|---|
| 49 | AtomDescriptor AllAtoms();
|
|---|
| 50 | AtomDescriptor NoAtoms();
|
|---|
| [973c03] | 51 |
|
|---|
| 52 | // no true short circuit, but the test of the second descriptor wont be done
|
|---|
| [323177] | 53 | AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
|
|---|
| 54 | AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
|
|---|
| 55 | AtomDescriptor operator!(const AtomDescriptor &arg);
|
|---|
| [973c03] | 56 |
|
|---|
| [86b917] | 57 | #endif /* ATOMDESCRIPTOR_HPP_ */
|
|---|