source: molecuilder/src/Descriptors/AtomDescriptor.hpp@ 98a2987

Last change on this file since 98a2987 was a5471c, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added iterator structure that allows iterating over selected atoms in the World.

  • Property mode set to 100644
File size: 1.5 KB
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
12#include <vector>
13#include <map>
14#include <boost/shared_ptr.hpp>
15#include "World.hpp"
16
17class World;
18class atom;
19
20// internal implementation, allows assignment, copying etc
21class AtomDescripter_impl;
22
23class AtomDescriptor {
24 // close coupling to the world to allow access
25 friend atom* World::getAtom(AtomDescriptor descriptor);
26 friend std::vector<atom*> World::getAllAtoms(AtomDescriptor descriptor);
27 friend class World::AtomIterator;
28
29 friend AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
30 friend AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
31 friend AtomDescriptor operator!(const AtomDescriptor &arg);
32
33public:
34 typedef boost::shared_ptr<AtomDescriptor_impl> impl_ptr;
35
36 AtomDescriptor(impl_ptr);
37 AtomDescriptor(const AtomDescriptor&);
38 ~AtomDescriptor();
39
40 AtomDescriptor &operator=(AtomDescriptor &);
41
42protected:
43 atom* find();
44 std::vector<atom*> findAll();
45 impl_ptr get_impl() const;
46
47private:
48 impl_ptr impl;
49};
50
51// Functions to construct actual descriptors
52AtomDescriptor AllAtoms();
53AtomDescriptor NoAtoms();
54
55// no true short circuit, but the test of the second descriptor wont be done
56AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
57AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
58AtomDescriptor operator!(const AtomDescriptor &arg);
59
60#endif /* ATOMDESCRIPTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.